/**
 * Traffic Platform Theme
 * Modern Classic Fintech Design
 */

:root {
    --tm-blue: #0f172a;
    --tm-blue-dark: #020617;
    --tm-accent: #f59e0b;
    --tm-bg: #f8fafc;
    --tm-card: #ffffff;
    --tm-border: #e2e8f0;
    --tm-text: #0f172a;
    --tm-muted: #64748b;
}

* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--tm-bg);
    color: var(--tm-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* Cards */
.tm-card {
    background: var(--tm-card);
    border-radius: 12px;
    border: 1px solid var(--tm-border);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.tm-card-header {
    border-bottom: 1px solid var(--tm-border);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.tm-card-header h1,
.tm-card-header h2,
.tm-card-header h3,
.tm-card-header h4,
.tm-card-header h5,
.tm-card-header h6 {
    margin: 0;
    color: var(--tm-text);
}

/* Buttons */
.btn-hero {
    background: var(--tm-accent);
    color: #fff;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-hero:hover {
    background: #d97706;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: var(--tm-card);
    color: var(--tm-text);
    border: 1px solid var(--tm-border);
    padding: 0.75rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary:hover {
    background: var(--tm-bg);
    border-color: var(--tm-text);
    color: var(--tm-text);
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
    color: #fff;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card h3 {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: #fff;
}

.stat-card p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
    color: #fff;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../img/hero-workers.jpg') center/cover;
    opacity: 0.1;
    z-index: 0;
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #fff;
}

.hero p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    .hero p {
        font-size: 1rem;
    }
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.navbar-brand {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.5rem;
    text-decoration: none;
}

.navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    margin: 0 0.5rem;
    transition: color 0.2s;
}

.navbar-nav .nav-link:hover {
    color: var(--tm-accent) !important;
}

.navbar-nav .nav-link.active {
    color: var(--tm-accent) !important;
}

/* Sidebar */
.sidebar {
    background: var(--tm-card);
    border-right: 1px solid var(--tm-border);
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    padding: 1.5rem 0;
    position: sticky;
    top: 60px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-sidebar-overlay.active {
    opacity: 1;
}

/* Sidebar Wrapper */
.sidebar-wrapper {
    transition: transform 0.3s ease;
    height: calc(100vh - 60px);
    max-height: calc(100vh - 60px);
    overflow: hidden;
}

.sidebar .nav-link {
    color: var(--tm-text);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    border-radius: 0;
    margin: 0.15rem 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    position: relative;
}

.sidebar .nav-link:hover {
    background: var(--tm-bg);
    border-left-color: var(--tm-accent);
    color: var(--tm-accent);
    transform: translateX(4px);
}

.sidebar .nav-link.active {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border-left-color: var(--tm-accent);
    color: var(--tm-accent);
    font-weight: 700;
    padding-left: calc(1rem - 3px);
}

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

.sidebar .nav-link span {
    flex: 1;
}

/* Sidebar Sections */
.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section:last-of-type {
    margin-bottom: 0;
}

.nav-section-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--tm-muted);
    padding: 0.75rem 1rem 0.5rem;
    margin-bottom: 0.25rem;
}

.nav-section-admin .nav-section-label {
    color: #ef4444;
}

.nav-link-admin {
    border-left: 2px solid rgba(239, 68, 68, 0.3);
}

.nav-link-admin.active {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(239, 68, 68, 0.05));
    border-left-color: #ef4444;
    color: #ef4444;
}

.nav-link-admin i {
    color: #ef4444;
}

.nav-link-logout {
    color: #ef4444;
    margin-top: 0.5rem;
}

.nav-link-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.nav-section-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--tm-border);
}

/* Sidebar Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--tm-border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--tm-muted);
}

/* Mobile Sidebar Overlay */
.mobile-sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-sidebar-overlay.active {
    opacity: 1;
}

/* Sidebar Wrapper */
.sidebar-wrapper {
    transition: transform 0.3s ease;
}

/* Topbar */
.topbar {
    background: var(--tm-card);
    border-bottom: 1px solid var(--tm-border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.topbar h4 {
    margin: 0;
    color: var(--tm-text);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Tables */
.table {
    background: var(--tm-card);
    border-radius: 12px;
    overflow: hidden;
}

.table thead {
    background: var(--tm-bg);
}

.table thead th {
    border-bottom: 2px solid var(--tm-border);
    font-weight: 600;
    color: var(--tm-text);
    padding: 1rem;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid var(--tm-border);
}

.table tbody tr:hover {
    background: var(--tm-bg);
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: var(--tm-accent);
    box-shadow: 0 0 0 0.2rem rgba(245, 158, 11, 0.25);
}

.form-label {
    font-weight: 600;
    color: var(--tm-text);
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

/* Progress Bars */
.progress {
    height: 10px;
    border-radius: 5px;
    background: var(--tm-bg);
}

.progress-bar {
    background: var(--tm-accent);
    border-radius: 5px;
}

.progress-bar {
    background: var(--tm-accent);
    border-radius: 5px;
}

/* Footer */
.footer {
    background: var(--tm-blue-dark);
    color: rgba(255, 255, 255, 0.8);
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer h5 {
    color: #fff;
    margin-bottom: 1rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: var(--tm-accent);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

/* Utilities */
.text-muted {
    color: var(--tm-muted) !important;
}

.text-accent {
    color: var(--tm-accent) !important;
}

.bg-gradient {
    background: linear-gradient(135deg, var(--tm-blue) 0%, var(--tm-blue-dark) 100%);
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        position: fixed;
        left: 0;
        top: 50px;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 280px;
        max-width: 85vw;
        background: var(--tm-card);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
        overflow-y: auto;
    }
    
    .sidebar-wrapper.mobile-open {
        transform: translateX(0);
    }
    
    .sidebar {
        height: 100vh;
        max-height: 100vh;
        border-right: none;
        padding: 1rem 0;
        position: relative;
        top: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .main-content-wrapper {
        margin-left: 0 !important;
        padding: 1rem !important;
    }
    
    .mobile-sidebar-overlay {
        display: block;
    }
    
    .stat-card h3 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .sidebar {
        height: 100vh;
        max-height: 100vh;
        border-right: none;
        padding: 1rem 0;
        overflow-y: auto;
        overflow-x: hidden;
    }
    
    .sidebar .nav-link {
        padding: 0.625rem 0.75rem;
        margin: 0.1rem 0.25rem;
        font-size: 0.85rem;
    }

    .sidebar .nav-link i {
        width: 18px;
        font-size: 1rem;
    }

    .nav-section-label {
        font-size: 0.65rem;
        padding: 0.5rem 0.75rem 0.375rem;
    }
    
    .sidebar .nav-link i {
        margin-right: 0.75rem;
        font-size: 1.1rem;
    }
    
    .stat-card h3 {
        font-size: 1.75rem;
    }
}

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

.toast {
    background: var(--tm-card);
    border: 1px solid var(--tm-border);
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid var(--tm-accent);
}
