/* OGS Bus System - Unified Responsive Design System */

:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-focus: rgba(2, 132, 199, 0.22);
    --primary-light: #e0f2fe;
    --primary-dark: #075985;
    --primary-inverse: #ffffff;

    /* Align Pico CSS v1 variables with our palette */
    --font-family: "Plus Jakarta Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --border-radius: 10px;
    --form-element-spacing-vertical: 0.55rem;
    --form-element-spacing-horizontal: 0.85rem;

    --slate-950: #020617;
    --slate-900: #0f172a;
    --slate-850: #131d31;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50:  #f8fafc;

    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #065f46;

    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #991b1b;

    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --warning-border: #fde68a;
    --warning-text: #92400e;

    --info: #3b82f6;
    --info-bg: #eff6ff;
    --info-border: #bfdbfe;
    --info-text: #1e40af;

    --card-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.05), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --card-shadow-hover: 0 6px 16px -4px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --sidebar-width: 260px;
}

/* Global Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background-color: var(--slate-50);
    color: var(--slate-800);
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body.nav-locked {
    overflow: hidden;
}

code, kbd, pre {
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

h1, h2, h3, h4, h5 {
    color: var(--slate-900);
    letter-spacing: -0.015em;
}

/* Touch Ergonomics: minimum 44px hit targets */
button,
[role="button"],
input[type="submit"],
input[type="button"],
input[type="reset"],
.touch-target {
    min-height: 44px;
    touch-action: manipulation;
}

/* ==========================================================================
   Form & Input Normalization (Prevents jumping/misaligned fields)
   ========================================================================== */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
select,
textarea {
    font-family: inherit;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
    border-radius: 10px !important;
    border: 1.5px solid var(--slate-300) !important;
    background-color: #ffffff !important;
    color: var(--slate-900) !important;
    box-sizing: border-box;
    width: 100%;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
select {
    height: 46px !important;
    min-height: 46px !important;
    padding: 0.55rem 0.85rem !important;
}

input[type="file"] {
    min-height: 46px !important;
    padding: 0.45rem 0.75rem !important;
    display: flex;
    align-items: center;
    cursor: pointer;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):focus,
select:focus,
textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-focus) !important;
    outline: none;
}

input::placeholder,
textarea::placeholder {
    text-transform: none !important;
    font-weight: 400 !important;
    color: var(--slate-400) !important;
}

/* Remove Pico's inconsistent bottom margins inside structured form layouts */
.form-field,
.filter-bar-grid,
.form-grid-2,
.form-grid-3,
.form-grid-4,
.inline-form-row {
    --spacing: 0;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.15rem;
}

.form-field:last-child {
    margin-bottom: 0;
}

.filter-bar-grid .form-field,
.form-grid-2 .form-field,
.form-grid-3 .form-field,
.form-grid-4 .form-field {
    margin-bottom: 0;
}

.form-label,
.form-field > label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--slate-700);
    margin: 0 !important;
    line-height: 1.3;
}

.form-field input,
.form-field select,
.form-field textarea,
.filter-bar-grid input,
.filter-bar-grid select,
.filter-bar-grid button,
.inline-form-row input,
.inline-form-row select,
.inline-form-row button {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Unified Form & Filter Grids */
.form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.15rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.15rem;
}

.form-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
    margin-bottom: 1.15rem;
}

.filter-bar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    align-items: end;
}

.inline-form-row {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

@media (max-width: 1024px) {
    .form-grid-4 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .form-grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .form-grid-2,
    .form-grid-3,
    .form-grid-4,
    .filter-bar-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .inline-form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .inline-form-row > * {
        width: 100% !important;
    }
}

/* Unified Buttons */
button,
[role="button"],
input[type="submit"] {
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-full {
    width: 100%;
    min-height: 48px;
}

.btn-sm {
    min-height: 36px !important;
    padding: 0.35rem 0.75rem !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    margin: 0 !important;
    width: auto !important;
}

.btn-danger {
    background-color: var(--danger) !important;
    border-color: var(--danger) !important;
    color: #ffffff !important;
}

.btn-danger:hover {
    background-color: #dc2626 !important;
    border-color: #dc2626 !important;
}

.btn-success {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
    color: #ffffff !important;
}

.btn-success:hover {
    background-color: #059669 !important;
    border-color: #059669 !important;
}

/* ==========================================================================
   App Outer Shell Layout
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Modern Left Sidebar Navigation */
.app-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--slate-900);
    color: var(--slate-50);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--slate-800);
    z-index: 100;
    box-sizing: border-box;
}

