
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
    background: var(--bg-main);
}

.auth-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-md);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================================================
   NAVIGATION
   ============================================================================ */

.navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
    position: relative;
}

.navbar-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-brand img {
    height: 32px;
    width: auto;
}


.navbar-menu {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex: 1;
    justify-content: flex-start;
    margin-left: 1rem;
}

.navbar-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.navbar-link i {
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.navbar-link:hover i,
.navbar-link.active i {
    opacity: 1;
}

.navbar-link:hover {
    color: var(--text-primary);
    background: var(--bg-main);
}

.navbar-link.active {
    color: var(--primary);
    background: rgba(67, 97, 238, 0.1);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.user-info {
    text-align: right;
}

@media (max-width: 1450px) {
    .user-role {
        display: none;
    }
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ============================================================================
   FORMS
   ============================================================================ */

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
    font-size: 0.875rem;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 12px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.1rem;
    user-select: none;
    background: none;
    border: none;
    padding: 0;
}

.password-toggle:hover {
    color: var(--primary);
}

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

.btn {
    padding: 0.625rem 1.25rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-family: inherit;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(67, 97, 238, 0.3);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: #e9ecef;
}

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

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-main);
}

.btn-sm {
    padding: 0.4rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================================================
   CONTAINER & LAYOUT
   ============================================================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    position: relative;
    z-index: 1;
}

/* ============================================================================
   DASHBOARD
   ============================================================================ */

.dashboard-header {
    margin-bottom: 1.5rem;
}

.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.dashboard-header p {
    color: var(--text-secondary);
    margin-top: 0.25rem;
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

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

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

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

.stat-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* ============================================================================
   CARDS
   ============================================================================ */

.card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================================================
   TABLES
   ============================================================================ */

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
}

.table thead {
    background: var(--bg-main);
    border-bottom: 2px solid var(--border-color);
}

.table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table td {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.table tbody tr {
    transition: all 0.15s ease;
}

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

/* ============================================================================
   BADGES
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary);
}

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

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s ease;
    line-height: 1;
}

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

/* ============================================================================
   ALERTS
   ============================================================================ */

.alert {
    padding: 0.875rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid;
    animation: slideDown 0.3s ease-out;
}

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

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

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

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--info);
    color: var(--info);
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* ============================================================================
   LOADING SPINNER
   ============================================================================ */

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================================================
   SEARCH
   ============================================================================ */

.search-container {
    flex: 0 1 350px;
}

.search-container input {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}


/* ============================================================================
   NOTIFICATIONS
   ============================================================================ */

.notification-wrapper {
    position: relative;
}

.notification-bell:hover {
    color: var(--primary);
}

/* Consolidated notification-badge styles moved to notifications section */

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    margin-top: 0.5rem;
    display: none;
    animation: slideDown 0.2s ease-out;
}

.notification-dropdown.show {
    display: block;
}

.notification-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.mark-all-read {
    font-size: 0.75rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
}

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

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
    cursor: pointer;
    position: relative;
}

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

.notification-item.unread {
    background: rgba(67, 97, 238, 0.05);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
}

.notification-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.notification-body {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

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

.empty-notifications {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}


.search-container input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

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

@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .navbar-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .modal {
        width: 95%;
        padding: 1.5rem;
    }

    .container {
        padding: 1rem;
    }
}

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

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

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

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

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

/* ============================================================================ 
   NOTIFICATIONS
   ============================================================================ */

.notification-wrapper {
    position: relative;
    display: inline-flex;
}

.notification-bell {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    transition: transform 0.2s ease;
}

.notification-bell:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--bg-white);
}

.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
    /* Hidden by default */

}

.notification-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease;
}

.notification-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-color);
}

.notification-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0;
}

.mark-all-read {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.75rem;
    cursor: pointer;
}

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

.notification-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}

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

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

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

.notification-item.unread {
    background: rgba(67, 97, 238, 0.08);
    /* Primary color variable tint */
    border-left: 3px solid var(--primary);
}

.notification-item.unread .notification-title {
    color: var(--primary);
}

.notification-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.notification-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.notification-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    text-align: right;
}

