﻿/****************************************************
    THEME VARIABLES (LIGHT + DARK)
****************************************************/

/* Light Theme */
:root {
    --bg: #f5f7fa; /* Soft light background */
    --text: #1e1e1e;
    --text-muted: #6c757d;
    --card-bg: #ffffff;
    --btn-bg: #ffffff;
    --btn-bg-hover: #f0f0f0;
    --nav-bg: #ffffff;
    --nav-text: #1e1e1e;
    --shadow-soft: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.12);
}

/* Dark Theme */
[data-theme="dark"] {
    --bg: #0e0f12; /* TRUE dark body background */
    --text: #e9ecef;
    --text-muted: #b8b8b8;
    --card-bg: #1a1b1f;
    --btn-bg: #222327;
    --btn-bg-hover: #2d2e33;
    --nav-bg: #1a1b1f;
    --nav-text: #e9ecef;
    --shadow-soft: 0 4px 12px rgba(255,255,255,0.05);
    --shadow-hover: 0 6px 18px rgba(255,255,255,0.08);
}

/****************************************************
    BODY + GLOBAL STYLING
****************************************************/
body {
    background: var(--bg) !important;
    color: var(--text) !important;
    transition: background .25s ease, color .25s ease;
}

/****************************************************
    NAVBAR
****************************************************/
.app-navbar {
    background: var(--nav-bg) !important;
    color: var(--nav-text) !important;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

[data-theme="dark"] .app-navbar {
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.app-navbar .navbar-brand,
.app-navbar a,
.app-navbar .nav-link {
    color: var(--nav-text) !important;
}

.profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.theme-toggle-btn {
    font-size: 1.2rem;
    padding: 6px 10px;
}

/****************************************************
    DASHBOARD CARDS
****************************************************/
.dash-card {
    background: var(--card-bg);
    color: var(--text);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow-soft);
    transition: all .25s ease;
    text-align: center;
}

    .dash-card:hover {
        box-shadow: var(--shadow-hover);
        transform: translateY(-2px);
    }

.dash-card-title {
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.themed-text {
    font-size: .9rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dash-card-value {
    
    margin-bottom: 6px;
    font-weight: bold;
    font-size: clamp(1rem, 5vw, 2.5rem); /* minimum 1rem, max 2.5rem, responsive to viewport width */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.dash-card-link {
    font-size: .8rem;
    text-decoration: none;
    color: var(--nav-text);
}

/****************************************************
    PERFORMANCE PANEL
****************************************************/
.dash-panel {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 22px;
    box-shadow: var(--shadow-soft);
    transition: .25s;
}

    .dash-panel:hover {
        box-shadow: var(--shadow-hover);
    }




/****************************************************
    SMALL FIXES
****************************************************/
.dropdown-menu {
    background: var(--card-bg);
    color: var(--text);
}

.dropdown-item {
    color: var(--text);
}
/* DESKTOP = normal table looks same */
@media (min-width: 769px) {
    .responsive-table thead {
        display: table-header-group !important;
    }

    .responsive-table tr {
        display: table-row !important;
    }

    .responsive-table td {
        display: table-cell !important;
    }
}

/* MOBILE VERSION ONLY */
@media (max-width: 768px) {

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody tr {
        display: block;
        background: var(--card-bg);
        margin-bottom: 12px;
        padding: 12px 16px;
        border-radius: 14px;
        box-shadow: var(--shadow-soft);
    }

        .responsive-table tbody tr td {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            border: none !important;
        }

    .responsive-table tfoot tr {
        display: block;
        background: var(--card-bg);
        margin-bottom: 12px;
        padding: 12px 16px;
        border-radius: 14px;
        box-shadow: var(--shadow-soft);
    }

        .responsive-table tfoot tr td {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;

            border: double !important;
        }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-right: 10px;
        flex-shrink: 0;
        width: 100px;
        text-align: left;
    }

    /* Status badge stays natural size */
    .responsive-table td .badge {
        width: auto !important;
        display: inline-block !important;
    }

    /* ACTION BUTTON ROW */
    .mobile-actions {
        display: flex !important;
        gap: 6px;
        justify-content: flex-end;
        width: 100%;
        margin-top: 4px;
    }

        .mobile-actions .btn-sm {
            padding: 4px 10px !important;
            font-size: 0.8rem;
        }
}

@media (max-width: 768px) {
    /* Dark mode table */
    :root[data-theme="dark"] .table,
    :root[data-theme="dark"] .table th,
    :root[data-theme="dark"] .table td {
        background-color: #1e1e1e; /* Table background */
        color: #ddd; /* Text color */
        border-color: #333; /* Optional: borders */
    }

    /* Table hover effect */
    :root[data-theme="dark"] .table-hover tbody tr:hover {
        background-color: #2a2a2a;
    }

    /* Badge colors */
    :root[data-theme="dark"] .badge.bg-success {
        background-color: #28a745;
        color: #fff;
    }

    :root[data-theme="dark"] .badge.bg-secondary {
        background-color: #6c757d;
        color: #fff;
    }

    /* Button outlines for Actions column */
    :root[data-theme="dark"] .btn-outline-primary {
        color: #0d6efd;
        border-color: #0d6efd;
    }

    :root[data-theme="dark"] .btn-outline-danger {
        color: #dc3545;
        border-color: #dc3545;
    }
}


    /* Dark mode table */
    :root[data-theme="dark"] .table,
    :root[data-theme="dark"] .table th,
    :root[data-theme="dark"] .table td {
        background-color: #1e1e1e; /* Table background */
        color: #ddd; /* Text color */
        border-color: #333; /* Optional: borders */
    }

    /* Table hover effect */
    :root[data-theme="dark"] .table-hover tbody tr:hover {
        background-color: #2a2a2a;
    }

    /* Badge colors */
    :root[data-theme="dark"] .badge.bg-success {
        background-color: #28a745;
        color: #fff;
    }

    :root[data-theme="dark"] .badge.bg-secondary {
        background-color: #6c757d;
        color: #fff;
    }

    /* Button outlines for Actions column */
    :root[data-theme="dark"] .btn-outline-primary {
        color: #0d6efd;
        border-color: #0d6efd;
    }

    :root[data-theme="dark"] .btn-outline-danger {
        color: #dc3545;
        border-color: #dc3545;
    }

.select2-container--default .select2-selection--single {
    height: 40px;
    border-radius: 50px !important;
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background-color: var(--input-bg);
}

    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 40px;
        right: 10px;
    }

    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 28px;
        color: var(--text-color);
    }
/* Windows 11 Card */
.win-card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 32px 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

/* LIGHT MODE */
:root[data-theme="light"] {
    --card-bg: #ffffff;
    --card-shadow: 0 4px 14px rgba(0,0,0,0.12);
    --text-main: #212529;
    --text-muted: #6c757d;
}

/* DARK MODE */
:root[data-theme="dark"] {
    --card-bg: #1e1f22;
    --card-shadow: 0 4px 18px rgba(0,0,0,0.45);
    --text-main: #e3e3e3;
    --text-muted: #b8b8b8;
}

.win-title {
    color: var(--text-main);
    font-weight: 600;
}

.win-muted {
    color: var(--text-muted);
}

.win-big {
    font-size: 40px;
    font-weight: 700;
    margin-bottom: 10px;
}
.hide {
    display:none !important;
}
.table td.hide {
    display: none !important;
}
.btn {
    border-radius: 10px !important;
    padding: 12px;
    font-size: 16px;
}

/* Smooth Backdrop */
.error-wrapper {
    min-height: 70vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
}


/* Light mode - default */
.card-header {
    background-color: #f8f9fa; /* light gray */
    color: #212529;
    border-bottom: 1px solid #dee2e6;
}

/* Dark mode */
:root[data-theme="dark"] .card-header {
    background-color: #1e2a38; /* bluish dark shade */
    color: #ffffff;
    border-bottom: 1px solid #2c3e50;
}

    /* Button contrast in dark mode */
    :root[data-theme="dark"] .card-header .btn-outline-secondary {
        color: #c0c0c0;
        border-color: #3a4a5a;
    }

        :root[data-theme="dark"] .card-header .btn-outline-secondary:hover {
            background-color: #2c3e50;
            border-color: #5a6a7a;
        }

/* Optional: make toggle look nice in dark mode too */
:root[data-theme="dark"] .form-check-input {
    background-color: #555;
    border-color: #888;
}

    :root[data-theme="dark"] .form-check-input:checked {
        background-color: #2196F3; /* blueish like VSCode dark */
        border-color: #2196F3;
    }

.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
}
/* Larger form-switch */
.form-check-input.rounded-pill {
    width: 60px; /* overall switch width */
    height: 34px; /* overall switch height */
    cursor: pointer;
}

    /* The knob (before pseudo-element) */
    .form-check-input.rounded-pill::before {
        width: 28px; /* knob width */
        height: 28px; /* knob height */
        left: 3px; /* distance from left */
        bottom: 3px; /* distance from bottom */
    }

    /* Checked state knob */
    .form-check-input.rounded-pill:checked::before {
        transform: translateX(26px); /* move knob when checked */
    }

    /* Optional: adjust focus shadow */
    .form-check-input.rounded-pill:focus {
        box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
    }