/* Hard reset of Pico CSS nav link negative margins and conflicting rules */
.app-sidebar nav :where(a, [role=link]),
.sidebar-nav :where(a, [role=link]),
.sidebar-nav a,
.sidebar-nav .nav-item {
    margin: 0 !important;
    box-sizing: border-box;
}

.app-sidebar button,
.app-sidebar [role=button] {
    margin-bottom: 0 !important;
    box-sizing: border-box;
}

/* Sidebar Header */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem 1.15rem 1.25rem;
    border-bottom: 1px solid var(--slate-800);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: #ffffff;
}

.brand-symbol {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #ffffff;
    line-height: 1.2;
}

.brand-sub {
    font-size: 0.7rem;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--slate-400);
    cursor: pointer;
    padding: 0.5rem;
    margin: 0 !important;
    border-radius: 8px;
    width: 44px !important;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.sidebar-close-btn:hover {
    color: #ffffff;
    background-color: var(--slate-800);
}

/* Sidebar Nav Groups & Items */
.app-sidebar .sidebar-nav,
.sidebar-nav {
    flex: 1;
    padding: 1.25rem 0.85rem;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 1.5rem;
    margin: 0;
    box-sizing: border-box;
}

.sidebar-nav .nav-section,
.nav-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.sidebar-nav .nav-section-title,
.nav-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-400);
    padding: 0.25rem 0.75rem;
    margin: 0 0 0.25rem 0;
    display: block;
    box-sizing: border-box;
}

.sidebar-nav .nav-item,
.app-sidebar .nav-item,
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    margin: 0 !important;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--slate-300);
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    min-height: 44px;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    border: 1px solid transparent;
}

.sidebar-nav .nav-item:hover,
.app-sidebar .nav-item:hover,
.nav-item:hover {
    background-color: var(--slate-800);
    color: #ffffff;
    text-decoration: none;
}

.sidebar-nav .nav-item.active,
.app-sidebar .nav-item.active,
.nav-item.active {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.3);
    text-decoration: none;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar User Footer */
.sidebar-user-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-top: 1px solid var(--slate-800);
    background-color: #0b1120;
    margin-top: auto;
}

.user-meta {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.user-avatar-badge {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--slate-800);
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    border: 1px solid var(--slate-700);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-100);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    color: var(--slate-400);
}

.sidebar-logout-btn {
    background: transparent;
    border: none;
    color: var(--slate-400);
    padding: 0.5rem;
    margin: 0 !important;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    text-decoration: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.sidebar-logout-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Main Content Wrapper */
.app-main-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--slate-50);
}

/* Polished Top Header Bar */
.app-topbar {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.mobile-nav-toggle {
    display: none;
    background: var(--slate-100);
    border: 1px solid var(--slate-300);
    color: var(--slate-700);
    padding: 0.5rem;
    margin: 0 !important;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    min-width: 44px;
    min-height: 44px;
    transition: all 0.15s ease;
    box-sizing: border-box;
    flex-shrink: 0;
}

.mobile-nav-toggle:hover {
    background: var(--slate-200);
    color: var(--slate-900);
}

.topbar-brand-display {
    display: flex;
    align-items: center;
    min-width: 0;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

/* Language Dropdown Menu */
.lang-switcher {
    position: relative;
    display: inline-block;
}

details.lang-dropdown {
    border: none !important;
    background: transparent !important;
    margin: 0 !important;
    padding: 0 !important;
    position: relative;
    box-shadow: none !important;
}

details.lang-dropdown summary.lang-dropdown-trigger {
    list-style: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-300);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-700);
    cursor: pointer;
    min-height: 38px;
    user-select: none;
    transition: all 0.15s ease;
}