.notification-empty {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

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

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

/* ============================================================================
   DARK MODE
   ============================================================================ */

:root[data-theme="dark"] {
    --bg-main: #0f172a;
    --bg-white: #1e293b;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --info: #60a5fa;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] body {
    background-color: var(--bg-main) !important;
    color: var(--text-primary);
    background-image: none !important;
}

:root[data-theme="dark"] .card,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .auth-card,
:root[data-theme="dark"] .navbar {
    background-color: var(--bg-white);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .form-input,
:root[data-theme="dark"] .form-select,
:root[data-theme="dark"] .form-textarea {
    background-color: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .table thead {
    background: #0f172a;
    border-bottom-color: #334155;
}

:root[data-theme="dark"] .table tbody tr:hover {
    background: #1e293b;
    /* lighter than main bg? or darker? */
    background: rgba(255, 255, 255, 0.05);
}

/* ============================================================================
   NAVBAR ICONS & TOOLTIPS
   ============================================================================ */

.nav-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon-btn,
.notification-bell,
#themeToggle.btn-outline {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 50%;
    transition: all 0.2s ease;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.nav-icon-btn:hover,
.notification-bell:hover,
#themeToggle.btn-outline:hover {
    background-color: var(--bg-main);
    color: var(--primary);
}

.nav-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    z-index: 1000;
    min-width: max-content;
}

/* Arrow tip for tooltip */
.nav-tooltip::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 12px;
    border-width: 0 5px 5px;
    border-style: solid;
    border-color: transparent transparent var(--border-color);
}

.nav-icon-wrapper:hover .nav-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ============================================================================
   DARK MODE OVERRIDES
   ============================================================================ */

html.dark body {
    background-color: var(--bg-main);
    color: var(--text-primary);
}

html.dark .navbar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
}

html.dark .card,
html.dark .modal,
html.dark .stat-card,
html.dark .notification-dropdown,
html.dark .nav-tooltip {
    background: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark .navbar-brand,
html.dark .navbar-link:hover,
html.dark .user-name {
    color: var(--text-primary);
}

html.dark .navbar-link {
    color: var(--text-secondary);
}

html.dark .navbar-link.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

html.dark .text-muted,
html.dark .user-role,
html.dark .stat-title,
html.dark .form-label {
    color: var(--text-secondary);
}

html.dark .form-input,
html.dark .form-select,
html.dark .form-textarea {
    background-color: var(--bg-main);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark .form-input:focus,
html.dark .form-select:focus,
html.dark .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

html.dark .table th {
    background-color: var(--bg-main);
    color: var(--text-secondary);
    border-bottom-color: var(--border-color);
}

html.dark .table td {
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}

html.dark .table tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

html.dark .btn-secondary {
    background-color: var(--bg-main);
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark .btn-secondary:hover {
    background-color: var(--border-color);
}

html.dark .btn-outline {
    border-color: var(--border-color);
    color: var(--text-primary);
}

html.dark .btn-outline:hover {
    background-color: var(--bg-main);
    border-color: var(--text-secondary);
}

html.dark .notification-item {
    border-bottom-color: var(--border-color);
}

html.dark .notification-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

html.dark .notification-item.unread {
    background-color: rgba(59, 130, 246, 0.1);
}

html.dark .ql-toolbar {
    background-color: var(--bg-white) !important;
    border-color: var(--border-color) !important;
}

html.dark .ql-container {
    background-color: var(--bg-main) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

html.dark .ql-stroke {
    stroke: var(--text-secondary) !important;
}

html.dark .ql-fill {
    fill: var(--text-secondary) !important;
}

/* Main Quill Overrides */
.ql-container.ql-snow {
    background-color: var(--bg-white) !important;
    color: var(--text-primary) !important;
    font-size: 0.9rem !important;
    min-height: 150px;
    border-color: var(--border-color) !important;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    font-family: inherit !important;
}

.ql-editor {
    min-height: 150px !important;
    cursor: text;
    caret-color: var(--text-primary) !important;
    line-height: 1.5;
}

.ql-toolbar.ql-snow {
    background-color: var(--bg-main) !important;
    border-color: var(--border-color) !important;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
}

html.dark .ql-container.ql-snow {
    background-color: var(--bg-main) !important;
}

html.dark .ql-toolbar.ql-snow {
    background-color: var(--bg-white) !important;
}

html.dark .ql-editor.ql-blank::before {
    color: var(--text-muted) !important;
}

html.dark .ql-snow .ql-stroke {
    stroke: var(--text-primary) !important;
}

html.dark .ql-snow .ql-fill {
    fill: var(--text-primary) !important;
}

html.dark .ql-snow .ql-picker {
    color: var(--text-primary) !important;
}

/* Custom Editor Borders & Fallbacks */
#caseDescriptionEditor,
#incidentDescriptionEditor,
#riskDescriptionEditor,
#riskMitigationEditor {
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-white);
}

/* Utility Classes */
.hidden {
    display: none !important;
}

textarea.hidden {
    display: none !important;
}

textarea.form-input:not(.hidden),
textarea.form-textarea:not(.hidden) {
    display: block !important;
    width: 100%;
    min-height: 120px;
}

html.dark #caseDescriptionEditor,
html.dark #incidentDescriptionEditor,
html.dark #riskDescriptionEditor,
html.dark #riskMitigationEditor {
    background: var(--bg-main);
}

/* ============================================================================
   USER MANAGEMENT REDESIGN (v2)
   ============================================================================ */

.user-management-header {
    background: var(--bg-white);
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0;
}

.user-management-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.user-management-header p {
    color: var(--text-secondary);
}

.user-tabs {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
}

.user-tab {
    padding-bottom: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 0.95rem;
    text-decoration: none;
}

.user-tab:hover {
    color: var(--primary);
}

.user-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
    font-weight: 600;
}

