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

:root {
    --bg-primary: #0b0f19;
    --bg-secondary: rgba(17, 24, 39, 0.7);
    --bg-surface: rgba(30, 41, 59, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #06b6d4; /* Neon Teal */
    --accent-glow: rgba(6, 182, 212, 0.15);
    --success-color: #10b981; /* Emerald */
    --error-color: #f43f5e; /* Rose */
    --warning-color: #fb923c; /* Orange */
    --sidebar-width: 260px;
    --glass-blur: blur(12px);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body.light-theme {
    --bg-primary: #f8fafc;
    --bg-secondary: rgba(255, 255, 255, 0.75);
    --bg-surface: rgba(241, 245, 249, 0.95);
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #0d9488; /* Emerald Teal */
    --accent-glow: rgba(13, 148, 136, 0.15);
    --card-shadow: 0 10px 30px -10px rgba(148, 163, 184, 0.25);
}

body.light-theme .sidebar-brand {
    background: linear-gradient(to right, #0f172a, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.light-theme .form-control {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.15);
}

body.light-theme .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.2);
}

body.light-theme select.form-control option {
    background: #ffffff;
    color: #0f172a;
}

body.light-theme .modal-content {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-theme .dataTables_wrapper .dataTables_filter input,
body.light-theme .dataTables_wrapper .dataTables_length select {
    background: #ffffff;
    color: #0f172a !important;
    border: 1px solid rgba(15, 23, 42, 0.15) !important;
}

body.light-theme .dataTables_wrapper .dataTables_paginate .paginate_button {
    background: #ffffff !important;
    color: var(--text-secondary) !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent-color) !important;
    color: #ffffff !important;
    border-color: var(--accent-color) !important;
}

body.light-theme table.dataTable thead th {
    background: #e2e8f0 !important;
    color: #0f172a !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
}

body.light-theme table.dataTable tbody tr:hover {
    background: rgba(15, 23, 42, 0.02) !important;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.08) 0px, transparent 50%);
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

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

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(6, 182, 212, 0.2); }
    50% { box-shadow: 0 0 25px rgba(6, 182, 212, 0.4); }
}

.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Layout Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(to right, #ffffff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 0.75rem;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-item {
    margin-bottom: 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-link i {
    width: 20px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.sidebar-link:hover, .sidebar-item.active .sidebar-link {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-left: 3px solid var(--accent-color);
    padding-left: calc(1rem - 3px);
}

/* Main Content area */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem;
    min-width: 0; /* Prevents flex items from overflowing */
}

/* Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}

.user-profile i {
    margin-right: 8px;
    color: var(--accent-color);
}

/* Glass Cards & Panels */
.glass-card {
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
}

/* Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Stats Card */
.stat-card {
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(6, 182, 212, 0.4);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-right: 1rem;
    border: 1px solid var(--border-color);
}

.stat-icon.success { color: var(--success-color); }
.stat-icon.warning { color: var(--warning-color); }
.stat-icon.error { color: var(--error-color); }

.stat-details h3 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.stat-details p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background: var(--accent-color);
    color: #0b0f19;
}
body.light-theme .btn-primary {
    color: #ffffff;
}
.btn-primary:hover {
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: var(--error-color);
    color: #fff;
}
.btn-danger:hover {
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

table.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    margin-bottom: 1rem !important;
    background: transparent !important;
}

table.dataTable thead th {
    background: rgba(15, 23, 42, 0.8) !important;
    color: var(--text-primary) !important;
    font-weight: 600 !important;
    padding: 1rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    text-align: left;
}

table.dataTable tbody td {
    padding: 1rem !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: transparent !important;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

table.dataTable tbody tr:hover {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Actions Icons */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 5px;
    transition: all 0.2s ease;
}

.action-btn:hover {
    color: var(--text-primary);
}

.action-btn.view:hover {
    background: rgba(6, 182, 212, 0.15);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.action-btn.edit:hover {
    background: rgba(251, 146, 60, 0.15);
    color: var(--warning-color);
    border-color: var(--warning-color);
}

.action-btn.delete:hover {
    background: rgba(244, 63, 94, 0.15);
    color: var(--error-color);
    border-color: var(--error-color);
}

/* Alert Notification Banners */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid transparent;
    font-size: 0.875rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--success-color);
}

.alert-danger {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
    color: var(--error-color);
}

.close-btn {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
}

/* Modal Styling */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