details.lang-dropdown summary::-webkit-details-marker {
    display: none !important;
}

details.lang-dropdown summary::after {
    display: none !important;
}

details.lang-dropdown summary.lang-dropdown-trigger:hover {
    background: var(--slate-100);
    border-color: var(--slate-400);
    color: var(--slate-900);
}

details.lang-dropdown[open] summary.lang-dropdown-trigger {
    background: var(--slate-200);
    border-color: var(--slate-400);
}

.lang-icon {
    color: var(--slate-500);
}

.current-lang-code {
    letter-spacing: 0.05em;
}

.chevron-icon {
    color: var(--slate-400);
    transition: transform 0.2s ease;
}

details.lang-dropdown[open] .chevron-icon {
    transform: rotate(180deg);
}

.lang-dropdown-content {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    min-width: 150px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 100;
}

.lang-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--slate-700);
    text-decoration: none;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.lang-dropdown-item:hover {
    background-color: var(--slate-100);
    color: var(--primary);
}

.lang-dropdown-item.active {
    background-color: #f0f9ff;
    color: var(--primary);
    font-weight: 600;
}

.lang-name {
    margin-right: auto;
}

.lang-code-pill {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    background: var(--slate-100);
    color: var(--slate-600);
    margin-left: 0.5rem;
    margin-right: 0.35rem;
}

.lang-dropdown-item.active .lang-code-pill {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.check-icon {
    color: var(--primary);
    flex-shrink: 0;
}

/* Main Content Area */
.app-main-content {
    flex: 1;
    padding: 1.5rem 2rem 3rem 2rem;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ==========================================================================
   Unified Card, Auth & Portal Components
   ========================================================================== */
section, article, .card, .ui-card {
    background: #ffffff;
    padding: 1.35rem;
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 1.5rem;
    border: 1px solid var(--slate-200);
}

@media (min-width: 768px) {
    section, article, .card, .ui-card {
        padding: 1.75rem;
    }
}

.ui-subcard {
    background: var(--slate-50);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--slate-200);
}

.filter-bar-card {
    background: var(--slate-50);
    padding: 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--slate-200);
    margin-bottom: 1.5rem;
}

.danger-zone-card {
    background: var(--danger-bg);
    padding: 1.35rem;
    border-radius: 14px;
    border: 1px solid var(--danger-border);
}

/* Unified Auth Card (Login / Register / Forgot Password across all portals) */
.auth-card {
    max-width: 460px;
    margin: 1.5rem auto;
    border-radius: 16px;
    border: 1px solid var(--slate-200);
    padding: 2rem 1.75rem;
    background: #ffffff;
    box-shadow: var(--card-shadow-hover);
}

.auth-card--wide {
    max-width: 560px;
}

.auth-card-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-icon-badge {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.auth-icon-badge--dark {
    background: var(--slate-100);
    color: var(--slate-800);
}

.auth-card-title {
    margin: 0 0 0.35rem 0;
    font-size: 1.5rem;
    color: var(--slate-900);
    font-weight: 700;
}

.auth-card-subtitle {
    color: var(--slate-500);
    font-size: 0.92rem;
    margin: 0 auto;
    max-width: 34ch;
    line-height: 1.45;
}

.auth-card-footer {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--slate-100);
    text-align: center;
    font-size: 0.9rem;
    color: var(--slate-500);
}

.auth-card-footer a {
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
}

.auth-card-footer a:hover {
    text-decoration: underline;
}

/* Unified Portal Hero Banners */
.portal-hero {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff;
    border: none;
    padding: 1.75rem;
    border-radius: 16px;
    box-shadow: 0 6px 16px -4px rgba(2, 132, 199, 0.28);
}

.portal-hero--dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    box-shadow: 0 8px 20px -4px rgba(15, 23, 42, 0.3);
}

.portal-hero h2 {
    color: #ffffff;
    margin: 0 0 0.35rem 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.portal-hero p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 0.95rem;
}

