/* ============================================
   THEME VARIABLES - Light & Dark Mode Support
   ============================================ */

:root {
    /* Brand Colors */
    --brand-primary: #1a4d64;
    --brand-secondary: #026fa1;
    --brand-accent: #cc192b;
    --brand-accent-hover: #a91423;

    /* Light Mode (Default) */
    --bg-primary: #f6f7fb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --text-primary: #111111;
    --text-secondary: #6c757d;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --shadow-lg: rgba(0, 0, 0, 0.15);

    /* Header/Footer */
    --header-bg: #ffffff;
    --header-text: #111111;
    --footer-bg: #1a4d64;
    --footer-text: #ffffff;
    --top-bar-bg: #1a4d64;

    /* Sidebar */
    --sidebar-bg: #ffffff;
    --sidebar-text: #111111;
    --sidebar-hover: #cc192b;
    --sidebar-hover-text: #ffffff;
    --sidebar-active-bg: #ffeded;
    --sidebar-active-text: #1a4d64;

    /* Cards & Components */
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --input-bg: #ffffff;
    --input-border: #d1d5db;
    --input-focus-border: #026fa1;

    /* Sizing */
    --header-height: 60px;
    --footer-height: 48px;
    --sidebar-width: 280px;
    --border-radius: 10px;
    --border-radius-sm: 6px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.35s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.4);

    --header-bg: #1e293b;
    --header-text: #f1f5f9;
    --footer-bg: #0f172a;
    --top-bar-bg: #0f172a;

    --sidebar-bg: #1e293b;
    --sidebar-text: #f1f5f9;
    --sidebar-active-bg: #334155;
    --sidebar-active-text: #f1f5f9;

    --card-bg: #1e293b;
    --card-border: #334155;
    --input-bg: #334155;
    --input-border: #475569;
    --input-focus-border: #3b82f6;
}

/* ============================================
   BASE STYLES
   ============================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

body {
    font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* ============================================
   TOP BAR
   ============================================ */

.top-bar {
    height: 35px;
    background-color: var(--top-bar-bg);
    transition: background-color var(--transition-normal);
    position: relative;
}

.top-bar-inner {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    z-index: 101;
}