.user-table-container {

    background: var(--bg-white);

    box-shadow: var(--shadow);

    border-radius: 8px;

    overflow-x: auto;

    margin: 1.5rem 2rem;

}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Default color, overridden by JS per user */
    background: #e0e7ff;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 1rem;
    flex-shrink: 0;
}

.user-info-cell {
    display: flex;
    align-items: center;
}

.user-name-text {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.user-email-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.role-badge.super_user {
    background: #eef2ff;
    color: #4f46e5;
}

.role-badge.viewer {
    background: #f3f4f6;
    color: #4b5563;
}

.status-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.status-active {
    color: #059669;
}

.status-inactive {
    color: #dc2626;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.action-btn.delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

.action-btn.password:hover {
    background: #ffedd5;
    color: #ea580c;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 0;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

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

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name-text {
    font-weight: 600;
    color: var(--text-primary);
}

.user-email-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.action-btn {
    border: none;
    background: none;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 1rem;
    margin-right: 0.25rem;
}

.action-btn:hover {
    background: var(--bg-main);
}

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

.action-btn.password {
    color: var(--warning);
}

.action-btn.delete {
    color: var(--danger);
}

.action-btn.approve {
    color: var(--success);
}

.action-btn.reject {
    color: var(--danger);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-active {
    color: var(--success);
}

.status-inactive {
    color: var(--text-muted);
}

/* Compact badge for Role */
.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    background: #f3f4f6;
    color: #4b5563;
    display: inline-block;
}/* Report List Styles */
.report-list {
    display: flex;
    flex-direction: column;
}

.report-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.report-item:hover {
    background-color: var(--bg-main);
}

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

.report-icon-wrapper {
    width: 40px;
    height: 40px;
    background-color: var(--bg-main);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

.report-details {
    flex: 1;
}

.report-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: block;
}

.report-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-meta span::after {
    content: "\00B7";
    margin-left: 0.5rem;
    opacity: 0.5;
}

.report-meta span:last-child::after {
    display: none;
}

.report-actions {
    margin-left: 1rem;
}

.report-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-link:hover {
    text-decoration: underline;
}

/* Dark Mode Adjustments for Reports */
html.dark .report-icon-wrapper {
    background-color: var(--bg-white);
    /* Slightly lighter than card bg in dark mode */
}

/* Kanban Board Styles */
.kanban-board {
    display: flex;
    overflow-x: auto;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
    min-height: 70vh;
    align-items: flex-start;
}

.kanban-column {
    flex: 0 0 300px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 200px);
    min-height: 200px;
}

.kanban-column-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.6);
    border-bottom: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    position: sticky;
    top: 0;
    z-index: 1;
}

.kanban-column-header h3 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.count-badge {
    background: var(--bg-main);
    color: var(--text-secondary);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.kanban-cards-container {
    padding: 0.75rem;
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
    transition: background-color 0.2s ease;
}

.kanban-cards-container.drag-over {
    background-color: rgba(99, 102, 241, 0.05);
    border: 2px dashed var(--primary);
    border-radius: 0 0 12px 12px;
}

.kanban-card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    position: relative;
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.5;
}

.kanban-card-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