/* Unified Horizontal Portal Tabs */
.portal-tabs {
    margin: 0.5rem 0 1.75rem 0;
    border-bottom: 2px solid var(--slate-200);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.portal-tabs::-webkit-scrollbar {
    display: none;
}

.portal-tabs ul {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: max-content;
}

.portal-tabs li {
    margin: 0;
    padding: 0;
}

.portal-tabs a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.5rem 1rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    white-space: nowrap;
    color: var(--slate-500);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.portal-tabs a:hover {
    color: var(--slate-900);
    background-color: var(--slate-100);
}

.portal-tabs a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background-color: rgba(2, 132, 199, 0.05);
}

/* Section Header Bar */
.section-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.section-header-bar h2,
.section-header-bar h3 {
    margin: 0;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

/* Modern Toast / Flash Alert Styling */
.flashes-container {
    margin-bottom: 1.5rem;
}

.alert-toast {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.85rem;
    padding: 0.85rem 1.15rem;
    border-radius: 10px;
    margin-bottom: 0.75rem;
    border: 1px solid;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    font-size: 0.95rem;
    line-height: 1.5;
}

.alert-toast .toast-icon {
    display: flex;
    align-items: center;
    margin-top: 2px;
    flex-shrink: 0;
}

.alert-toast .toast-content {
    flex-grow: 1;
}

.alert-toast .toast-close-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    padding: 0.2rem;
    width: 30px !important;
    min-height: 30px;
    min-width: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: opacity 0.15s ease;
}

.alert-toast .toast-close-btn:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.06);
}

.alert-toast.alert-success {
    background-color: var(--success-bg);
    border-color: var(--success-border);
    color: var(--success-text);
}

.alert-toast.alert-error {
    background-color: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

.alert-toast.alert-warning {
    background-color: var(--warning-bg);
    border-color: var(--warning-border);
    color: var(--warning-text);
}

.alert-toast.alert-info {
    background-color: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}

/* Modern Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-booked {
    background-color: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.badge-cancelled {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.badge-boarded {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.badge-neutral {
    background-color: var(--slate-100);
    color: var(--slate-600);
    border: 1px solid var(--slate-200);
}

/* Interactive Calendar Styles */
.calendar-card {
    background: #ffffff;
    border-radius: 14px;
    padding: 1.25rem;
    border: 1px solid var(--slate-200);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    max-width: 520px;
    margin: 0 auto 1.5rem auto;
}

.calendar-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.calendar-nav-btn {
    width: auto !important;
    min-height: 40px;
    min-width: 40px;
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    background: var(--slate-50);
    border: 1px solid var(--slate-300);
    color: var(--slate-700);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    transition: all 0.15s ease;
}

.calendar-nav-btn:hover {
    background: var(--slate-200);
    color: var(--slate-900);
}

.calendar-month-heading {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--slate-900);
    text-align: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    width: 100%;
}

.calendar-weekday-header {
    text-align: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--slate-500);
    padding: 0.35rem 0;
    text-transform: uppercase;
}

.calendar-day-tile {
    min-height: 46px;
    min-width: 36px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--slate-200);
    background: #ffffff;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--slate-800);
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.15s ease;
    touch-action: manipulation;
}

@media (max-width: 420px) {
    .calendar-card {
        padding: 0.85rem;
    }
    .calendar-grid {
        gap: 4px;
    }
    .calendar-day-tile {
        min-height: 42px;
        font-size: 0.85rem;
    }
}

.calendar-day-tile:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Available Day State */
.calendar-day-tile.available:hover {
    border-color: var(--primary);
    background-color: #f0f9ff;
    color: var(--primary);
}

/* Selected Day State */
.calendar-day-tile.selected {
    background: var(--primary) !important;
    color: #ffffff !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.35);
    font-weight: 700;
}

.calendar-day-tile.selected::after {
    content: "✓";
    font-size: 0.65rem;
    font-weight: 900;
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: #e0f2fe;
}

/* Already Booked Day State */
.calendar-day-tile.booked {
    background-color: #ecfdf5;
    color: #065f46;
    border-color: #6ee7b7;
    font-weight: 600;
}

