/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@300;400;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css');

:root {
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-dark: #4338ca;
    /* Indigo 700 */
    --secondary: #000;
    /* Slate 500 */
    --text-main: #020617;
    /* Slate 950 - Near Black */
    --text-sub: #4b5563;
    /* Slate 600 - Darker Gray */
    --danger: #ef4444;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito Sans', sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-size: 15px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Auth Layout */
/* Auth Layout */
.auth-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f8fafc;
    /* Very light slate */
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Removed dark background shapes */
.auth-wrapper::before {
    content: none;
}

.auth-box {
    background: #ffffff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e5e7eb;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.auth-box h2 {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.auth-icon {
    display: none;
}

/* Link styling for ghost buttons in auth */
.auth-box .btn-ghost {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    margin-left: 4px;
    border: none;
}

.auth-box .btn-ghost:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* Dashboard Layout */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
    /* max-width: 1400px; */
    margin: 0 auto;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.05);
    background: var(--bg-surface);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--border);
    /* padding: 24px; */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    /* Soft shadow for depth */
}

.sidebar h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0px 10px;
}

.sidebar button {
    text-align: left;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--secondary);
    font-weight: 700;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.2s;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar button:hover {
    background: #f3f4f6;
    color: var(--primary);
}

.sidebar button.active {
    background: #eef2ff;
    color: var(--primary);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
}

.user-info {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 10px;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 30px;
    background: #f9fafb;
    overflow-y: auto;
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.view-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
}

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    height: 42px;
    /* Fixed height for consistency */
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-sub);
}

.btn-ghost:hover {
    background: #f3f4f6;
    color: var(--text-main);
}

.input-field {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    height: 42px;
    /* Match button height */
    background: #f9fafb;
}

.input-field:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Components */
.card {
    background: #fff;
    border-radius: var(--radius);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

/* Driver Card Specifics */
.driver-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.driver-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.driver-meta h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
}

.driver-meta span {
    font-size: 13px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Tables */
.table-container {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f9fafb;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-sub);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

tr:last-child td {
    border-bottom: none;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #f3f4f6;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
}

.btn-danger:hover {
    background: #fecaca;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    padding: 0;
}

.btn-ghost:hover {
    text-decoration: underline;
}

/* Mobile */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
    }

    .main-content {
        padding: 20px;
    }
}

.hidden {
    display: none !important;
}

/* Logo Styling */
.auth-logo {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.sidebar-logo {
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.sidebar-logo img {
    max-width: 100%;
    height: auto;
    max-height: 90px;
}

#user-list-body td button.btn-ghost {
    border: none;
    cursor: pointer;
    font-size: 18px;
}

/* Select2 Overrides */
.select2-container .select2-selection--single {
    height: 50px !important;
    padding: 10px 16px;
    background: #fff;
    border: 2px solid #e5e7eb !important;
    border-radius: 12px !important;
    font-size: 14px;
    display: flex !important;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 48px !important;
    top: 1px !important;
    right: 10px !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-left: 0 !important;
    color: var(--text-main) !important;
}

.select2-container--open .select2-selection--single {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.select2-dropdown {
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden !important;
    margin-top: 4px;
}

.select2-search--dropdown .select2-search__field {
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
}

.select2-results__option {
    padding: 10px 16px !important;
    font-size: 14px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--primary) !important;
    color: white !important;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #9ca3af !important;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    transition: opacity 0.2s;
}

.modal {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.btn-ghost {
    border: none;
    cursor: pointer;
}

.btn-ghost:hover {
    text-decoration: none !important;
}

/* Two Column Form Layout */
#add-driver-form,
#add-vehicle-form,
#edit-driver-form,
#edit-vehicle-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

#add-driver-form .form-group,
#add-vehicle-form .form-group,
#edit-driver-form .form-group,
#edit-vehicle-form .form-group {
    margin-bottom: 0;
}

#add-driver-form button[type="submit"],
#add-vehicle-form button[type="submit"],
#edit-driver-form button[type="submit"],
#edit-vehicle-form button[type="submit"] {
    grid-column: span 2;
    margin-top: 10px;
    width: auto;
    justify-self: start;
    min-width: 150px;
}

/* Ensure full width on mobile */
@media (max-width: 640px) {

    #add-driver-form,
    #add-vehicle-form,
    #edit-driver-form,
    #edit-vehicle-form {
        grid-template-columns: 1fr;
    }

    #add-driver-form button[type="submit"],
    #add-vehicle-form button[type="submit"],
    #edit-driver-form button[type="submit"],
    #edit-vehicle-form button[type="submit"] {
        grid-column: span 1;
        width: 100% !important;
    }
}

/* Feedback Styles */
.feedback-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}

.feedback-item:last-child {
    border-bottom: none;
}

.feedback-avatar-container {
    flex-shrink: 0;
}

.feedback-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e0e7ff;
    /* Lighter indigo */
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.feedback-body {
    flex: 1;
}

.feedback-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.feedback-user {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
}

.feedback-time {
    font-size: 12px;
    color: var(--text-sub);
}

.feedback-text {
    color: var(--text-sub);
    font-size: 14px;
    line-height: 1.5;
}

.feedback-actions {
    flex-shrink: 0;
}

.btn-icon-delete {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* Notification Badge */
.nav-btn-container {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-nav button {
    position: relative;
    /* Ensure relative positioning for absolute child */
}

.notification-badge {
    position: absolute;
    top: 13px;
    right: 12px;
    background-color: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 99px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    z-index: 10;
}

.notification-badge.hidden {
    display: none;
}

/* Driver Details Improved UI */
.driver-details-grid {
    display: flex;
    flex-wrap: wrap;
    /* Allow wrapping only if absolutely necessary on mobile */
    gap: 12px 40px;
    /* Large horizontal gap to distinguish items */
    /* margin-top: 16px; */
    width: 100%;
    align-items: center;
}

.driver-detail-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-sub);
    padding: 0;
    white-space: nowrap;
    /* Prevent internal wrapping */
}

.driver-detail-item i {
    color: var(--primary);
    /* Icon color */
    width: 20px;
    /* Fixed width for alignment */
    text-align: center;
    font-size: 14px;
}

.driver-note {
    grid-column: 1 / -1;
    /* Spans full width */
    background: #eff6ff;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    border-left: 4px solid var(--primary);
    margin-top: 6px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}