@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --primary-50: #ecfdf5;
    --accent: #6366f1;
    --accent-light: #e0e7ff;
    --bg-main: #f0f2f5;
    --bg-sidebar: #111827;
    --bg-sidebar-hover: #1f2937;
    --bg-card: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), #34d399);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.3px;
}

.sidebar-brand-text small {
    display: block;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.sidebar-section-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #6b7280;
    padding: 12px 12px 6px;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #d1d5db;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.sidebar-link:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: capitalize;
}

.sidebar-logout {
    color: #9ca3af;
    text-decoration: none;
    font-size: 1rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.sidebar-logout:hover {
    color: #ef4444;
}

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 24px 32px;
    transition: margin-left 0.3s ease;
}

.mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border);
    z-index: 1040;
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
}

.mobile-topbar .topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1.05rem;
}

.mobile-topbar .topbar-brand i {
    color: var(--primary);
    font-size: 1.3rem;
}

.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 4px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1045;
    backdrop-filter: blur(2px);
}

.page-header {
    margin-bottom: 28px;
}

.page-header h4 {
    font-weight: 800;
    font-size: 1.6rem;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.5px;
}

.page-header p {
    color: var(--text-secondary);
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--bg-card);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 16px 20px;
    font-weight: 600;
}

.card-header h5, .card-header h6 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

.card-body { padding: 20px; }