.calendar-day-tile.booked::after {
    content: "●";
    font-size: 0.55rem;
    position: absolute;
    bottom: 2px;
    right: 4px;
    color: #10b981;
}

/* Blocked Days (Holidays / Closed) */
.calendar-day-tile.blocked {
    background-color: var(--slate-100);
    color: var(--slate-400);
    border-color: var(--slate-200);
    cursor: not-allowed;
    text-decoration: line-through;
    opacity: 0.75;
}

.calendar-day-tile.blocked::after {
    content: "✕";
    font-size: 0.6rem;
    color: var(--danger);
    position: absolute;
    top: 3px;
    right: 4px;
}

/* Weekends & Cutoffs */
.calendar-day-tile.weekend,
.calendar-day-tile.cutoff {
    background-color: var(--slate-50);
    color: var(--slate-300);
    border-color: var(--slate-100);
    cursor: not-allowed;
}

/* Calendar Legend */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--slate-100);
    font-size: 0.8rem;
    color: var(--slate-500);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid var(--slate-300);
    display: inline-block;
}

.legend-dot.dot-available { background: #ffffff; border-color: var(--slate-400); }
.legend-dot.dot-selected { background: var(--primary); border-color: var(--primary-hover); }
.legend-dot.dot-booked { background: #ecfdf5; border-color: #10b981; }
.legend-dot.dot-blocked { background: var(--slate-100); border-color: var(--slate-300); }

/* Weekday Selector Chips */
.weekday-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
    gap: 8px;
    margin: 0.75rem 0 1.25rem 0;
}

.weekday-chip-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.5rem;
    border-radius: 8px;
    border: 1.5px solid var(--slate-300);
    background: #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--slate-700);
    cursor: pointer;
    min-height: 48px;
    min-width: 44px;
    transition: all 0.15s ease;
    user-select: none;
    margin-bottom: 0 !important;
}

.weekday-chip-label:hover {
    border-color: var(--primary);
    background-color: #f0f9ff;
}

.weekday-chip-label.checked {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary-hover);
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
}

.weekday-chip-label input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

/* Selected Dates Interactive Summary Box */
.selected-dates-summary {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.selected-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 0.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.selected-date-tag {
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1px solid #bae6fd;
    padding: 0.3rem 0.65rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.selected-date-tag .remove-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    min-height: auto;
    min-width: auto;
}

.selected-date-tag .remove-btn:hover {
    color: var(--danger);
}

/* Child Selector Chips */
.child-chips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 1.25rem;
}

.child-chip-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1.5px solid var(--slate-300);
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
    min-height: 52px;
    margin-bottom: 0 !important;
}

.child-chip-card:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}

.child-chip-card.checked {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.15);
}

.child-chip-card input[type="checkbox"] {
    margin: 0;
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
}

/* Empty State Component */
.empty-state-box {
    text-align: center;
    padding: 2.5rem 1.5rem;
    background: var(--slate-50);
    border-radius: 14px;
    border: 2px dashed var(--slate-300);
    margin: 1.25rem 0;
}

.empty-state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--slate-200);
    color: var(--slate-500);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--slate-700);
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: var(--slate-500);
    max-width: 420px;
    margin: 0 auto 1.25rem auto;
    font-size: 0.95rem;
}

/* Driver Touch-Optimized Checkin Screen */
.checkin-card {
    max-width: 540px;
    margin: 1rem auto 2rem auto;
    text-align: center;
    background: #ffffff;
    padding: 2rem 1.5rem;
    border-radius: 18px;
    border: 1.5px solid var(--slate-200);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
}

.checkin-icon-badge {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background: #e0f2fe;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.checkin-huge-input {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    text-align: center !important;
    letter-spacing: 2px !important;
    padding: 0.85rem 1rem !important;
    height: 64px !important;
    min-height: 64px !important;
    border: 2px solid var(--primary) !important;
    border-radius: 12px !important;
    margin-bottom: 1rem !important;
    background-color: var(--slate-50) !important;
}

.checkin-huge-input:focus {
    background-color: #ffffff !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.2) !important;
}

