/* GhEduExams Pro - Custom Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #1cc88a;
    --danger-color: #e74a3b;
    --warning-color: #f6c23e;
    --info-color: #36b9cc;
    
    /* Light Theme Variables */
    --bg-color: #f8f9fa;
    --text-color: #212529;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    --sidebar-bg: #ffffff;
    --hover-bg: #f8f9fa;
    --input-bg: #ffffff;
    --navbar-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
}

/* Dark Theme Variables */
body.theme-dark {
    --bg-color: #0d1117;
    --text-color: #ffffffff;
    --card-bg: #161b22;
    --border-color: #30363d;
    --sidebar-bg: #161b22;
    --hover-bg: #21262d;
    --input-bg: #0d1117;
    --navbar-bg: #161b22;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Smooth transitions for theme switching */
body,
.card,
.form-control,
.form-select,
.modal-content,
.sidebar,
.navbar,
.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-info,
.btn-outline-warning,
.btn-outline-danger {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Apply Theme Colors */
body.theme-dark {
    background-color: var(--bg-color);
    color: var(--text-color);
}

body.theme-dark .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.theme-dark .card-header {
    background-color: #111827 !important;
    border-color: #111827 !important;
    color: var(--text-color, #e2e8f0) !important;
}

body.theme-dark .card-header.bg-white {
    background-color: #111827 !important;
    color: var(--text-color, #e2e8f0) !important;
}

/* Make headers with bg-white (e.g. Quick Actions) use a readable title color */
body .card-header.bg-white h5 {
    color: #111827 !important;
}

/* In dark theme, ensure header titles stay light on the dark background */
body.theme-dark .card-header.bg-white h5 {
    color: var(--text-color, #e2e8f0) !important;
}

/* Ensure generic card headers in dark mode also have readable titles */
body.theme-dark .card-header h5,
body.theme-dark .card-header .h5 {
    color: var(--text-color, #e2e8f0) !important;
}

body.theme-dark .table {
    color: var(--text-color);
}

body.theme-dark .table-hover tbody tr:hover {
    background-color: var(--hover-bg);
}

body.theme-dark .sidebar,
body.theme-dark .bg-light {
    background-color: var(--sidebar-bg) !important;
    color: var(--text-color);
}

body.theme-dark .nav-link {
    color: var(--text-color);
}

body.theme-dark .nav-link:hover {
    background-color: var(--hover-bg);
}

body.theme-dark .form-control,
body.theme-dark .form-select {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.theme-dark .form-control:focus,
body.theme-dark .form-select:focus {
    background-color: var(--card-bg);
    color: var(--text-color);
    border-color: var(--primary-color);
}

body.theme-dark .modal-content {
    background-color: var(--card-bg);
    color: var(--text-color);
}

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

body.theme-dark .border-bottom {
    border-color: var(--border-color) !important;
}

body.theme-dark .text-muted {
    color: #a0a0a0 !important;
}

body.theme-dark .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.theme-dark .navbar {
    background-color: var(--navbar-bg) !important;
    border-bottom: 1px solid var(--border-color);
}

body.theme-dark .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.theme-dark .dropdown-item {
    color: var(--text-color);
}

body.theme-dark .dropdown-item:hover {
    background-color: var(--hover-bg);
}

body.theme-dark .btn-outline-secondary {
    color: var(--text-color);
    border-color: var(--border-color);
}

body.theme-dark .btn-outline-secondary:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

body.theme-dark .alert {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.theme-dark .breadcrumb {
    background-color: var(--card-bg);
}

body.theme-dark .page-link {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.theme-dark .page-link:hover {
    background-color: var(--hover-bg);
}

body.theme-dark input::placeholder,
body.theme-dark textarea::placeholder {
    color: #6c757d;
}

body.theme-dark .btn-close {
    filter: invert(1);
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background-color: var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    transition: background-color 0.3s;
    border: none;
    padding: 0;
}

.theme-toggle:hover {
    background-color: var(--hover-bg);
}

.theme-toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background-color: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.theme-dark .theme-toggle-slider {
    transform: translateX(30px);
    background-color: #ffd700;
}

.theme-icon {
    font-size: 14px;
}

/* Additional custom styles */

.glass-card {
    /* Remove heavy blur to keep text crisp on previews */
    backdrop-filter: none !important;
}

/* Page Header Spacing - Ensure no content is hidden behind fixed navbar */
main .d-flex.pt-3,
main .page-header,
main > .pt-3,
main > div:first-child {
    padding-top: 1.5rem !important;
}

/* Ensure first heading in main is never hidden */
main h1:first-of-type,
main .h2:first-of-type {
    margin-top: 0.5rem;
}

/* Utility class for pages with custom layouts */
.content-below-navbar {
    padding-top: 1.5rem !important;
}

/* Ensure all page titles are visible */
.page-title-wrapper {
    padding-top: 1.5rem !important;
    padding-bottom: 1rem;
}

/* Fix for any remaining edge cases */
main > div > h1:first-child,
main > div > .h2:first-child,
main > div > div:first-child > h1:first-child,
main > div > div:first-child > .h2:first-child {
    margin-top: 0.5rem;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

.card-hover {
    transition: transform 0.3s, box-shadow 0.3s;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.badge-custom {
    padding: 0.5em 0.75em;
    border-radius: 0.25rem;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* Mobile First Approach */
body {
    font-size: 14px;
}

/* Responsive Tables */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .table-responsive {
        border: 1px solid var(--border-color);
        border-radius: 0.25rem;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
        font-size: 11px;
    }
}

/* Sidebar Responsiveness */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: -100% !important;
        height: 100vh !important;
        width: 280px !important;
        max-width: 85vw !important;
        z-index: 1060 !important;
        transition: left 0.3s ease !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3) !important;
        -webkit-overflow-scrolling: touch;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .sidebar.show {
        left: 0 !important;
        transform: translateX(0) !important;
    }
    
    .sidebar * {
        pointer-events: auto !important;
    }
    
    .sidebar .nav-link {
        pointer-events: auto !important;
        cursor: pointer !important;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.1);
        touch-action: manipulation !important;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        -webkit-tap-highlight-color: transparent;
        pointer-events: none;
    }
    
    .sidebar-overlay.show {
        display: block !important;
        pointer-events: auto !important;
    }
    
    main {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 70px !important; /* Space for fixed navbar on mobile */
    }
    
    .navbar-toggler {
        display: inline-block !important;
    }
    
    /* Ensure navbar is below sidebar */
    .navbar {
        z-index: 1040 !important;
    }
}

/* Mobile Navigation */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    border: none;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    z-index: 1070;
    font-size: 28px;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    pointer-events: auto;
}

.mobile-menu-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.6);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle i {
    pointer-events: none;
}

@media (max-width: 767.98px) {
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        pointer-events: auto !important;
    }
}

/* Card Responsiveness */
@media (max-width: 575.98px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Form Responsiveness */
@media (max-width: 767.98px) {
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-lg {
        max-width: 100%;
    }
    
    .form-label {
        font-size: 13px;
        margin-bottom: 0.25rem;
    }
    
    .form-control,
    .form-select {
        font-size: 14px;
        padding: 0.5rem 0.75rem;
    }
}

/* Button Responsiveness */
@media (max-width: 575.98px) {
    .btn {
        font-size: 13px;
        padding: 0.5rem 0.75rem;
    }
    
    .btn-sm {
        font-size: 11px;
        padding: 0.25rem 0.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
    }
}

/* Statistics Cards */
@media (max-width: 767.98px) {
    .col-md-2,
    .col-md-3,
    .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

@media (max-width: 575.98px) {
    .col-md-2,
    .col-md-3,
    .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Header Responsiveness */
@media (max-width: 767.98px) {
    .d-flex.justify-content-between {
        flex-direction: column;
        align-items: flex-start !important;
    }
    
    .d-flex.justify-content-between > * {
        margin-bottom: 0.5rem;
    }
    
    h1.h2 {
        font-size: 1.5rem;
    }
}

/* Filter Form Responsiveness */
@media (max-width: 767.98px) {
    .row.g-3 > div {
        margin-bottom: 0.75rem;
    }
    
    .col-md-2,
    .col-md-3 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Utility Classes */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 767.98px) {
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

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

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

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .btn,
    .theme-toggle,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
        width: 100% !important;
        padding-top: 0 !important; /* No padding needed for print */
    }
    
    .card {
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Styles */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* ============================================
   ROLES & PERMISSIONS PAGE STYLES
   ============================================ */

/* Hero Section */
.roles-hero {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.roles-hero h1 {
    font-weight: 700;
}

/* Role Cards */
.role-card {
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.role-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow) !important;
}

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Gradient Backgrounds */
.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.bg-gradient-success {
    background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%);
}

.bg-gradient-info {
    background: linear-gradient(135deg, #36b9cc 0%, #258391 100%);
}

.bg-gradient-warning {
    background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%);
}

/* Stat Boxes */
.stat-box {
    transition: all 0.2s ease;
}

.stat-box:hover {
    transform: scale(1.05);
    background-color: var(--hover-bg) !important;
}

/* Icon Box */
.icon-box {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Permissions Preview */
.permissions-preview .badge {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Card Footer Buttons */
.card-footer .btn {
    transition: all 0.2s ease;
}

.card-footer .btn:hover {
    transform: translateY(-2px);
}

/* Dark Mode Adjustments for Role Cards */
body.theme-dark .role-card {
    border-color: var(--border-color);
}

body.theme-dark .stat-box {
    background-color: var(--hover-bg) !important;
}

body.theme-dark .bg-light {
    background-color: var(--hover-bg) !important;
}

body.theme-dark .card-header.text-white {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: 12px;
    overflow: hidden;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

body.theme-dark .modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Permission Checkboxes */
.form-check {
    padding: 0.75rem;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.form-check:hover {
    background-color: var(--hover-bg);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Category Headers in Modals */
.modal-body h6 {
    font-weight: 600;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

/* Scrollable Permission List */
.modal-body > div[style*="max-height"] {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
    border-radius: 6px;
}

/* Button Group Enhancements */
.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.btn-group .btn:last-child {
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

/* ============================================
   GHDUCEXAMS CHAT (Dedicated Page)
   ============================================ */
.ai-chat-card {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 16px;
    overflow: hidden;
    background: var(--card-bg, #ffffff);
    color: var(--text-color, #111827);
    display: flex;
    flex-direction: column;
    min-height: 520px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
}

.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.ai-chat-messages {
    padding: 14px;
    flex: 1;
    min-height: 300px;
    max-height: 65vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(245,247,250,0.95));
}

.ai-chat-message {
    margin-bottom: 12px;
}

.ai-chat-name {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 3px;
    letter-spacing: 0.1px;
    text-transform: uppercase;
}

.ai-chat-bubble {
    border-radius: 12px;
    padding: 10px 12px;
    line-height: 1.4;
    background: #e5e7eb;
    color: #111827;
    word-break: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.ai-chat-message-user .ai-chat-bubble {
    background: linear-gradient(135deg, #c7d2fe, #a5b4fc);
    color: #0f172a;
    margin-left: 32px;
    font-size: 14px;
}

.ai-chat-message-bot .ai-chat-bubble {
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #111827;
    margin-right: 32px;
    font-size: 14px;
}

.ai-chat-input {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color, #e5e7eb);
    background: var(--card-bg, #ffffff);
}

.ai-chat-input textarea {
    resize: none;
    font-size: 14px;
    border-radius: 10px;
    min-height: 84px;
}

.ai-chat-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
}

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

@media (max-width: 767.98px) {
    .ai-chat-card {
        min-height: 420px;
    }
    .ai-chat-messages {
        max-height: none;
        min-height: 260px;
    }
}

body.theme-dark .ai-chat-card {
    background: var(--card-bg, #161b22);
    color: var(--text-color, #e2e8f0);
    border-color: var(--border-color, #30363d);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
}

body.theme-dark .ai-chat-messages {
    background: linear-gradient(180deg, rgba(17,23,35,0.9), rgba(13,17,23,0.95));
}

body.theme-dark .ai-chat-bubble {
    background: #1f2937;
    color: #e5e7eb;
}

body.theme-dark .ai-chat-message-user .ai-chat-bubble {
    background: #1d4ed8;
    color: #e5e7eb;
}

body.theme-dark .ai-chat-message-bot .ai-chat-bubble {
    background: #111827;
    color: #e5e7eb;
    border: 1px solid #1f2937;
}

body.theme-dark .ai-chat-header {
    border-bottom-color: rgba(255,255,255,0.1);
}

/* Responsive Adjustments for Role Cards */
@media (max-width: 767.98px) {
    .role-card {
        margin-bottom: 1rem;
    }
    
    .roles-hero h1 {
        font-size: 1.75rem;
    }
    
    .roles-hero .btn-lg {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .stat-box {
        padding: 0.75rem !important;
    }
    
    .stat-box .fs-4 {
        font-size: 1.25rem !important;
    }
}

/* Animation for Cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.role-card {
    animation: fadeInUp 0.5s ease-out;
}

/* Stagger animation for multiple cards */
.role-card:nth-child(1) { animation-delay: 0.1s; }
.role-card:nth-child(2) { animation-delay: 0.2s; }
.role-card:nth-child(3) { animation-delay: 0.3s; }
.role-card:nth-child(4) { animation-delay: 0.4s; }
.role-card:nth-child(5) { animation-delay: 0.5s; }
.role-card:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   USER MANAGEMENT PAGE STYLES
   ============================================ */

/* Hero Section */
.users-hero {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.users-hero h1 {
    font-weight: 700;
}

/* Stat Cards */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 500;
}

/* User Cards */
.user-card {
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out;
}

.user-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow) !important;
}

.user-avatar-lg {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

/* Info Boxes */
.info-box {
    transition: all 0.2s ease;
}

.info-box:hover {
    transform: scale(1.05);
    background-color: var(--hover-bg) !important;
}

.info-box i {
    font-size: 1.5rem;
}

/* Card Footer Buttons */
.user-card .card-footer .btn {
    transition: all 0.2s ease;
}

.user-card .card-footer .btn:hover {
    transform: translateY(-2px);
}

/* Filter Card */
.card-header h5 {
    font-weight: 600;
}

/* Ensure card headers are readable in light theme (dark text on light background) */
body:not(.theme-dark) .card-header {
    background-color: #e5e7eb;      /* light grey header background */
    color: #111827;                 /* dark heading text */
}

body:not(.theme-dark) .card-header h5,
body:not(.theme-dark) .card-header .h5 {
    color: #111827;
}

/* Dark Mode Adjustments for User Cards */
body.theme-dark .user-card {
    border-color: var(--border-color);
}

body.theme-dark .info-box {
    background-color: var(--hover-bg) !important;
}

body.theme-dark .stat-card {
    border-color: var(--border-color);
}

/* Responsive Adjustments for User Cards */
@media (max-width: 767.98px) {
    .user-card {
        margin-bottom: 1rem;
    }
    
    .users-hero h1 {
        font-size: 1.75rem;
    }
    
    .users-hero .btn-lg {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .stat-icon {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .user-avatar-lg {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .card-header h5 {
        font-size: 1rem;
    }
}

/* Stagger animation for user cards */
.user-card:nth-child(1) { animation-delay: 0.1s; }
.user-card:nth-child(2) { animation-delay: 0.2s; }
.user-card:nth-child(3) { animation-delay: 0.3s; }
.user-card:nth-child(4) { animation-delay: 0.4s; }
.user-card:nth-child(5) { animation-delay: 0.5s; }
.user-card:nth-child(6) { animation-delay: 0.6s; }
.user-card:nth-child(7) { animation-delay: 0.7s; }
.user-card:nth-child(8) { animation-delay: 0.8s; }
.user-card:nth-child(9) { animation-delay: 0.9s; }

/* ============================================
   DATABASE BACKUP PAGE STYLES
   ============================================ */

/* Hero Section */
.backup-hero {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.backup-hero h1 {
    font-weight: 700;
}

/* Backup Cards */
.backup-card {
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out;
}

.backup-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow) !important;
}

.backup-icon {
    font-size: 2.5rem;
}

.backup-size {
    transition: all 0.2s ease;
}

.backup-size:hover {
    transform: scale(1.02);
}

/* Dark Mode Adjustments for Backup Cards */
body.theme-dark .backup-card {
    border-color: var(--border-color);
}

body.theme-dark .backup-size .bg-light {
    background-color: var(--hover-bg) !important;
}

/* Responsive Adjustments for Backup Cards */
@media (max-width: 767.98px) {
    .backup-card {
        margin-bottom: 1rem;
    }
    
    .backup-hero h1 {
        font-size: 1.75rem;
    }
    
    .backup-hero .btn-lg {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .backup-icon {
        font-size: 2rem;
    }
}

/* Stagger animation for backup cards */
.backup-card:nth-child(1) { animation-delay: 0.1s; }
.backup-card:nth-child(2) { animation-delay: 0.2s; }
.backup-card:nth-child(3) { animation-delay: 0.3s; }
.backup-card:nth-child(4) { animation-delay: 0.4s; }
.backup-card:nth-child(5) { animation-delay: 0.5s; }
.backup-card:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   SYSTEM HEALTH PAGE STYLES
   ============================================ */

/* Hero Section */
.health-hero {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
}

.health-hero h1 {
    font-weight: 700;
}

/* Health Score Card */
.health-score-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    animation: fadeInUp 0.5s ease-out;
}

.health-score-circle {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.quick-stats .stat-item {
    padding: 0.5rem 0;
    border-left: 3px solid transparent;
    padding-left: 0.75rem;
    transition: all 0.3s ease;
}

.quick-stats .stat-item:hover {
    border-left-color: var(--primary-color);
    padding-left: 1rem;
}

/* Health Check Cards */
.health-check-card {
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out;
}

.health-check-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow) !important;
}

.health-icon {
    font-size: 3rem;
    transition: transform 0.3s ease;
}

.health-check-card:hover .health-icon {
    transform: scale(1.1);
}

/* Record Count Cards */
.record-count-card {
    transition: all 0.3s ease;
    cursor: pointer;
}

.record-count-card:hover {
    transform: translateY(-3px);
    background-color: var(--hover-bg) !important;
    box-shadow: 0 4px 12px var(--shadow);
}

/* Config Items */
.config-item {
    transition: all 0.2s ease;
}

.config-item:hover {
    transform: translateX(5px);
    background-color: var(--hover-bg) !important;
}

/* Progress Bar Enhancements */
.progress {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    transition: width 1s ease;
    font-weight: bold;
}

/* Dark Mode Adjustments */
body.theme-dark .health-score-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
}

body.theme-dark .record-count-card,
body.theme-dark .config-item {
    background-color: var(--hover-bg) !important;
}

body.theme-dark .health-check-card {
    border-color: var(--border-color);
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .health-hero h1 {
        font-size: 1.75rem;
    }
    
    .health-hero .btn-lg {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .health-score-circle svg {
        width: 100px;
        height: 100px;
    }
    
    .health-icon {
        font-size: 2rem;
    }
    
    .quick-stats {
        margin-top: 1rem;
    }
}

/* Stagger animation for health checks */
.health-check-card:nth-child(1) { animation-delay: 0.1s; }
.health-check-card:nth-child(2) { animation-delay: 0.2s; }
.health-check-card:nth-child(3) { animation-delay: 0.3s; }
.health-check-card:nth-child(4) { animation-delay: 0.4s; }
.health-check-card:nth-child(5) { animation-delay: 0.5s; }
.health-check-card:nth-child(6) { animation-delay: 0.6s; }

/* ============================================
   ADMIN DASHBOARD STYLES
   ============================================ */

/* Dashboard Hero */
.dashboard-hero {
    padding: 1.5rem 0 2rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-top: 0;
}

.dashboard-hero h1 {
    font-weight: 700;
    margin-top: 0;
}

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

.time-display {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.date-display {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Stat Cards */
.stat-card {
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease-out;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow) !important;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Quick Action Cards */
.quick-action-card {
    display: block;
    transition: all 0.3s ease;
}

.quick-action-card .card {
    background: var(--card-bg);
    transition: all 0.3s ease;
}

.quick-action-card:hover .card {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15) !important;
}

.quick-action-card .card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-icon {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.quick-action-card:hover .action-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.quick-action-card h6 {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
}

/* Custom styling for card body h6 elements */
.card-body h6 {
    color: #0463ff !important;
    margin-top: 0.5rem;
    transition: color 0.3s ease;
    opacity: 1 !important;
}

.quick-action-card:hover h6 {
    color: #0f172a !important;
}

.quick-action-card .card-body h6 {
    color: #1e293b !important;
    font-weight: 700 !important;
}

/* Force visibility for both light and dark themes */
body .quick-action-card h6,
body.theme-dark .quick-action-card h6,
body .quick-action-card .card-body h6,
body.theme-dark .quick-action-card .card-body h6 {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 1.1rem !important;
    opacity: 1 !important;
}

/* Ensure primary card headers (e.g. Quick Actions) have readable text
   in both light and dark themes, even if other theme styles override backgrounds. */
body .card-header.bg-primary.text-white {
    background-color: #e5e7eb !important; /* light grey background in light theme */
    color: #111827 !important;            /* dark text for readability */
}

body.theme-dark .card-header.bg-primary.text-white {
    background-color: #111827 !important; /* dark background in dark theme */
    color: #f9fafb !important;            /* light text for readability */
}

/* Dark theme specific - use lighter text */
body.theme-dark .quick-action-card h6,
body.theme-dark .quick-action-card .card-body h6 {
    color: #f1f5f9 !important;
}

/* Enhanced color variations for action icons */
.bg-primary.bg-opacity-10 {
    background-color: rgba(79, 70, 229, 0.12) !important;
}

.bg-success.bg-opacity-10 {
    background-color: rgba(34, 197, 94, 0.12) !important;
}

.bg-info.bg-opacity-10 {
    background-color: rgba(14, 165, 233, 0.12) !important;
}

.bg-warning.bg-opacity-10 {
    background-color: rgba(251, 191, 36, 0.12) !important;
}

.bg-danger.bg-opacity-10 {
    background-color: rgba(239, 68, 68, 0.12) !important;
}

.bg-secondary.bg-opacity-10 {
    background-color: rgba(100, 116, 139, 0.12) !important;
}

.bg-dark.bg-opacity-10 {
    background-color: rgba(30, 41, 59, 0.12) !important;
}

.bg-purple.bg-opacity-10 {
    background-color: rgba(168, 85, 247, 0.12) !important;
}

/* Enhanced text colors */
.text-purple {
    color: #A855F7 !important;
}

.text-primary {
    color: #4F46E5 !important;
}

.text-success {
    color: #22C55E !important;
}

.text-info {
    color: #0EA5E9 !important;
}

.text-warning {
    color: #F59E0B !important;
}

.text-danger {
    color: #EF4444 !important;
}

.text-secondary {
    color: #64748B !important;
}

.text-dark {
    color: #1E293B !important;
}

/* Exam Icon */
.exam-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--bs-primary-rgb), 0.1);
    border-radius: 10px;
}

.hover-bg {
    transition: all 0.2s ease;
}

.hover-bg:hover {
    background-color: var(--hover-bg) !important;
}

/* Activity Timeline */
.activity-timeline {
    position: relative;
}

.activity-item {
    position: relative;
    padding-left: 30px;
    padding-bottom: 1.5rem;
    border-left: 2px solid var(--border-color);
}

.activity-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.activity-dot {
    position: absolute;
    left: -6px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary-color);
    border: 2px solid var(--card-bg);
}

.activity-content {
    background: var(--hover-bg);
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.activity-content:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

/* Result/Report preview modal text visibility */
#previewModal .modal-content {
    color: #111 !important;
    background: #ffffff !important;
}

#previewModal .modal-content * {
    color: #111 !important;
    opacity: 1 !important;
}

#previewModal table {
    color: #111 !important;
    background: #ffffff !important;
    border-color: #333 !important;
}

#previewModal table th {
    background: #f5f7fa !important;
    color: #111 !important;
    font-weight: 700 !important;
}

#previewModal table td {
    background: #ffffff !important;
    color: #111 !important;
}

/* Ensure inline report tables (outside modal) are legible */
.results-table,
.results-table th,
.results-table td,
.info-table,
.info-table th,
.info-table td {
    color: #111 !important;
    background: #ffffff !important;
}

/* Dark Mode Adjustments */
body.theme-dark .stat-card {
    border-color: var(--border-color);
}

body.theme-dark .quick-action-card .card {
    background: var(--card-bg);
}

body.theme-dark .activity-dot {
    border-color: var(--card-bg);
}

/* Responsive Adjustments */
@media (max-width: 767.98px) {
    .dashboard-hero h1 {
        font-size: 1.5rem;
    }
    
    .current-time {
        text-align: left;
        margin-top: 1rem;
    }
    
    .time-display {
        font-size: 1.5rem;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }
    
    .action-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

/* Stagger animation for stat cards */
.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }
.stat-card:nth-child(5) { animation-delay: 0.5s; }
.stat-card:nth-child(6) { animation-delay: 0.6s; }

/* Mock exam bulk entry */
.mock-bulk-table {
    table-layout: fixed;
}

.mock-bulk-table th.subject-col,
.mock-bulk-table td.subject-col {
    width: 120px;
    min-width: 120px;
}

.mock-bulk-table th.subject-col {
    white-space: normal;
    word-break: break-word;
}

.mock-bulk-table .bulk-score-input {
    width: 100%;
    min-width: 120px;
    box-sizing: border-box;
}

.mock-select-list {
    border: 1px solid #e4e7ef;
    border-radius: 8px;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
    background: #ffffff;
}

.mock-select-list .form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    margin: 0;
    border-radius: 6px;
}

.mock-select-list .form-check:hover {
    background: rgba(88, 76, 190, 0.08);
}

body.theme-dark .mock-select-list {
    background: var(--card-bg);
    border-color: var(--border-color);
}
