html {
    font-size: 14px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
    position: relative;
    min-height: 100%;
}

body {
    margin-bottom: 60px;
}

/* ============================= */
/* ===== DARK MODE COLORS ====== */
/* ============================= */

/* Main background - koyu gri instead of black */
body.dark-mode {
    background-color: #1a1d21 !important;
    color: #e9ecef !important;
}

/* Content wrapper */
body.dark-mode .content-wrapper {
    background-color: #1a1d21 !important;
}

/* Cards - koyu gri backgrounds */
body.dark-mode .card {
    background-color: #22262a !important;
    border-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .card-header {
    background-color: #1f2326 !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .card-body {
    background-color: #22262a !important;
}

body.dark-mode .card-footer {
    background-color: #1f2326 !important;
    border-top-color: rgba(255,255,255,0.1) !important;
}

/* Transparent cards - use slightly lighter gray */
body.dark-mode .bg-transparent {
    background-color: #1e2226 !important;
}

/* Modal backgrounds */
body.dark-mode .modal-content {
    background-color: #22262a !important;
    border-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .modal-header {
    background-color: #1f2326 !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .modal-body {
    background-color: #22262a !important;
}

body.dark-mode .modal-footer {
    background-color: #1f2326 !important;
    border-top-color: rgba(255,255,255,0.1) !important;
}

/* Sidebar dark mode */
body.dark-mode .main-sidebar {
    background-color: #1c1f23 !important;
}

body.dark-mode .sidebar {
    background-color: #1c1f23 !important;
}

/* Navbar dark mode */
body.dark-mode .main-header {
    background-color: #1f2326 !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .navbar {
    background-color: #1f2326 !important;
}

/* Dropdown menus */
body.dark-mode .dropdown-menu {
    background-color: #22262a !important;
    border-color: rgba(255,255,255,0.1) !important;
}

body.dark-mode .dropdown-item {
    color: #e9ecef !important;
}

body.dark-mode .dropdown-item:hover {
    background-color: #2d3238 !important;
}

/* Floating placeholder alignment */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}


/* ============================= */
/* ===== DARK MODE FORM FIX ==== */
/* ============================= */

body.dark-mode input.form-control,
body.dark-mode textarea.form-control,
body.dark-mode select.form-select {
    background-color: #2b3035 !important;
    color: #ffffff !important;
    border: 1px solid #495057 !important;
    border-radius: 6px;
}

    body.dark-mode input.form-control:focus,
    body.dark-mode textarea.form-control:focus,
    body.dark-mode select.form-select:focus {
        background-color: #32383e !important;
        color: #ffffff !important;
        border-color: #80bdff !important;
        box-shadow: none !important;
    }

body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: #9aa0a6 !important;
    opacity: 1;
}

/* ===== HIDE NUMBER INPUT SPINNERS ===== */

/* Chrome, Safari, Edge, Opera */
input.no-spinner::-webkit-outer-spin-button,
input.no-spinner::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Firefox */
input.no-spinner[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* For all number inputs in exam table */
.subj-correct::-webkit-outer-spin-button,
.subj-correct::-webkit-inner-spin-button,
.subj-wrong::-webkit-outer-spin-button,
.subj-wrong::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.subj-correct[type=number],
.subj-wrong[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ===== CHROME AUTOFILL DARK FIX ===== */

body.dark-mode input:-webkit-autofill,
body.dark-mode input:-webkit-autofill:hover,
body.dark-mode input:-webkit-autofill:focus,
body.dark-mode textarea:-webkit-autofill,
body.dark-mode select:-webkit-autofill {
    -webkit-text-fill-color: #ffffff !important;
    transition: background-color 9999s ease-in-out 0s !important;
    box-shadow: 0 0 0px 1000px #2b3035 inset !important;
    border: 1px solid #495057 !important;
}

/* Navbar active link */
.navbar .nav-link.active {
    color: #ffffff !important;
    border-bottom: 2px solid #0d6efd;
}

.action-mini {
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.15s ease-in-out;
}

    .action-mini:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 14px rgba(0,0,0,0.3);
    }

/* Validation styles */
.input-validation-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.1rem rgba(220,53,69,0.25) !important;
}

.field-validation-error {
    color: #dc3545 !important;
}

