@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');
/* Add Thai Font */

:root {
    /* Color Palette - Modern Indigo & Slate */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: #e0e7ff;

    --secondary: #64748b;
    --secondary-hover: #475569;

    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fee2e2;

    --success: #10b981;
    --warning: #f59e0b;

    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;

    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border: #e2e8f0;

    /* Spacing & Radius */
    --radius-sm: 0.5rem;
    /* 8px */
    --radius-md: 0.75rem;
    /* 12px */
    --radius-lg: 1rem;
    /* 16px */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Transition */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Sarabun', 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
.container {
    max-width: 95%;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
/* Header */
.main-header {
    background: var(--bg-surface);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    border: 1px solid var(--border);
}

.header-top {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
}

#mobile-menu-toggle {
    display: none;
}

.nav-tabs-container {
    flex: 1;
    overflow-x: auto;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

h2,
h3 {
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Index Header Actions */
.index-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-body);
    border-color: var(--text-muted);
}

/* Forms */
.form-card {
    background: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    background-color: #f8fafc;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background-color: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Nav Tabs (Header) */
.nav-tabs {
    display: flex;
    gap: 0.5rem;
}

.nav-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.nav-tab-btn:hover {
    color: var(--primary);
    background: var(--bg-body);
}

.nav-tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.nav-tab-btn i {
    font-size: 1rem;
}

/* Original Tabs (Deprecated but kept if needed) */
.tabs {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition);
    min-width: 130px;
    flex-shrink: 0;
}

.tab-btn i {
    font-size: 1.75rem;
    transition: var(--transition);
}

.tab-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    border-color: transparent;
    box-shadow: var(--shadow-md);
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    background: var(--bg-body);
    font-weight: 600;
    color: var(--text-muted);
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

tr:hover td {
    background-color: var(--bg-body);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    /* Slate 900 with opacity */
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    box-shadow: 2xl;
    animation: scaleUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Calendar Specific */
#calendar-container {
    background: white;
    /* padding: 2rem; */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.fc-toolbar-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--text-main);
}

/* Custom Calendar Styling */
.fc {
    font-family: 'Sarabun', 'Inter', sans-serif !important;
    --fc-border-color: var(--border);
    --fc-button-bg-color: var(--primary);
    --fc-button-border-color: var(--primary);
    --fc-button-hover-bg-color: var(--primary-hover);
    --fc-button-hover-border-color: var(--primary-hover);
    --fc-button-active-bg-color: var(--primary-hover);
    --fc-button-active-border-color: var(--primary-hover);
    --fc-today-bg-color: #f8fafc !important;
}

.fc-button {
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow-sm);
    text-transform: capitalize !important;
    font-weight: 500 !important;
    padding: 0.5rem 1rem !important;
}

.fc-col-header-cell {
    padding: 1rem 0 !important;
    background-color: var(--bg-body);
}

.fc-col-header-cell-cushion {
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
}

.fc-daygrid-day-number {
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none !important;
    padding: 0.5rem !important;
}

.fc-daygrid-event {
    border-radius: 4px !important;
    padding: 2px 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
    border: none !important;
}

.fc-daygrid-event:hover {
    transform: scale(1.02);
    z-index: 5;
}

.fc-timegrid-slot-label-cushion {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.fc-highlight {
    background: var(--primary-light) !important;
    opacity: 0.5;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f1f5f9 0%, #cbd5e1 100%);
}

.login-page .form-card {
    width: 100%;
    max-width: 400px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleUp {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* List Items (Drivers, Vehicles) */
ul li {
    background: white;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

ul li:hover {
    border-color: var(--primary);
    transform: translateX(2px);
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .container {
        padding: 1rem;
        width: 100%;
        max-width: 100%;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 1rem;
    }

    .header-top {
        width: 100%;
    }

    #mobile-menu-toggle {
        display: inline-flex;
    }

    /* Hide tabs by default on mobile, show via JS */
    .nav-tabs {
        display: none;
        flex-direction: column;
        width: 100%;
        background: var(--bg-body);
        padding: 0.5rem;
        border-radius: var(--radius-sm);
        margin-top: 0.5rem;
    }

    /* This class will be toggled by JS in admin.php */
    .nav-tabs[style*="display: flex"] {
        display: flex !important;
    }

    .nav-tab-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem;
        background: white;
        border: 1px solid var(--border);
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .header-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .grid-cols-2 {
        grid-template-columns: 1fr;
    }

    /* Adjust tables for mobile */
    th,
    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .form-card {
        padding: 1.5rem;
    }

    /* Index Page Tweaks */
    .index-header-actions {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .action-buttons {
        flex-direction: column;
        width: 100%;
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* FullCalendar Mobile */
    .fc-toolbar {
        flex-direction: column;
        gap: 0.75rem;
    }

    .fc-toolbar-title {
        font-size: 1.25rem !important;
    }

    .fc-header-toolbar {
        margin-bottom: 1rem !important;
    }

    /* Make today/prev/next buttons smaller */
    .fc-button {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
    }
}

/* Layout Wrapper for Calendar + Sidebar */
.content-wrapper {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    /* Enforce equal height */
    height: 650px;
    /* Fixed height container to ensure consistent look */
}

.calendar-section {
    flex: 1;
    min-width: 0;
    height: 100%;
}

#calendar-container {
    height: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

#calendar {
    flex: 1;
    /* Make calendar fill the container */
    overflow: hidden;
}

.status-sidebar {
    width: 280px;
    flex-shrink: 0;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Match parent height */
}

/* Status List Styles */
.status-list {
    list-style: none;
    margin-top: 0.5rem;
    overflow-y: auto;
    /* Scroll inside the list only */
    flex: 1;
    padding-right: 5px;
    /* Space for scrollbar */
}

/* Custom Scrollbar */
.status-list::-webkit-scrollbar {
    width: 4px;
}

.status-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.status-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.status-list::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

.status-item {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 0.6rem 0.8rem;
    /* Compact padding */
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    transition: var(--transition);
    font-size: 0.85rem;
    /* Smaller font */
}

.status-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.status-badge {
    padding: 0.15rem 0.4rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 60px;
    text-align: center;
}

.status-badge.pending {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
}

.status-badge.approved {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #dcfce7;
}

.status-badge.rejected {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fee2e2;
}

.status-badge.completed {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.status-details {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-time {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    display: block;
}

/* Mobile Responsiveness for Sidebar */
@media (max-width: 1024px) {
    .content-wrapper {
        flex-direction: column;
        height: auto;
        /* Allow auto height on mobile */
    }

    #calendar-container {
        height: 600px;
        /* Fixed height for mobile calendar */
    }

    .status-sidebar {
        width: 100%;
        height: 400px;
        /* Fixed height for mobile status */
    }
}