/* Pipeline Sidebar/Nav Tabs */
.pipeline-tab {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pipeline-tab:hover {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.pipeline-tab.active {
    color: var(--primary);
    background: #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.province-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-main);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.empty-column-msg {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    opacity: 0.6;
}

/* Dark Mode Overrides for Kanban */
html.dark .kanban-column {
    background: rgba(30, 41, 59, 0.4);
    border-color: rgba(255, 255, 255, 0.05);
}

html.dark .kanban-column-header {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.05);
}

html.dark .kanban-card {
    background: var(--bg-card);
    border-color: rgba(255, 255, 255, 0.05);
}

html.dark .pipeline-tab.active {
    background: var(--bg-card);
    color: #fff;
}

html.dark .pipeline-navigation {
    background: var(--bg-main) !important;
}

html.dark .count-badge {
    background: rgba(255, 255, 255, 0.05);
}

.priority-critical { background: #fee2e2; color: #991b1b; }
.priority-high { background: #ffedd5; color: #9a3412; }
.priority-medium { background: #fef9c3; color: #854d0e; }
.priority-low { background: #dcfce7; color: #166534; }

.kanban-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.kanban-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--bg-main);
    padding-top: 0.75rem;
}

.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}

.category-tag {
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: var(--bg-main);
    padding: 2px 6px;
    border-radius: 4px;
}

.kanban-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    width: 100%;
    color: var(--text-muted);
}


/* ==========================================================================
   POPUP MODAL SYSTEM - GUARANTEED CENTERING & POP-UP EFFECT
   ========================================================================== */

/* Main Overlay - Forces fixed centering */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(15, 23, 42, 0.65) !important; /* Darker, more premium backdrop */
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 10000 !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    animation: fadeInModal 0.2s ease-out !important;
    padding: 1rem !important;
}

/* Modal Content Box - Creates the 'Pop-up' Window effect */
.modal {
    position: relative !important;
    background: var(--bg-white) !important;
    border-radius: 16px !important;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.4), 
        0 0 0 1px rgba(255, 255, 255, 0.1) !important;
    width: 100% !important;
    max-width: 600px !important; /* Default size */
    max-height: 85vh !important;
    margin: auto !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    animation: popScale 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    border: 1px solid rgba(255,255,255,0.1) !important;
}

/* Specific size overrides for larger forms */
#editUserModal .modal, 
#newUserModal .modal,
#newCaseModal .modal,
#newIncidentModal .modal,
#newRiskModal .modal,
#caseDetailModal .modal,
#incidentDetailModal .modal,
#riskDetailModal .modal {
    max-width: 850px !important;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popScale {
    from { opacity: 0; transform: scale(0.92) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    background: var(--bg-white) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 1.25rem 2rem !important;
    border-bottom: 2px solid var(--bg-main) !important;
    flex-shrink: 0 !important;
}

.modal-title {
    margin: 0 !important;
    font-size: 1.35rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
}

/* Scrollable Body */
.modal-body, #newUserForm, #newCaseForm, #newIncidentForm, #newRiskForm, #editUserForm {
    padding: 2rem !important;
    overflow-y: auto !important;
    flex: 1 !important;
    max-height: calc(85vh - 70px) !important;
}

.modal-footer {
    padding: 1rem 2rem !important;
    background: var(--bg-main) !important;
    border-top: 1px solid var(--border-color) !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 1rem !important;
    flex-shrink: 0 !important;
}

.modal-close, .btn-close {
    background: transparent !important;
    border: none !important;
    font-size: 1.75rem !important;
    color: var(--text-muted) !important;
    cursor: pointer !important;
    padding: 0.5rem !important;
    line-height: 1 !important;
    transition: all 0.2s !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-close:hover, .btn-close:hover {
    color: var(--danger) !important;
    transform: rotate(90deg) !important;
}

/* Utility to hide/show */
.modal-overlay.hidden {
    display: none !important;
}

/* Glassmorphism for Modals (Dark Mode) */
html.dark .modal {
    background: rgba(31, 41, 55, 0.95) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}
/* Fix notification dropdown z-index */
.notification-dropdown { z-index: 1050 !important; }

/* Notification Badge and Bell Styles */
.notification-bell {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    padding: 0.5rem;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger, #ef4444);
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    line-height: 1;
    min-width: 18px;
    text-align: center;
    border: 2px solid var(--bg-white, #ffffff);
}

html.dark .notification-badge {
    border-color: var(--bg-main, #0f172a);
}/*
Pipeline
Overhaul
CSS
*/

/* Pipeline Overhaul CSS */

#pipelineStatsBar {
    margin-bottom: 1.5rem;
}

.pipeline-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.p-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

.p-stat strong {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sla-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.sla-badge.breached {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 4px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

html.dark .pipeline-stats-grid {
    background: #1e293b;
    border-color: #334155;
}

html.dark .sla-badge.breached {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