.validation-summary-errors {
    color: #dc3545;
}

/* Business blue accents for dark theme */
.accent-blue {
    border-left: 4px solid #0d6efd; /* bootstrap primary blue */
}

.card-header.accent-blue {
    background: linear-gradient(90deg, rgba(13,110,253,0.12), transparent);
    border-left: 4px solid #0d6efd;
}

.btn-accent {
    border: 1px solid rgba(13,110,253,0.2);
    background: rgba(13,110,253,0.06);
    color: #cfe2ff;
}

.table-dark th,
.table-dark td {
    border-color: rgba(255,255,255,0.06);
}

/* Page header soft colors for different actions */
.header-soft-success {
    background-color: rgba(25, 135, 84, 0.12); /* bootstrap success soft */
    border-left: 4px solid rgba(25,135,84,0.35);
}
.header-soft-danger {
    background-color: rgba(220, 53, 69, 0.10);
    border-left: 4px solid rgba(220,53,69,0.35);
}
.header-soft-warning {
    background-color: rgba(255, 193, 7, 0.10);
    border-left: 4px solid rgba(255,193,7,0.35);
}

/* Page tabs */
.page-tabs .nav-link {
    color: #dfe8ff;
    border-radius: 0.375rem 0.375rem 0 0;
}
.page-tabs .nav-link.active {
    background-color: rgba(13,110,253,0.12);
    color: #cfe2ff;
    border-bottom: 2px solid transparent;
}

/* Summary cards on side (balances) */
.summary-card .card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.summary-card .card-body h6 {
    margin: 0;
    font-weight: 600;
    opacity: 0.9;
}
.summary-card .card-body h3,
.summary-card .card-body h4 {
    margin: 0;
    font-weight: 700;
}

/* make amount visually separated when large */
.summary-card .amount {
    padding-left: 0.5rem;
    white-space: nowrap;
}

/* Divider for subject groups in exams table */
.group-divider {
    width: 18px;
    text-align: center;
    vertical-align: middle;
    color: rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.02);
}

/* CSV sample styling for dark theme */
.csv-sample {
    background-color: #171a1d; /* slightly lighter than background */
    border: 1px solid rgba(255,255,255,0.06);
    color: #cfe2ff;
    padding: 0.75rem;
    border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
}

/* ============================= */
/* ===== TABLE STYLING ======== */
/* ============================= */

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Custom scrollbar for dark mode */
body.dark-mode .table-responsive::-webkit-scrollbar {
    height: 10px;
}

body.dark-mode .table-responsive::-webkit-scrollbar-track {
    background: #1a1d21;
    border-radius: 5px;
}

body.dark-mode .table-responsive::-webkit-scrollbar-thumb {
    background: #4a5058;
    border-radius: 5px;
}

body.dark-mode .table-responsive::-webkit-scrollbar-thumb:hover {
    background: #5a6068;
}

/* Ensure table doesn't break layout on small screens */
.table-responsive > .table {
    min-width: 100%;
    margin-bottom: 0;
}

/* Dark mode table background - koyu gri instead of black for better readability */
body.dark-mode .table {
    background-color: #2d3238;
    color: #e9ecef;
}

body.dark-mode .table thead th {
    background-color: #23272b;
    color: #ffffff;
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .table tbody td {
    background-color: #2d3238;
    color: #e9ecef;
    border-color: rgba(255,255,255,0.08);
}

/* Striped table rows */
body.dark-mode .table-striped tbody tr:nth-of-type(odd) {
    background-color: #31353a;
}

body.dark-mode .table-striped tbody tr:nth-of-type(even) {
    background-color: #2d3238;
}

/* Bordered tables */
body.dark-mode .table-bordered {
    border-color: rgba(255,255,255,0.1);
}

body.dark-mode .table-bordered th,
body.dark-mode .table-bordered td {
    border-color: rgba(255,255,255,0.08);
}

/* Hover effect */
body.dark-mode .table-hover tbody tr:hover {
    background-color: #363a40;
    color: #ffffff;
}

/* Card body containing tables */
body.dark-mode .card-body {
    background-color: #1f2326;
}

/* Small tables */
body.dark-mode .table-sm th,
body.dark-mode .table-sm td {
    background-color: #2d3238;
}