.top-bar-logo {
    height: 94px;
    z-index: 101;
    position: relative;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* ============================================
   HEADER
   ============================================ */

.header {
    height: var(--header-height);
    background-color: var(--header-bg);
    color: var(--header-text);
    box-shadow: 0 2px 8px var(--shadow-color);
    padding: 0 16px 0 0;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

.burger-container {
    background-color: var(--brand-accent);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.burger-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    padding: 8px;
    transition: transform var(--transition-fast);
}

.burger-btn:hover {
    transform: scale(1.1);
}

.header-brand {
    margin-left: 4px;
}

.header-logo {
    height: 40px;
    margin-right: 12px;
}

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

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.theme-toggle-btn:hover {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    transform: scale(1.05);
}

.theme-toggle-btn:hover .theme-icon-light,
.theme-toggle-btn:hover .theme-icon-dark {
    color: #ffffff;
}

.theme-icon-light,
.theme-icon-dark {
    position: absolute;
    font-size: 1.1rem;
    transition: all var(--transition-normal);
}

.theme-icon-light {
    color: #f59e0b;
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.theme-icon-dark {
    color: #6366f1;
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

[data-theme="dark"] .theme-icon-light {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

[data-theme="dark"] .theme-icon-dark {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ============================================
   PROFILE DROPDOWN
   ============================================ */

.profile-dropdown .dropdown-toggle {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    transition: background-color var(--transition-fast);
}

.profile-dropdown .dropdown-toggle:hover {
    background-color: var(--bg-tertiary);
}

.profile-dropdown .dropdown-toggle::after {
    display: none;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
}

.avatar-sm img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px var(--shadow-lg);
    border-radius: var(--border-radius-sm);
    padding: 8px;
}

.dropdown-item {
    color: var(--text-primary);
    border-radius: var(--border-radius-sm);
    padding: 10px 16px;
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.dropdown-item.text-danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

[data-theme="dark"] .dropdown-item.text-danger:hover {
    background-color: rgba(220, 38, 38, 0.1);
}

.dropdown-divider {
    border-color: var(--border-color);
}

/* ============================================
   SIDEBAR / OFFCANVAS
   ============================================ */

.sidebar-offcanvas {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color var(--transition-normal);
}

.sidebar-offcanvas.offcanvas-start {
    transform: translateX(-100%);
}

.sidebar-offcanvas.show {
    transform: translateX(0);
}

.sidebar-offcanvas.show .nav-group {
    animation: slideInLeft 0.3s ease forwards;
    opacity: 0;
}

.sidebar-offcanvas.show .nav-group:nth-child(1) {
    animation-delay: 0.05s;
}

.sidebar-offcanvas.show .nav-group:nth-child(2) {
    animation-delay: 0.08s;
}

.sidebar-offcanvas.show .nav-group:nth-child(3) {
    animation-delay: 0.11s;
}

.sidebar-offcanvas.show .nav-group:nth-child(4) {
    animation-delay: 0.14s;
}

.sidebar-offcanvas.show .nav-group:nth-child(5) {
    animation-delay: 0.17s;
}

.sidebar-offcanvas.show .nav-group:nth-child(6) {
    animation-delay: 0.20s;
}

.sidebar-offcanvas.show .nav-group:nth-child(7) {
    animation-delay: 0.23s;
}

.sidebar-offcanvas.show .nav-group:nth-child(8) {
    animation-delay: 0.26s;
}

.sidebar-offcanvas.show .nav-group:nth-child(9) {
    animation-delay: 0.29s;
}

.sidebar-offcanvas.show .nav-group:nth-child(10) {
    animation-delay: 0.32s;
}

.sidebar-offcanvas.show .nav-group:nth-child(11) {
    animation-delay: 0.35s;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

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

.sidebar-offcanvas.show .sidebar-profile {
    animation: fadeInDown 0.35s ease forwards;
    opacity: 0;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

.sidebar-offcanvas .offcanvas-header {
    background-color: var(--sidebar-bg);
    justify-content: flex-end;
    padding: 12px 16px;
    border-bottom: none;
}

.btn-close-sidebar {
    background: transparent;
    border: none;
    font-size: 1.8rem;
    color: var(--brand-accent);
    opacity: 0.7;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-close-sidebar:hover {
    opacity: 1;
    color: var(--brand-accent);
}

.sidebar-profile {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    overflow: hidden;
}

.profile-name {
    font-weight: 700;
    font-size: 1rem;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.profile-email {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-divider {
    margin: 0 16px;
    border-color: var(--border-color);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 8px 12px 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.nav-group {
    margin-bottom: 4px;
}

.nav-link-single,
.nav-group-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--sidebar-text);
    font-weight: 500;
    font-size: 0.9rem;
    border-radius: var(--border-radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.nav-link-single:hover,
.nav-group-toggle:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.nav-icon {
    width: 22px;
    display: inline-flex;
    justify-content: center;
    flex-shrink: 0;
}

.nav-caret {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform var(--transition-normal);
}

.nav-group.open .nav-caret {
    transform: rotate(180deg);
}

.nav-sublist {
    list-style: none;
    margin: 0;
    padding: 0 0 0 38px;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.nav-group.open .nav-sublist {
    max-height: 500px;
}

.nav-sublist li a {
    display: block;
    padding: 10px 14px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.nav-sublist li a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-hover-text);
}

.nav-sublist li a.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 700;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */

.wrapper {
    display: flex;
    min-height: calc(100vh - var(--header-height) - var(--footer-height) - 35px);
}

.content {
    flex: 1;
    padding: 24px;
    min-width: 0;
}

/* ============================================
   CARDS & COMPONENTS
   ============================================ */

.card,
.cardish {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 16px var(--shadow-color);
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.cardish {
    padding: 20px;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
    height: var(--footer-height);
    background-color: var(--footer-bg);
    color: var(--footer-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background-color var(--transition-normal);
}

/* ============================================
   BACKDROP
   ============================================ */

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
    z-index: 1000;
}

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

/* ============================================
   MODAL STYLES
   ============================================ */

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.modal-header,
.modal-footer {
    border-color: var(--border-color);
}

.logout-icon {
    width: 80px;
    height: 80px;
    background: #fef2f2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto 0;
}

[data-theme="dark"] .logout-icon {
    background: rgba(220, 38, 38, 0.1);
}

/* ============================================
   FORM ELEMENTS
   ============================================ */

.form-control {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.form-control:focus {
    background-color: var(--input-bg);
    border-color: var(--input-focus-border);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(2, 111, 161, 0.15);
}

.form-floating>label {
    color: var(--text-secondary);
}

/* ============================================
   BUTTONS
   ============================================ */

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

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

.btn-light {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover {
    background-color: var(--border-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

@media (max-width: 768px) {
    .header-title {
        font-size: 0.85rem;
    }

    .content {
        padding: 16px;
    }

    .top-bar-logo {
        height: 70px;
        margin-top: 18px;
    }
}

@media (max-width: 576px) {
    .theme-toggle-btn {
        width: 38px;
        height: 38px;
    }

    .header-actions {
        gap: 8px !important;
    }
}

/* ============================================
   TABLE DARK MODE FIXES
   ============================================ */

.table {
    --bs-table-bg: var(--card-bg);
    --bs-table-color: var(--text-primary);
    --bs-table-border-color: var(--border-color);
    --bs-table-striped-bg: var(--bg-tertiary);
    --bs-table-striped-color: var(--text-primary);
    --bs-table-hover-bg: var(--bg-tertiary);
    --bs-table-hover-color: var(--text-primary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table>thead {
    border-color: var(--border-color);
}

.table>thead>tr>th {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
    font-weight: 600;
}

.table>tbody>tr>td {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.table>tbody>tr>td.text-muted {
    color: var(--text-secondary) !important;
}

.table>tbody>tr:hover>td {
    background-color: var(--bg-tertiary);
}

.table-responsive {
    background-color: var(--card-bg);
    border-radius: var(--border-radius-sm);
}

/* Fix Bootstrap text-muted in dark mode */
.text-muted {
    color: var(--text-secondary) !important;
}

/* ============================================
   NOTIFICATION BELL STYLES
   ============================================ */

.notification-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background-color: var(--brand-secondary);
    border-color: var(--brand-secondary);
    color: #ffffff;
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    background-color: var(--brand-accent);
    color: #ffffff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.notification-dropdown {
    width: 380px;
    max-height: 500px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px var(--shadow-lg);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.notification-dropdown.show {
    display: flex !important;
    flex-direction: column;
}

.notification-header {
    background-color: var(--bg-tertiary);
}

.notification-header h6 {
    color: var(--text-primary);
}

.notification-list {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.notification-item:hover {
    background-color: var(--bg-tertiary);
}

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

.notification-item .notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.notification-item .notif-icon.info {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.notification-item .notif-icon.success {
    background-color: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.notification-item .notif-icon.warning {
    background-color: rgba(234, 179, 8, 0.15);
    color: #eab308;
}

.notification-item .notif-icon.error {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.notification-item .notif-content {
    flex: 1;
    min-width: 0;
}

.notification-item .notif-message {
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 2px;
    line-height: 1.4;
}

.notification-item .notif-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-empty {
    color: var(--text-muted);
}