@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=Syne:wght@600;700;800&display=swap');

:root {
    --brand-red: #E4004B;
    --brand-orange: #ED775A;
    --brand-gold: #FAD691;
    --brand-gray: #140a6d;
    --brand-purple: #667eea;
    --brand-purple-dark: #764ba2;
    --side-bg: #ffffff;
    --body-bg: #f8f9fc;
    --text-primary: #1a1d2e;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --sidebar-width: 60px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--body-bg);
    color: var(--text-primary);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ========================================
   SIDEBAR - Compact Icon-Only Design (No Expansion)
======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--side-bg);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 0;
    z-index: 1000;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    overflow-x: hidden;
    /* Hide horizontal scrollbar on sidebar */
}

/* Logo Section - Compact */
.logo-details {
    padding: 16px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.logo-details::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
    pointer-events: none;
}

.logo-details i {
    font-size: 28px;
    color: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    position: relative;
    z-index: 1;
}

.logo_name {
    display: none;
}

/* Navigation List */
.nav-list {
    flex: 1;
    padding: 8px 0;
    overflow: visible;
    /* Allow tooltips to overflow */
    list-style: none;
}

.nav-list li {
    margin-bottom: 4px;
    position: relative;
}

.nav-list li a {
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 0;
    margin: 0 8px;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 14px;
    position: relative;
    overflow: visible;
    /* Allow tooltip overflow */
}

.nav-list li a i {
    font-size: 24px;
    transition: all 0.3s ease;
}

.links_name {
    display: none;
}

/* Tooltip for navigation items - Using fixed positioning */
.nav-list li a::after {
    content: attr(data-tooltip);
    position: fixed;
    /* Use fixed to escape sidebar overflow */
    left: calc(var(--sidebar-width) + 18px);
    /* Position after sidebar */
    background: var(--text-primary);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    transform: translateX(-10px);
}

.nav-list li a::before {
    content: '';
    position: fixed;
    /* Use fixed to escape sidebar overflow */
    left: calc(var(--sidebar-width) + 12px);
    /* Position arrow after sidebar */
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 6px solid var(--text-primary);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 10001;
}

/* Dynamic positioning will be handled via JavaScript */
.nav-list li:hover a::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nav-list li:hover a::before {
    opacity: 1;
    visibility: visible;
}

.nav-list li a:hover {
    background: linear-gradient(135deg, rgba(228, 0, 75, 0.08), rgba(237, 119, 90, 0.08));
    color: var(--brand-red);
}

.nav-list li a:hover i {
    transform: scale(1.15);
}

.nav-list li a.active {
    background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
    color: white;
    box-shadow: 0 4px 15px rgba(228, 0, 75, 0.25);
}

/* Keep tooltips visible even for active items */
/* Removed: .nav-list li a.active::after, .nav-list li a.active::before { display: none; } */