/* Login Page Custom styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem 2rem;
    text-align: center;
}

.login-logo {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #fff, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.875rem;
}

/* DataTables Overrides for Dark Mode */
.dataTables_wrapper .dataTables_length, 
.dataTables_wrapper .dataTables_filter, 
.dataTables_wrapper .dataTables_info, 
.dataTables_wrapper .dataTables_processing, 
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary) !important;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color) !important;
    border-radius: 0.5rem;
    padding: 0.375rem 0.75rem;
    color: var(--text-primary) !important;
    margin-left: 0.5rem;
}

.dataTables_wrapper .dataTables_length select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color) !important;
    border-radius: 0.375rem;
    padding: 0.25rem 0.5rem;
    color: var(--text-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    border-radius: 0.375rem !important;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--accent-color) !important;
    color: #0b0f19 !important;
    border-color: var(--accent-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--accent-color) !important;
    color: #0b0f19 !important;
    border-color: var(--accent-color) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: default;
}

/* Revenue view printable design */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .sidebar, .top-header, .btn, .dataTables_filter, .dataTables_length, .dataTables_paginate {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .glass-card {
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    table.dataTable tbody td, table.dataTable thead th {
        color: black !important;
        border-bottom: 1px solid #ccc !important;
    }
}

/* Login page green primary button */
.login-card .btn-primary {
    background: #007a33 !important;
    color: #ffffff !important;
    border-color: #007a33 !important;
}
.login-card .btn-primary:hover {
    background: #006428 !important;
    border-color: #006428 !important;
    box-shadow: 0 4px 12px rgba(0, 122, 51, 0.3) !important;
}

/* Responsive Grid Classes */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Sidebar Hamburger menu & Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
}
.sidebar-overlay.active {
    display: block;
}

.menu-toggle {
    display: none;
}

/* Responsive Media Queries */
@media (max-width: 992px) {
    .sidebar {
        left: calc(-1 * var(--sidebar-width));
        transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
    }
    .sidebar.active {
        left: 0;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.3);
    }
    .main-content {
        margin-left: 0 !important;
        padding: 1.5rem 1rem;
    }
    .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: var(--bg-surface);
        border: 1px solid var(--border-color);
        color: var(--text-primary);
        font-size: 1.1rem;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .menu-toggle:hover {
        background: var(--accent-glow);
        color: var(--accent-color);
    }
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    .top-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    .mobile-nav {
        display: flex !important;
    }
    .staff-portal .main-content {
        margin-left: 0 !important;
        padding-bottom: 80px;
    }
}

/* Mobile bottom navigation bar for staff */
.staff-portal .main-content {
    padding-top: 1.5rem;
}

.mobile-nav {
    display: none; /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--bg-secondary);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border-color);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding: 0 0.5rem;
}

.mobile-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex: 1;
    height: 100%;
    position: relative;
}

.mobile-nav .nav-item i {
    font-size: 1.2rem;
    margin-bottom: 3px;
    transition: transform 0.2s ease;
}

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

.mobile-nav .nav-item.active i {
    transform: translateY(-2px);
    color: var(--accent-color);
}

/* Floating Action Button (FAB) */
.mobile-nav .nav-item.fab {
    position: relative;
    overflow: visible;
}

.mobile-nav .fab-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 4px 15px var(--accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -24px;
    color: #ffffff !important;
    font-size: 1.4rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid var(--bg-primary);
}

.mobile-nav .nav-item.fab.active .fab-circle, .mobile-nav .nav-item.fab:hover .fab-circle {
    background: var(--success-color);
    transform: translateY(-4px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.mobile-nav .nav-item.fab .fab-circle i {
    color: #ffffff !important;
}

/* SweetAlert customization for theme */
.swal2-popup {
    background: var(--bg-secondary) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 1rem !important;
    color: var(--text-primary) !important;
}

.swal2-title {
    color: var(--text-primary) !important;
}

.swal2-html-container {
    color: var(--text-secondary) !important;
}

/* Badge style for pending rejected policies in sidebar */
.badge-rejected {
    background-color: var(--error-color, #f43f5e);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: auto; /* Push to the right in sidebar-link */
    box-shadow: 0 2px 5px rgba(244, 63, 94, 0.4);
}

/* Badge style for mobile bottom nav bar */
.mobile-nav .badge-rejected-mobile {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    background-color: var(--error-color, #f43f5e);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 2px 4px rgba(244, 63, 94, 0.4);
    border: 1.5px solid var(--bg-secondary);
    z-index: 2;
}