/* Apply theme variables to modal elements */
#changePasswordModal .modal-content {
    background-color: var(--card-bg);
    color: var(--text);
    box-shadow: var(--shadow-soft);
}

#changePasswordModal .modal-header,
#changePasswordModal .modal-footer {
    border-color: var(--btn-bg-hover);
}

#changePasswordModal .modal-title,
#changePasswordModal .form-label {
    color: var(--text);
}

#changePasswordModal .form-control {
    background-color: var(--btn-bg);
    color: var(--text);
    border: 1px solid #ccc;
    transition: background-color 0.2s, color 0.2s;
}

    #changePasswordModal .form-control:focus {
        background-color: var(--btn-bg-hover);
        color: var(--text);
        box-shadow: var(--shadow-hover);
        border-color: #007bff;
    }

#changePasswordModal .btn-primary {
    background-color: #007bff;
    border-color: #007bff;
    color: #fff;
    transition: background-color 0.2s, box-shadow 0.2s;
}

    #changePasswordModal .btn-primary:hover {
        background-color: #0069d9;
        box-shadow: var(--shadow-hover);
        color: #fff;
    }

#changePasswordModal .text-danger {
    color: #dc3545; /* keeps error message readable in both themes */
}

/* Optional: adapt btn-close to theme */
#changePasswordModal .btn-close {
    filter: invert(0.9);
}

[data-theme="dark"] #changePasswordModal .btn-close {
    filter: invert(0.1);
}


#themeToggleBtn {
    cursor: pointer;
    font-size: 1.4rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

    #themeToggleBtn i {
        pointer-events: none;
    }

    #themeToggleBtn:hover {
        opacity: 0.7;
    }
