﻿/* ===== Base ===== */
:root {
    --brand: #0b5ed7;
    --bg: #f6f7fb;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(15,23,42,.08);
    --control-h: 34px;
    --fs: 12px;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: system-ui,-apple-system,Segoe UI,Roboto,Arial;
}

a {
    text-decoration: none;
}

.small-muted {
    color: var(--muted);
    font-size: 12px;
}

/* ===== Layout ===== */
.topbar {
    background: var(--brand);
    color: #fff;
}

.brand {
    font-weight: 700;
    letter-spacing: .3px;
}

.page-wrap {
    padding: 18px;
}

.card-soft {
    background: var(--card);
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.card-sub {
    color: var(--muted);
    font-size: 12px;
}

/* ===== Controls (same everywhere) ===== */
.form-control, .form-select {
    height: var(--control-h);
    font-size: var(--fs);
    border-radius: 12px;
}

    .form-control:focus, .form-select:focus {
        box-shadow: 0 0 0 .15rem rgba(11,94,215,.15);
    }

.btn {
    border-radius: 12px;
    font-size: 12px;
    padding: .35rem .7rem;
}

.btn-soft {
    padding: .45rem .85rem;
}

label.form-label {
    font-size: 11px;
    margin-bottom: 4px;
    color: var(--muted);
}

/* ✅ Textarea / multiline should not be forced to 34px height */
textarea.form-control {
    height: auto !important;
    min-height: calc(var(--control-h) * 3);
    line-height: 1.35;
}

/* ===== Tables ===== */
.table {
    font-size: 12px;
}

    .table td, .table th {
        vertical-align: middle;
    }

/* ===== Select2 (make it match controls) ===== */
.select2-container {
    width: 100% !important;
}

    .select2-container .select2-selection--single {
        height: var(--control-h) !important;
        border-radius: 12px !important;
        border: 1px solid #ced4da !important;
    }

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(var(--control-h) - 2px) !important;
    padding-left: 10px !important;
    padding-right: 28px !important;
    font-size: var(--fs);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: var(--control-h) !important;
}

/* ===== Global Loader Overlay ===== */
#globalLoader {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.22);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

    #globalLoader .loader-card {
        background: #fff;
        border-radius: 16px;
        padding: 16px 18px;
        box-shadow: 0 20px 60px rgba(0,0,0,.18);
        min-width: 240px;
        max-width: calc(100vw - 24px); /* ✅ mobile safe */
    }

    #globalLoader .spinner {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 3px solid #e5e7eb;
        border-top-color: var(--brand);
        animation: spin .8s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ✅ Responsive (Mobile) */
@media (max-width: 576px) {

    /* reduce side padding on mobile */
    .page-wrap {
        padding: 12px;
    }

    /* keep navbar items from overflowing */
    .topbar .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* controls become touch-friendly */
    :root {
        --control-h: 40px;
        --fs: 13px;
    }

    .btn {
        padding: .5rem .85rem;
        font-size: 13px;
    }

    /* stack button rows nicely */
    .d-flex.gap-2 {
        flex-wrap: wrap;
    }

        .d-flex.gap-2 > .btn,
        .d-flex.gap-2 > a.btn,
        .d-flex.gap-2 > input.btn,
        .d-flex.gap-2 > button.btn {
            width: 100%;
        }

    /* GridView/table scroll on small screens */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* JSON / long text should wrap instead of forcing horizontal scroll */
    textarea.form-control {
        white-space: pre-wrap;
        word-break: break-word;
    }
}

/* ✅ Responsive (Tablet) */
@media (min-width: 577px) and (max-width: 991px) {
    .page-wrap {
        padding: 14px;
    }
}

.sf-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.sf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.35);
}

.sf-modal-card {
    position: absolute;
    right: 16px;
    top: 16px;
    bottom: 16px;
    width: min(820px, calc(100% - 32px));
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sf-modal-head {
    padding: 14px 16px;
    border-bottom: 1px solid #eef1f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.sf-modal-title {
    font-weight: 700;
    font-size: 16px;
}

.sf-modal-sub {
    font-size: 12px;
    color: #6b778c;
}

.sf-modal-close {
    border: 0;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
}

.sf-modal-body {
    padding: 14px 16px;
    overflow: auto;
}

.sf-modal-foot {
    padding: 12px 16px;
    border-top: 1px solid #eef1f5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
/* ===== Session countdown footer layout ===== */
.sf-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 8px;
}

.sf-footer-left, .sf-footer-right {
    min-width: 220px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    color: #6b7280;
}

.sf-footer-center {
    flex: 1 1 auto;
    text-align: center;
    color: #6b7280;
}

.sf-session-counter {
    font-weight: 800;
    color: #111827;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(15,23,42,.10);
    background: rgba(255,255,255,.7);
}

@media (max-width: 768px) {
    .sf-footer-inner {
        flex-wrap: wrap;
    }

    .sf-footer-left, .sf-footer-right {
        min-width: auto;
    }

    .sf-footer-center {
        width: 100%;
        text-align: left;
    }
}