/* ========================================
   PROFILE SECTION - Fixed at Bottom
======================================== */
.profile-section-bottom {
    padding: 12px;
    border-top: 1px solid var(--border-color);
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-avatar-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.profile-avatar-button:hover {
    transform: scale(1.05);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid var(--border-color);
    text-transform: uppercase;
    box-shadow: var(--shadow-sm);
}

/* Profile Dropdown Menu */
.profile-dropdown {
    position: fixed;
    bottom: 72px;
    left: 72px;
    background: white;
    border-radius: 12px;
    min-width: 280px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.profile-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
}

.profile-avatar-small {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    border: 2px solid white;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-email {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.profile-dropdown-item {
    color: var(--text-primary);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.profile-dropdown-item i {
    font-size: 18px;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.profile-dropdown-item:hover {
    background: var(--body-bg);
    padding-left: 20px;
}

.profile-dropdown-item:hover i {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item i {
    color: var(--brand-red);
}

.profile-dropdown-item.logout-item:hover {
    background: rgba(228, 0, 75, 0.05);
}

/* ========================================
   MAIN CONTENT AREA
======================================== */
.home-section {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--body-bg);
}

/* Header */
header#header-section {
    background: white;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

#sidebarBtn {
    font-size: 28px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
}

#sidebarBtn:hover {
    color: var(--brand-red);
    transform: scale(1.1);
}

#page-title {
    font-family: 'Syne', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* Main Container */
#main-container {
    padding: 32px;
    margin: 24px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Stat Cards */
.stat-card {
    background: white;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

.card-icon.blue {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.card-icon.green {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.card-info {
    flex: 1;
}

.card-info p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-info h3 {
    font-family: 'Syne', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -1px;
}

/* Chart Container */
.chart-container-wrapper {
    background: white;
    padding: 28px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    height: 380px;
    border: 1px solid var(--border-color);
}

/* ========================================
   PROFILE PAGE STYLING
======================================== */
.profile-section {
    max-width: 700px;
    margin: 0 auto;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-purple), var(--brand-purple-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 48px;
    border: 4px solid var(--border-color);
    margin: 0 auto 20px;
    text-transform: uppercase;
    box-shadow: var(--shadow-md);
}

.profile-header h2 {
    font-family: 'Syne', sans-serif;
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-form {
    background: white;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--brand-purple);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input:disabled {
    background: #f5f5f5;
    color: var(--text-secondary);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--body-bg);
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Password Page */
.password-section {
    max-width: 600px;
    margin: 0 auto;
}

.password-form {
    background: white;
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.password-requirements {
    background: #f0f9ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
}

.password-requirements h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.password-requirements ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.password-requirements li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    padding-left: 24px;
    position: relative;
}

.password-requirements li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

.alert {
    padding: 16px;
    border-radius: 10px;
    margin-bottom: 24px;
    font-size: 14px;
}

.alert-success {
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #059669;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid var(--brand-red);
    color: var(--brand-red);
}

/* ========================================
   TABLE STYLING
======================================== */
.table-container,
.table-responsive {
    width: 100%;
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.styled-table,
.ocr-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    min-width: 600px;
}

.styled-table thead tr,
.ocr-table thead {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.styled-table th,
.ocr-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.styled-table td,
.ocr-table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.styled-table tbody tr:hover,
.ocr-table tbody tr:hover {
    background-color: #fef3f7;
}

.styled-table tbody tr:last-child td,
.ocr-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Pill */
.status-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background-color: var(--brand-gold);
    color: #7d5a12;
    text-align: center;
    white-space: nowrap;
}

/* Plate Number */
.plate-no {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: var(--brand-red);
    background: #fdf2f4;
    padding: 4px 10px;
    border-radius: 6px;
}

/* ========================================
   UPLOAD BOX
======================================== */
.upload-section {
    max-width: 800px;
    margin: 0 auto;
}

.upload-box {
    text-align: center;
    padding: 48px;
    border: 2px dashed var(--brand-orange);
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(237, 119, 90, 0.05), rgba(250, 214, 145, 0.05));
    transition: all 0.3s ease;
}

.upload-box:hover {
    border-color: var(--brand-red);
    background: linear-gradient(135deg, rgba(228, 0, 75, 0.05), rgba(237, 119, 90, 0.05));
    transform: scale(1.01);
}

.btn-main,
.btn-upload {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    margin: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-upload {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

#file-preview {
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ========================================
   PAGINATION
======================================== */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination-controls button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.pagination-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.pagination-controls button:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.pagination-controls span {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

/* ========================================
   RESPONSIVE DESIGN
======================================== */

/* Tablet (768px - 1024px) */
@media (max-width: 1024px) {
    #main-container {
        padding: 24px;
        margin: 20px;
    }

    .chart-container-wrapper {
        height: 320px;
    }
}

/* Mobile (Up to 768px) */
@media (max-width: 768px) {

    /* Show hamburger menu */
    #sidebarBtn {
        display: block;
    }

    /* Hide sidebar off-screen by default */
    .sidebar {
        left: -60px;
        box-shadow: none;
    }

    /* When sidebar is active, slide it in */
    .sidebar.active {
        left: 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Full width content on mobile */
    .home-section {
        margin-left: 0;
        width: 100%;
    }

    /* Add overlay when sidebar is open */
    .sidebar.active::after {
        content: '';
        position: fixed;
        top: 0;
        left: 60px;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: -1;
        animation: fadeIn 0.3s ease;
    }

    /* Adjust profile dropdown position on mobile */
    .profile-dropdown {
        left: 12px;
        right: 12px;
        min-width: auto;
        max-width: calc(100vw - 24px);
    }

    /* Adjust header padding */
    header#header-section {
        padding: 20px;
    }

    #page-title {
        font-size: 20px;
    }

    /* Adjust main container */
    #main-container {
        padding: 20px;
        margin: 16px;
        border-radius: 12px;
    }

    /* Stack dashboard cards */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .chart-container-wrapper {
        height: 280px;
        padding: 20px;
    }

    /* Reduce table padding */
    .styled-table th,
    .styled-table td,
    .ocr-table th,
    .ocr-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    /* Adjust upload box */
    .upload-box {
        padding: 32px 20px;
    }

    /* Adjust buttons */
    .btn-main,
    .btn-upload {
        padding: 12px 24px;
        font-size: 14px;
        margin: 8px;
    }
}

/* Small Mobile (Up to 480px) */
@media (max-width: 480px) {
    #page-title {
        font-size: 18px;
    }

    #main-container {
        margin: 12px;
        padding: 16px;
    }

    .stat-card {
        padding: 18px;
        gap: 14px;
    }

    .card-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .card-info h3 {
        font-size: 24px;
    }

    .chart-container-wrapper {
        padding: 16px;
        height: 250px;
    }
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--body-bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--brand-red), var(--brand-orange));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--brand-orange), var(--brand-red));
}

/* Loader */
.loader-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.loader-container p {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}
