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

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --accent: #f39c12;
    /* Safety Orange */
    --accent-hover: #e67e22;
    --bg-dark: #0f172a;
    --bg-surface: #1e293b;
    --text-main: #ffffff;
    --text-muted: #f8fafc;
    /* Highest visibility for secondary text */
    --success: #10b981;
    --danger: #ef4444;
    --glass: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

h1,
h2,
h3,
.brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Glassmorphism Classes */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    box-shadow: var(--shadow);
}

/* Custom Buttons */
.btn-premium {
    background: var(--accent);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-premium:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.4);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 0.75rem;
    padding: 0.75rem 1.5rem;
    transition: var(--transition);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
}

/* Navigation */
.sidebar {
    width: 280px;
    height: 100vh;
    height: 100dvh;
    position: fixed;
    left: 0;
    top: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    padding: 1.75rem 1.25rem;
    z-index: 1050;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    box-sizing: border-box;
}

.main-content {
    margin-left: 280px;
    padding: 2.5rem;
    min-height: 100vh;
    min-height: 100dvh;
    transition: var(--transition);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 1rem;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(243, 156, 18, 0.1);
    color: var(--accent);
}

.nav-link i {
    font-size: 1.25rem;
}

/* Stats Cards */
.stat-card {
    padding: 1.5rem;
    border-radius: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 150px;
    height: 150px;
    background: var(--accent);
    opacity: 0.05;
    border-radius: 50%;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Forms */
.form-control,
.form-select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: white;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
}

.form-control::placeholder {
    color: #cbd5e1 !important;
    opacity: 0.7;
}

.form-control:focus,
.form-select:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent);
    box-shadow: none;
    color: white;
}

select option {
    background-color: var(--bg-surface);
    color: white;
}

/* Table Design */
.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 0.75rem;
}

.premium-table thead th {
    color: #ffffff;
    /* pure white for headers */
    font-weight: 600;
    padding: 1rem;
    border-bottom: none;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.premium-table tbody tr {
    transition: var(--transition);
}

.premium-table tbody td {
    padding: 1.25rem 1rem;
    background: var(--bg-surface);
    color: var(--text-main);
}

.premium-table tbody td span:not(.badge),
.premium-table tbody td div:not(.badge),
.premium-table tbody td .text-muted,
.premium-table tbody td .small {
    color: #ffffff !important;
}

.premium-table tbody td {
    color: #ffffff;
}

.premium-table tbody tr td:first-child {
    border-radius: 1rem 0 0 1rem;
}

.premium-table tbody tr td:last-child {
    border-radius: 0 1rem 1rem 0;
}

.premium-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

/* ==========================================================================
   Mobile & Tablet Navigation System
   ========================================================================== */

/* Sidebar Backdrop Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-open {
    overflow: hidden;
}

/* Mobile Topbar (< 992px) */
.mobile-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    padding-top: env(safe-area-inset-top, 0);
}

.mobile-topbar-inner {
    min-height: 58px;
}

.mobile-menu-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 0.65rem;
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
    background: rgba(243, 156, 18, 0.15);
    border-color: var(--accent);
    color: var(--accent) !important;
}

/* Mobile Bottom Navigation (< 576px) */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 0.4rem 0.5rem;
    padding-bottom: max(0.45rem, env(safe-area-inset-bottom, 0));
    box-shadow: 0 -4px 25px rgba(0, 0, 0, 0.5);
}

.mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 500;
    min-width: 58px;
    padding: 4px 2px;
    border-radius: 0.5rem;
    transition: var(--transition);
}

.mobile-bottom-item i {
    font-size: 1.25rem;
    line-height: 1;
    margin-bottom: 3px;
    transition: transform 0.2s ease;
}

.mobile-bottom-item:hover,
.mobile-bottom-item.active {
    color: var(--accent);
}

.mobile-bottom-item.active i {
    transform: translateY(-2px);
}

.mobile-bottom-fab {
    position: relative;
    top: -12px;
}

.mobile-fab-circle {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #e67e22);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    box-shadow: 0 4px 16px rgba(243, 156, 18, 0.5);
    margin-bottom: 2px;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
}

.mobile-fab-circle:active {
    transform: scale(0.92);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

/* Tablets and Mobile (< 992px) */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 290px;
        max-width: 85vw;
        box-shadow: none;
        padding-top: max(1.25rem, env(safe-area-inset-top, 0));
        padding-bottom: max(1.25rem, env(safe-area-inset-bottom, 0));
    }

    .sidebar.show {
        transform: translateX(0);
        box-shadow: 12px 0 50px rgba(0, 0, 0, 0.85);
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem 1.25rem 4rem 1.25rem;
    }

    .header-section {
        margin-bottom: 1.75rem;
    }

    .header-section .btn-premium {
        margin-top: 0.5rem;
    }

    /* Modal adjustments on tablets/mobile */
    .modal-dialog {
        margin: 0.75rem auto;
        max-width: calc(100vw - 1.5rem);
    }
}

/* Cellphones (< 576px) */
@media (max-width: 575.98px) {
    .main-content {
        padding: 1rem 0.85rem 6.5rem 0.85rem;
    }

    .glass-panel {
        padding: 1.15rem !important;
        border-radius: 1.15rem;
    }

    /* Scaled typography for small mobile screens */
    h1, .display-5 {
        font-size: 1.65rem !important;
    }

    .display-6 {
        font-size: 1.45rem !important;
    }

    h2 {
        font-size: 1.35rem;
    }

    h4 {
        font-size: 1.15rem;
    }

    /* Stat cards on mobile: 2 per row or full width */
    .stat-card {
        padding: 1rem;
        border-radius: 1.15rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }

    /* Full width buttons in page headers on phones */
    .header-section .btn-premium,
    .header-section .btn-outline {
        display: flex;
        justify-content: center;
        width: 100%;
        margin-top: 0.75rem;
        padding: 0.7rem 1rem;
    }

    /* Table responsive touch experience */
    .table-responsive {
        border-radius: 0.75rem;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.25rem;
        padding-bottom: 0.5rem;
    }

    .premium-table thead th {
        font-size: 0.7rem;
        padding: 0.65rem 0.5rem;
    }

    .premium-table tbody td {
        padding: 0.85rem 0.5rem;
        font-size: 0.82rem;
    }

    /* Action buttons in tables: horizontal row with touch spacing */
    .premium-table td .d-flex {
        flex-wrap: nowrap !important;
        gap: 0.35rem !important;
    }

    .premium-table td .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.78rem;
    }

    /* Modals on phones */
    .modal-dialog {
        margin: 0.5rem auto;
        max-width: calc(100vw - 1rem);
    }

    .modal-content.glass-panel {
        padding: 1rem !important;
    }
}

.text-muted {
    color: #e2e8f0 !important;
    opacity: 1 !important;
}

.text-center {
    color: #ffffff;
}