.card-footer {
    background: #fafafa;
    border-top: 1px solid var(--border);
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card.border-warning::before { background: #f59e0b; }
.stat-card.border-success::before { background: var(--primary); }
.stat-card.border-primary::before { background: #3b82f6; }
.stat-card.border-info::before { background: #06b6d4; }
.stat-card.border-danger::before { background: #ef4444; }

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

.stat-card .card-body {
    padding: 20px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1px;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 4px;
}

.status-badge {
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.status-pending { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-dispatched { background: #dbeafe; color: #1e40af; }
.status-rejected { background: #fee2e2; color: #991b1b; }

.table {
    font-size: 0.875rem;
}

.table thead {
    background: #f9fafb;
}

.table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f3f4f6;
}

.table-hover tbody tr:hover {
    background: var(--primary-50);
}

.table-responsive {
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: none;
}

.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: var(--transition);
    letter-spacing: -0.1px;
}

.btn-success {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-success:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5,150,105,0.3);
}

.btn-outline-success {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-success:hover {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.9rem;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.15);
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-text {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.input-group-text {
    border: 1.5px solid var(--border);
    background: #f9fafb;
}

.badge {
    font-weight: 600;
    font-size: 0.72rem;
    padding: 5px 10px;
    border-radius: 6px;
    letter-spacing: 0.3px;
}

.alert {
    border-radius: var(--radius-md);
    border: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
}

.modal-body { padding: 24px; }

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 16px 24px;
}

.modal-header.bg-success {
    background: linear-gradient(135deg, var(--primary), #34d399) !important;
}

.modal-header.bg-primary {
    background: linear-gradient(135deg, var(--accent), #818cf8) !important;
}

.progress {
    border-radius: 100px;
    height: 8px;
    background: #f3f4f6;
}

.progress-bar { border-radius: 100px; }
.progress-bar.bg-success { background: var(--primary) !important; }

.list-group-item {
    border: none;
    border-bottom: 1px solid #f3f4f6;
    padding: 12px 16px;
    font-size: 0.875rem;
}

.list-group-item:last-child { border-bottom: none; }

.duty-toggle-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.15rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: -0.3px;
}

.duty-on {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 15px rgba(239,68,68,0.3);
}

.duty-off {
    background: linear-gradient(135deg, var(--primary), #34d399);
    color: white;
    box-shadow: 0 4px 15px rgba(5,150,105,0.3);
}

.duty-toggle-btn:hover {
    transform: translateY(-2px);
}

#map {
    height: 500px;
    width: 100%;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.hero-section {
    background: linear-gradient(135deg, #064e3b 0%, #059669 50%, #34d399 100%);
    color: white;
    padding: 120px 0 100px;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.hero-section h1 {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    line-height: 1.1;
}

.hero-section .lead {
    font-size: 1.15rem;
    font-weight: 400;
    opacity: 0.9;
}

.hero-section .btn {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
}

.hero-section .btn-light {
    color: var(--primary-dark);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.hero-section .btn-outline-light {
    border-width: 2px;
}

.hero-section .btn-outline-light:hover {
    background: rgba(255,255,255,0.15);
    border-color: #fff;
    color: #fff;
}

.feature-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    transition: var(--transition);
    height: 100%;
    background: #fff;
}

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

.feature-card h5 {
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.feature-card p {
    font-size: 0.9rem;
    line-height: 1.6;
}

.feature-icon {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 18px;
}

.public-navbar {
    background: transparent !important;
    padding: 16px 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.public-navbar .navbar-brand {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
}

.public-navbar .nav-link {
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px !important;
}

.public-navbar .navbar-collapse {
    background: rgba(6, 78, 59, 0.95);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 12px;
}

@media (min-width: 992px) {
    .public-navbar .navbar-collapse {
        background: transparent;
        backdrop-filter: none;
        padding: 0;
        margin-top: 0;
        border-radius: 0;
    }
}

.public-navbar .navbar-collapse .nav-link.btn {
    display: inline-block;
    width: auto;
    text-align: center;
    margin-top: 8px;
}

@media (min-width: 992px) {
    .public-navbar .navbar-collapse .nav-link.btn {
        margin-top: 0;
    }
}

.login-container {
    max-width: 420px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, #064e3b, #059669);
    color: white;
    padding: 36px 32px;
    text-align: center;
}

.login-header h3 {
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.5px;
}

.login-header p {
    font-size: 0.9rem;
    opacity: 0.85;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    display: block;
}

.public-section {
    padding: 80px 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    text-align: center;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: center;
    margin-bottom: 48px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px 20px;
    text-align: center;
    transition: var(--transition);
    background: #fff;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.product-card .product-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--primary-50);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0 auto 16px;
}

.product-card h5 {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.2px;
}

.dealer-form-section {
    background: linear-gradient(135deg, var(--primary-50), #f0fdf4);
}

.dealer-form-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.dealer-form-header {
    background: linear-gradient(135deg, #064e3b, #059669);
    color: #fff;
    padding: 28px 32px;
    text-align: center;
}

.dealer-form-header h3 {
    font-weight: 800;
    letter-spacing: -0.5px;
}

.public-footer {
    background: #111827;
    color: #9ca3af;
    padding: 40px 0;
}

.public-footer .footer-brand {
    color: #fff;
    font-weight: 800;
    font-size: 1.2rem;
}

.btn-group .btn {
    border-radius: 8px !important;
    margin: 0 2px;
    font-size: 0.82rem;
}

.card-header.bg-success {
    background: linear-gradient(135deg, var(--primary), #34d399) !important;
    border: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.main-content > * {
    animation: fadeIn 0.4s ease both;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

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

    .mobile-topbar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: calc(var(--topbar-height) + 16px);
    }

    .page-header h4 {
        font-size: 1.3rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .stat-card .stat-label {
        font-size: 0.65rem;
    }

    #map {
        height: 320px;
    }

    .hero-section {
        padding: 100px 0 60px;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        font-size: 0.68rem;
        padding: 10px 8px;
    }

    .table tbody td {
        padding: 10px 8px;
    }

    .btn-sm { font-size: 0.75rem; padding: 4px 8px; }

    .card-body { padding: 16px; }

    .modal-body { padding: 16px; }
}

@media (max-width: 575.98px) {
    .hero-section h1 { font-size: 1.75rem; }
    .hero-section { padding: 90px 0 50px; }
    .hero-section .lead { font-size: 0.95rem; }
    .hero-section .btn { padding: 12px 20px; font-size: 0.9rem; }
    .public-section { padding: 48px 0; }
    .section-title { font-size: 1.5rem; }
    .login-container { padding: 16px; }
    .login-header { padding: 28px 20px; }
    .stat-card .stat-value { font-size: 1.2rem; }

    .table-responsive { font-size: 0.78rem; }
}

.nav-tabs { border: none; gap: 4px; }
.nav-tabs .nav-link {
    border: none;
    background: #f3f4f6;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    padding: 8px 16px;
}
.nav-tabs .nav-link.active {
    background: var(--primary);
    color: #fff;
}

code {
    font-size: 0.82rem;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    color: var(--text-primary);
}

.inventory-card .card-header {
    border: none;
}

.inventory-card .card-header.bg-success {
    padding: 14px 16px;
}

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
}

.dropdown-item {
    border-radius: 6px;
    font-size: 0.875rem;
    padding: 8px 12px;
    font-weight: 500;
}

.dropdown-item:hover {
    background: var(--primary-50);
    color: var(--primary-dark);
}