.checkin-submit-btn {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    min-height: 54px !important;
    border-radius: 12px !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.25) !important;
}

/* Responsive Table into Card Transformation on Mobile */
@media (max-width: 768px) {
    .responsive-cards-table thead {
        display: none;
    }

    .responsive-cards-table,
    .responsive-cards-table tbody,
    .responsive-cards-table tr,
    .responsive-cards-table td {
        display: block;
        width: 100%;
    }

    .responsive-cards-table tr {
        margin-bottom: 1rem;
        background: #ffffff;
        border: 1px solid var(--slate-200);
        border-radius: 12px;
        padding: 0.85rem 1rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    }

    .responsive-cards-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.75rem;
        padding: 0.55rem 0 !important;
        border-bottom: 1px solid var(--slate-100) !important;
        text-align: right;
        font-size: 0.9rem;
    }

    .responsive-cards-table td:last-child {
        border-bottom: none !important;
        padding-top: 0.75rem !important;
    }

    .responsive-cards-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--slate-500);
        text-align: left;
        flex-shrink: 0;
    }

    .responsive-cards-table .table-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Quick Select Buttons */
.quick-action-btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.5rem 0 1rem 0;
}

.quick-action-btn {
    width: auto !important;
    min-height: 40px;
    padding: 0.35rem 0.85rem;
    font-size: 0.85rem;
    border-radius: 8px;
    background: var(--slate-100);
    color: var(--slate-700);
    border: 1px solid var(--slate-300);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.15s ease;
}

.quick-action-btn:hover {
    background: var(--slate-200);
    color: var(--slate-900);
}

/* App Footer */
.app-footer {
    margin-top: 3rem;
    padding-top: 1.75rem;
    border-top: 1px solid var(--slate-200);
    text-align: center;
    font-size: 0.85rem;
    color: var(--slate-500);
}

.footer-title {
    font-weight: 600;
    color: var(--slate-700);
    margin-bottom: 0.4rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-dot {
    color: var(--slate-300);
}

.footer-sub {
    font-size: 0.75rem;
    color: var(--slate-400);
    margin: 0;
}

/* Mobile Quick-Access Tab Bar (Phone Viewports < 768px) */
.mobile-bottom-tabs {
    display: none;
}

/* Media Queries for Sidebar Responsiveness */
@media (max-width: 1024px) {
    .mobile-nav-toggle {
        display: flex;
    }

    .sidebar-close-btn {
        display: flex;
    }

    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    }

    .app-sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.55);
        backdrop-filter: blur(2px);
        z-index: 999;
    }

    .sidebar-backdrop.active {
        display: block;
    }

    .app-main-content {
        padding: 1.25rem 1rem 3rem 1rem;
    }
}

@media (max-width: 768px) {
    .app-topbar {
        padding: 0 1rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
        margin: 0.75rem auto;
    }

    .mobile-bottom-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: #ffffff;
        border-top: 1px solid var(--slate-200);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        z-index: 80;
        align-items: center;
        justify-content: space-around;
        padding: 0 0.5rem;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .bottom-tab-item,
    .mobile-bottom-tabs :where(a, [role=link]) {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: var(--slate-500);
        flex: 1;
        height: 100%;
        border: none;
        background: transparent;
        cursor: pointer;
        min-height: 48px;
        padding: 0;
        margin: 0 !important;
        box-sizing: border-box;
    }

    .bottom-tab-item.active {
        color: var(--primary);
        font-weight: 600;
    }

    .bottom-tab-item .tab-icon {
        width: 20px;
        height: 20px;
    }

    .bottom-tab-item .tab-text {
        font-size: 0.65rem;
        line-height: 1;
        font-weight: 600;
    }

    .app-main-content {
        padding-bottom: 5.5rem;
    }
}

/* Topbar Logout Button */
.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.35rem 0.75rem;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 99px;
    color: var(--slate-600);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: 38px;
}

.topbar-logout-btn:hover {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger);
}

.topbar-logout-btn .logout-text {
    line-height: 1;
}

@media (max-width: 600px) {
    .topbar-logout-btn .logout-text {
        display: none;
    }
}
