:root {
    /* Modern Color Palette */
    --primary-color: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --secondary-color: #64748b;
    /* Slate 500 */
    --background-color: #f8fafc;
    /* Slate 50 */
    --card-bg: #ffffff;
    --text-main: #1e293b;
    /* Slate 800 */
    --text-muted: #64748b;
    /* Slate 500 */
    --success: #10b981;
    /* Emerald 500 */
    --danger: #ef4444;
    /* Red 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --info: #3b82f6;
    /* Blue 500 */

    /* Layout & Spacing */
    --border-radius: 16px;
    --sidebar-width: 280px;

    /* Effects */
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass: rgba(255, 255, 255, 0.95);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

/* Utilities */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.95rem;
    gap: 8px;
    letter-spacing: 0.025em;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
    background-color: #f8fafc;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    padding: 32px;
    margin-bottom: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.card-header {
    margin: -32px -32px 24px -32px;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    border-top: 4px solid var(--primary-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.card-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--primary-color);
    border-radius: 99px;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table th,
.table td {
    padding: var(--table-padding, clamp(12px, 2vh, 20px) 24px);
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table th {
    background-color: #f1f5f9;
    font-weight: 700;
    color: #475569;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--primary-color);
    border-top: 1px solid #e2e8f0;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: #f8fafc;
}

.text-right {
    text-align: right !important;
}

.font-medium {
    font-weight: 500;
}

.font-bold {
    font-weight: 700;
}

/* Badges */
.badge {
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success {
    background-color: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background-color: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background-color: #e0e7ff;
    color: #4338ca;
}

.badge-pending {
    background-color: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
    font-weight: 700;
    padding: 6px 12px;
}

.badge-assigned {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-weight: 700;
    padding: 6px 12px;
}

.badge-completed {
    background-color: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-weight: 700;
    padding: 6px 12px;
}

.badge-cancelled {
    background-color: #f5f3ff;
    color: #7c3aed;
    border: 1px solid #ddd6fe;
    font-weight: 700;
    padding: 6px 12px;
}

.badge-work-done {
    background-color: #eef2ff;
    color: #6366f1;
    border: 1px solid #c7d2fe;
    font-weight: 700;
    padding: 6px 12px;
}

.badge-not-completed {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    font-weight: 700;
    padding: 6px 12px;
}

.price-tag {
    background: #f0fdf4;
    color: #166534;
    padding: 4px 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    border: 1px solid #bbf7d0;
    display: inline-block;
}

.description-muted {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    max-width: 300px;
}

.client-chip {
    background: #eef2ff;
    color: #4338ca;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #c7d2fe;
    display: inline-block;
}

.car-chip {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #e2e8f0;
    display: inline-block;
}

.worker-chip {
    background: #ecfdf5;
    color: #065f46;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    border: 1px solid #a7f3d0;
    display: inline-block;
}

/* Task Management UI */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 32px;
    align-items: stretch;
}

.task-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    margin-bottom: 0 !important;
    padding: 0 !important;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.task-card .card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.task-card .card-footer {
    padding: 20px 24px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    margin-top: auto;
}

/* Dashboard Layout */
.dashboard-layout {
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    padding: 24px;
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
    overflow: hidden;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    margin-right: -10px;
    padding-right: 10px;
}

/* Custom scrollbar for sidebar nav */
.sidebar nav::-webkit-scrollbar {
    width: 4px;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    margin: -24px -24px 20px -24px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 24px;
    line-height: 1.2;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
    border-bottom: 2px solid #eef2ff;
}

.sidebar-brand-icon {
    background: var(--primary-color);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.sidebar-brand i {
    font-size: 1.2rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--text-muted);
    border-radius: 12px;
    margin-bottom: 4px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
    background: linear-gradient(90deg, #f5f3ff, white);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.02);
}

.sidebar-footer {
    padding-top: 15px;
    margin-top: auto;
    border-top: 1px solid #f1f5f9;
}

.logout-link {
    color: var(--danger) !important;
    background: transparent !important;
    font-weight: 600;
}

.logout-link:hover {
    background: #fef2f2 !important;
    color: #dc2626 !important;
}

.nav-link i {
    margin-right: 16px;
    width: 24px;
    font-size: 1.1rem;
    text-align: center;
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: clamp(24px, 4vw, 40px);
    transition: var(--transition);
    min-height: 100vh;
    width: auto;
    overflow-x: hidden;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    background: white;
    padding: 12px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border-top: 4px solid var(--primary-color);
    gap: 15px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar h1 {
    font-size: clamp(1.1rem, 4vw, 1.5rem);
    font-weight: 700;
    color: var(--text-main);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.user-details {
    text-align: right;
    line-height: 1.2;
}

.user-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Welcome Banner Extra Responsiveness */
@media (max-width: 768px) {
    .welcome-banner {
        padding: 30px 20px !important;
        text-align: center;
    }

    .welcome-banner div:first-child {
        margin: 0 auto;
    }

    .welcome-icon {
        display: none;
    }
}

/* Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: 32px;
}

@media (min-width: 1400px) {
    .dashboard-grid {
        display: grid;
        grid-template-columns: 1fr 400px;
    }
}

.chart-container {
    height: 320px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: clamp(48px, 6vw, 60px);
    height: clamp(48px, 6vw, 60px);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.1rem, 1.5vw, 1.5rem);
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-info p {
    font-size: clamp(1.2rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--text-main);
}

/* Login Page Only */
.login-page {
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: white;
    padding: 48px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    padding: 0;
    border-radius: 24px;
    width: 90%;
    max-width: 440px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.modal-header {
    padding: 20px 32px;
    background: linear-gradient(to right, #f8fafc, #ffffff);
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header h3::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 99px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 12px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.close {
    color: #94a3b8;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: var(--text-main);
}

.modal-body {
    padding: 32px;
    color: var(--text-muted);
    font-size: 1.1rem;
    text-align: center;
}

.modal-footer {
    padding: 20px 32px;
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Responsive Mobile Overlays & Sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Breakpoints */
@media (max-width: 1200px) {
    .dashboard-grid {
        gap: 20px;
    }
}

@media (max-width: 1024px) {
    :root {
        --sidebar-width: 260px;
    }

    .main-content {
        padding: 24px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: #f1f5f9;
        border-radius: 10px;
        cursor: pointer;
        transition: var(--transition);
    }

    .menu-toggle:hover {
        background: #e2e8f0;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 12px 16px;
        gap: 10px;
    }

    .user-info {
        gap: 8px;
    }

    .user-role {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
        gap: 16px;
    }

    .stat-card {
        padding: 20px;
        gap: 16px;
    }

    .card {
        padding: 16px;
    }

    /* Responsive Tables */
    .table-responsive {
        border: none;
        box-shadow: none;
    }

    .table thead {
        display: none;
        /* Hide header on mobile for stacking if needed, but here we'll use horizontal scroll */
    }

    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table th,
    .table td {
        padding: 16px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .top-bar {
        gap: 12px;
    }

    .top-bar h1 {
        font-size: 1rem;
    }

    .main-content {
        padding: 16px;
    }

    .stat-card {
        padding: 16px;
        gap: 12px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        font-size: 1.25rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    /* Responsive Utilities */
    .mobile-hide {
        display: none !important;
    }

    .mobile-show {
        display: block !important;
    }

    .data-card {
        background: white;
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 16px;
        box-shadow: var(--box-shadow);
        border: 1px solid #f1f5f9;
        display: flex;
        flex-direction: column;
        gap: 12px;
        transition: all 0.3s ease;
    }

    .data-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    }

    .data-card-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 12px 0;
        border-bottom: 1px dashed #f1f5f9;
        gap: 20px;
    }

    .data-card-row:last-child {
        border-bottom: none;
    }

    .data-card-label {
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        min-width: 70px;
        flex-shrink: 0;
    }

    .data-card-value {
        font-weight: 500;
        color: var(--text-main);
        text-align: right;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

.mobile-show {
    display: none;
}

.menu-toggle {
    display: none;
}

/* Star Rating System */
.star-rating {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 8px;
}

.star-rating input {
    display: none;
}

.star-rating label {
    font-size: 2.5rem;
    color: #e2e8f0;
    cursor: pointer;
    transition: var(--transition);
}

.star-rating label:hover,
.star-rating label:hover~label,
.star-rating input:checked~label {
    color: #f59e0b;
}

.star-rating label:active {
    transform: scale(0.9);
}

/* Static Stars (for display) */
.stars-display {
    color: #f59e0b;
    font-size: 1rem;
    display: flex;
    gap: 2px;
}

.stars-display .star-muted {
    color: #e2e8f0;
}

/* Review Card UI */
.review-box {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    border-left: 4px solid var(--primary-color);
    margin: 15px 0;
    text-align: left;
}

.review-text {
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.5;
    margin-top: 10px;
    font-style: italic;
    font-weight: 500;
}

.review-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 12px;
    display: block;
}

/* Modal Specific Adjustments */
#reviewModal .modal-body {
    padding: 30px;
}

#reviewModal .form-label {
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-main);
}