@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600&display=swap');

:root {
    --primary: #4361ee;
    --primary-soft: rgba(67, 97, 238, 0.1);
    --bg-gradient: linear-gradient(135deg, #f8f9ff 0%, #e0e7ff 100%);
    --text-dark: #2b2d42;
    --text-gray: #8d99ae;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Kanit', sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.main-wrapper {
    width: 100%;
    max-width: 400px;
}

.container {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px); /* เอฟเฟกต์กระจกฝ้า */
    padding: 40px 30px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.icon-header {
    width: 70px;
    height: 70px;
    background: var(--primary);
    color: white;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 20px;
    box-shadow: 0 10px 20px rgba(67, 97, 238, 0.3);
}

h2 {
    color: var(--text-dark);
    font-size: 24px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-gray);
    font-size: 14px;
    margin-bottom: 30px;
}

.input-group {
    text-align: left;
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group label i {
    color: var(--primary);
    margin-right: 5px;
}

/* แก้ไขจากเดิมที่มีแค่ tel และ text */
input[type="tel"], 
input[type="text"], 
input[type="password"] {  /* เพิ่มบรรทัดนี้เข้าไป */
    width: 100%;
    padding: 14px 16px;
    border: 2px solid transparent;
    background: #f1f3f9;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
}

input:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

button {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

button:hover {
    background: #3046c4;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(67, 97, 238, 0.2);
}

button:active {
    transform: translateY(0);
}

.footer-text {
    margin-top: 25px;
    font-size: 13px;
    color: var(--text-gray);
}

.footer-text a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
/* การ์ดทั่วไป (General Card) - เน้นความโปร่งและสะอาด */
.card {
    background: #ffffff;
    border: 1px solid rgba(226, 232, 240, 0.8); /* เส้นขอบบางลงมาก */
    padding: 20px;
    border-radius: 16px; /* โค้งมนมากขึ้นดูทันสมัย */
    margin-bottom: 16px;
    text-align: left;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* เงาบางๆ ให้ดูมีมิติ */
    transition: transform 0.2s ease;
}

/* การ์ดข้อมูลผู้ใช้ (User Card) - เน้นโทนสีเทาที่สะอาดตา (Slate) */
.user-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: left;
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* การ์ดการจองของฉัน (My Booking) - ใช้สีเขียวแบบ Mint-Modern */
.mybooking {
    background: #f0fdf4; /* เขียวอ่อนแบบสะอาด */
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 20px;
    text-align: left;
    border-left: 6px solid #22c55e; /* แถบสีด้านข้างทำให้ดู Professional */
    box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.05);
    position: relative;
    overflow: hidden;
}

/* เอฟเฟกต์เมื่อแตะบนมือถือ */
.card:active, .user-card:active, .mybooking:active {
    transform: scale(0.98);
   
}
/* Seat Selection Page Styles */
.seat-selection-page {
    padding: 15px;
    max-width: 450px;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.back-btn {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.trip-info h3 { font-size: 16px; margin: 0; }
.trip-info p { font-size: 13px; color: var(--text-gray); }

/* Legend */
.seat-legend {
    display: flex;
    justify-content: space-around;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 12px;
}

.seat-legend .item { display: flex; align-items: center; gap: 6px; }
.seat-legend .box { width: 15px; height: 15px; border-radius: 4px; }
.box.available { background: #f1f3f9; border: 1px solid #e2e8f0; }
.box.selected { background: var(--primary); }
.box.booked { background: #cbd5e1; }

/* Bus Layout */
.bus-container {
    background: #fff;
    padding: 25px 15px;
    border-radius: 30px 30px 15px 15px;
    border: 3px solid #e2e8f0;
    position: relative;
}

.driver-section {
    display: flex;
    justify-content: flex-end;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 2px dashed #e2e8f0;
    color: var(--text-gray);
    font-size: 12px;
}

/* ผังที่นั่งแบบ Grid (4 คอลัมน์) */
.seat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr); /* 4 ที่นั่งต่อแถว */
    gap: 12px;
    column-gap: 20px; /* เพิ่มช่องว่างตรงกลางเป็นทางเดิน */
}

/* เว้นช่องว่างตรงกลางให้เหมือนทางเดินรถบัส */
.seat-grid > .seat-item:nth-child(4n-2) {
    margin-right: 20px;
}

.seat-item { cursor: pointer; position: relative; }
.seat-item input { position: absolute; opacity: 0; }

.seat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f1f3f9;
    padding: 12px 5px;
    border-radius: 10px;
    transition: 0.2s;
    color: #94a3b8;
}

.seat-box i { font-size: 20px; }
.seat-box small { font-size: 10px; font-weight: 600; margin-top: 4px; }

/* เมื่อเลือกที่นั่ง */
.seat-item input:checked + .seat-box {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 5px 12px rgba(67, 97, 238, 0.3);
}

/* ที่นั่งที่จองแล้ว */
.seat-item.booked .seat-box {
    background: #e2e8f0;
    color: #cbd5e1;
    cursor: not-allowed;
}

/* ปุ่มยืนยันด้านล่าง */
.footer-action {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.selected-summary {
    text-align: center;
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-gray);
}

#display-seat {
    color: var(--primary);
    font-weight: 700;
    font-size: 18px;
}
/* Admin Specific Styles */
.admin-body {
    background: #0f172a; /* พื้นหลังสีน้ำเงินเข้มเกือบดำ ดูเป็นระบบหลังบ้าน */
}

.admin-login-card {
    border-top: 5px solid #334155;
    max-width: 380px;
}

.admin-icon {
    width: 60px;
    height: 60px;
    background: #334155;
    color: #f8fafc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 15px;
}

.btn-admin {
    background: #1e293b; /* ปุ่มสีเข้ม */
    border: 1px solid #334155;
}

.btn-admin:hover {
    background: #334155;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.footer-link {
    margin-top: 20px;
    font-size: 13px;
}

.footer-link a {
    color: var(--text-gray);
    text-decoration: none;
    transition: 0.3s;
}

.footer-link a:hover {
    color: var(--primary);
}
/* Dashboard Layout */
.admin-bg { background: #f1f5f9; }
.admin-dashboard { max-width: 600px; padding: 25px; text-align: left; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.admin-header h2 { margin-bottom: 0; font-size: 1.5rem; }
.logout-icon { color: #ef4444; font-size: 1.2rem; }

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* 2 คอลัมน์บนมือถือ */
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
}

.stat-card i { font-size: 24px; }
.stat-card .label { display: block; font-size: 12px; color: #64748b; }
.stat-card .value { font-size: 20px; font-weight: 700; color: #1e293b; }

/* สีประจำ Card */
.blue i { color: #3b82f6; }
.green i { color: #10b981; }
.purple i { color: #8b5cf6; }
.orange i { color: #f59e0b; }

/* Menu Grid */
.admin-menu h3 { font-size: 16px; margin-bottom: 15px; color: #475569; }
.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.menu-item {
    background: #fff;
    text-decoration: none;
    padding: 20px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #1e293b;
    font-weight: 500;
    transition: 0.2s;
    border: 1px solid transparent;
}

.menu-item i { font-size: 24px; color: #4361ee; }
.menu-item:hover {
    border-color: #4361ee;
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(67, 97, 238, 0.1);
}
/* Schedule Admin Styles */
.admin-schedule {
    max-width: 500px;
    padding: 20px;
}

.add-btn-top {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(67, 97, 238, 0.3);
}

.trip-card.admin-variant {
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #f1f5f9;
}

.trip-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.route strong { font-size: 16px; color: var(--text-dark); }
.route i { font-size: 12px; color: var(--text-gray); margin: 0 5px; }

.date-badge {
    background: #f1f5f9;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}

.trip-details {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-gray);
}

/* Progress Bar */
.progress-container {
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}
.progress-bar { height: 100%; transition: 0.3s; }

/* Action Buttons Grid */
.action-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 8px;
}

.btn-action {
    padding: 10px 5px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: none;
    cursor: pointer;
}

.btn-action.view { background: #eef2ff; color: #4361ee; }
.btn-action.edit { background: #fffbeb; color: #d97706; }
.btn-action.delete { background: #fef2f2; color: #ef4444; }

.btn-action:active { transform: scale(0.95); }
/* Admin Form Styles */
.admin-form-page {
    max-width: 450px;
    padding: 20px;
    text-align: left;
}

.form-card {
    background: #fff;
    padding: 30px 25px;
    border-radius: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.form-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 15px;
}

.custom-select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #f1f3f9;
    background: #f1f3f9;
    border-radius: 12px;
    font-size: 15px;
    appearance: none; /* ลบลูกศรเดิม */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    outline: none;
    transition: 0.3s;
}

.custom-select:focus {
    border-color: var(--primary);
    background-color: #fff;
}

.btn-save {
    margin-top: 10px;
    background: var(--primary);
    box-shadow: 0 8px 20px rgba(67, 97, 238, 0.25);
}

.form-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 15px;
}
.trip-summary-card {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.route-line { font-size: 18px; margin-bottom: 10px; }
.time-badge { font-size: 14px; opacity: 0.8; }

/* ปรับแต่ง Select ให้ดูดีขึ้น */
.custom-select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    font-size: 16px;
}
.date-selector-card {
    background: #fff;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.date-selector-card input {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 16px;
}

.status-active { 
    border-left: 6px solid #10b981 !important; 
    background: #f0fdf4 !important; 
}
.status-pending { 
    border-left: 6px solid #94a3b8 !important; 
    background: #f8fafc !important; 
}

.trip-time { font-size: 1.2rem; color: #1e293b; }
.route-info { margin: 10px 0; color: #475569; font-weight: 500; }
.assign-info p { margin: 4px 0; font-size: 14px; color: #64748b; }

.empty-state { text-align: center; padding: 40px 20px; color: #94a3b8; }
.empty-state i { font-size: 50px; margin-bottom: 10px; }

.qr-container {
    transition: transform 0.3s ease;
}
.qr-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}
.btn-confirm {
    background: linear-gradient(135deg, #4361ee, #4cc9f0);
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}
/* ปรับสไตล์ส่วนข้อมูลจัดรถให้เข้มและชัดเจน */
.info-assignment {
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); /* เพิ่มมิติความลึก */
}

.info-assignment span {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ปรับระยะห่าง stop-item หลังเอาราคาออก */
.stop-item {
    padding: 15px 5px; 
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}