:root {
    --primary-color: #1a4d2e;
    --primary-dark: #143d24;
    --teacher-color: #0b694a;
    --secondary-color: #f1f4f6;
    --text-color: #333333;
    --border-color: #e2e8f0;
    --link-color: #2563eb;
    --btn-blue: #2563eb;
    --btn-blue-hover: #1d4ed8;
    --child-bg: #f8fafc;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body, html {
    width: 100%;
    background-color: #fdfdfd;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-color);
    font-size: 15px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* ================= KHU VỰC ĐĂNG NHẬP ================= */
.login-wrapper {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(26, 77, 46, 0.1);
    border: 1.5px solid #d1fae5;
    padding: 35px 30px;
}

.login-icon-box {
    width: 55px;
    height: 55px;
    background: #e8f5ec;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin: 0 auto 15px auto;
    border: 1px solid #bbf7d0;
}

.login-title {
    font-size: 21px;
    font-weight: 700;
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-sub {
    font-size: 13.5px;
    text-align: center;
    color: #4b6354;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 18px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1e3a29;
    margin-bottom: 6px;
}

.form-group input, 
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background-color: #ffffff;
}

.form-group input:focus, 
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 77, 46, 0.15);
}

.login-error {
    color: #dc2626;
    font-size: 13px;
    text-align: center;
    margin-bottom: 15px;
    min-height: 18px;
    font-weight: 500;
}

#btnLoginSubmit {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    transition: 0.2s;
}

#btnLoginSubmit:hover {
    background-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(26, 77, 46, 0.25);
}

/* ================= BẬT/TẮT MẮT XEM PASS & VALIDATION ================= */
.password-wrapper {
    position: relative;
    width: 100%;
}

.password-wrapper input {
    padding-right: 42px !important;
}

.btn-toggle-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    transition: color 0.2s;
    z-index: 5;
}

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

.btn-toggle-eye .fa-eye-slash {
    display: none;
}

.btn-toggle-eye.is-showing .fa-eye {
    display: none;
}

.btn-toggle-eye.is-showing .fa-eye-slash {
    display: inline-block;
}

.field-warn-msg {
    font-size: 11.5px;
    color: #dc2626;
    margin-top: 4px;
    display: none;
    font-weight: 500;
}

.field-warn-msg.is-success {
    color: #059669;
}

.input-error-border {
    border-color: #dc2626 !important;
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15) !important;
}

.input-success-border {
    border-color: #059669 !important;
}

/* ================= GIAO DIỆN QUẢN TRỊ ADMIN ================= */
.admin-wrapper {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-card {
    max-width: 600px;
    width: 100%;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1.5px solid #d1fae5;
    padding: 30px;
}

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

.admin-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
}

.admin-badge {
    font-size: 12.5px;
    color: #065f46;
    margin-top: 4px;
    font-weight: 600;
}

.admin-form-heading {
    font-size: 13.5px;
    font-weight: 700;
    color: #1e3a29;
    text-transform: uppercase;
    margin-bottom: 15px;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 7px;
}

.admin-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 600px) {
    .admin-grid-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ================= TOP NAVBAR (NGƯỜI DÙNG) ================= */
.top-navbar {
    max-width: 1200px;
    margin: 0 auto 25px auto;
    width: 100%;
    background-color: var(--secondary-color);
    padding: 0 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    min-height: 54px;
}

.user-brand-left {
    display: flex;
    align-items: center;
}

.user-name-tag {
    font-size: 14.5px;
    font-weight: 700;
    color: var(--primary-color);
    background: #e2ede6;
    padding: 8px 18px;
    border-radius: 12px;
    border: 1px solid #c2dbcd;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.nav-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
    align-items: center;
    gap: 0;
}

.nav-item-wrap {
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-item {
    text-decoration: none;
    color: #333333;
    padding: 17px 18px;
    font-weight: 500;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    border-bottom: 3.5px solid transparent;
    cursor: pointer;
}

.nav-item.active {
    font-weight: bold;
    color: #111827;
    background-color: #ffffff;
    border-bottom: 3.5px solid #000000;
}

.nav-item:hover {
    background-color: #e2e8f0;
}

.mobile-close-btn { 
    display: none; 
}

.mobile-menu-btn {
    display: none;
}

/* ================= NÚT GÓC DƯỚI BÊN PHẢI ================= */
.bottom-logout-corner {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-admin-corner {
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-admin-corner:hover {
    background: #f1f5f9;
    color: var(--primary-color);
    border-color: #94a3b8;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.btn-logout {
    background: #ffe4e6;
    color: #b91c1c;
    border: 1px solid #fecdd3;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-logout:hover {
    background: #fecdd3;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(185, 28, 28, 0.15);
}

/* ================= TIÊU ĐỀ & BỘ LỌC ================= */
.header-title {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 25px;
    font-size: 20px;
    text-transform: uppercase;
    font-weight: 700;
}

.filter-section {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    background: var(--secondary-color);
    padding: 14px 18px;
    border-radius: 8px;
    align-items: flex-end;
    flex-wrap: wrap;
    justify-content: space-between;
}

.filter-container-left {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    flex-wrap: wrap;
    flex: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 200px;
    flex: 1;
}

.filter-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 12.5px;
    text-transform: uppercase;
}

.filter-group select, 
.filter-group input {
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #cbd5e0;
    outline: none;
    font-size: 13.5px;
    background-color: #ffffff;
    font-family: inherit;
    width: 100%;
}

.filter-group select:focus, 
.filter-group input:focus {
    border-color: var(--primary-color);
}

/* ================= NÚT BẤM & BADGE ================= */
.btn {
    padding: 9px 20px;
    border-radius: 6px;
    border: none;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    font-size: 14px;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--btn-blue);
    color: #ffffff;
}

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

.btn-evidence {
    display: inline-block;
    padding: 4px 10px;
    background-color: #e0f2fe;
    color: var(--link-color);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 12.5px;
    border: 1px solid #bae6fd;
    white-space: nowrap;
}

.btn-evidence:hover {
    background-color: #bae6fd;
    color: #1d4ed8;
}

.badge-missing {
    display: inline-block;
    padding: 4px 10px;
    background-color: #fee2e2;
    color: #991b1b;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    border: 1px solid #fecaca;
    white-space: nowrap;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #34d399;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    white-space: nowrap;
}

.badge-pending {
    background-color: #f1f5f9;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    white-space: nowrap;
}

.source-badge {
    color: #d97706;
    font-size: 11px;
    font-weight: bold;
    background: #fef3c7;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid #fde68a;
    margin-right: 8px;
}

.person-tag {
    display: inline-block;
    padding: 4px 10px;
    background-color: #e2e8f0;
    color: var(--teacher-color);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin: 3px 0;
    border: 1px solid #cbd5e1;
}

.role-tag {
    display: inline-block;
    padding: 2px 6px;
    background-color: #f1f5f9;
    color: #64748b;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 6px;
    font-weight: normal;
    border: 1px solid #e2e8f0;
}

/* ================= BẢNG DỮ LIỆU ================= */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #ffffff;
    min-width: 900px;
}

thead {
    background-color: var(--primary-color);
    color: #ffffff;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
}

th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12.5px;
    text-align: center;
    white-space: nowrap;
}

tbody tr:hover {
    background-color: #f1f5f9;
}

tbody tr:nth-child(even) {
    background-color: #fbfbfb;
}

.empty-message {
    text-align: center;
    padding: 35px;
    color: #718096;
    font-style: italic;
}

#loading {
    text-align: center;
    padding: 30px;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 15px;
    display: none;
}

tr.master-row {
    background-color: #ffffff;
    cursor: pointer;
    font-weight: 600;
}

tr.child-row {
    background-color: var(--child-bg);
    display: none;
}

tr.child-row:hover {
    background-color: #edf2f7;
}

.btn-toggle {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 14px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
}

/* ================= TRANG CHỦ PORTAL ================= */
.portal-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

.portal-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portal-col-header {
    padding: 12px 16px;
    border-radius: 8px;
    color: #ffffff;
    font-weight: bold;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.bg-col-0 { background: #1a4d2e; } 
.bg-col-1 { background: #78281f; } 
.bg-col-2 { background: #B5782A; }

.portal-menu-block {
    display: flex;
    flex-direction: column;
}

.item-card {
    background: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1.5px solid #cbd5e1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    transition: 0.2s;
    cursor: pointer;
}

.item-card:hover {
    background-color: #f8fafc;
    border-color: #78281f;
}

.item-card h2 {
    margin: 0;
    font-weight: 600;
    color: #222222;
    font-size: 15px;
}

.sheet-dropdown {
    margin-top: -6px;
    margin-bottom: 5px;
    padding: 8px 16px;
    background: #ffffff;
    border-radius: 0 0 12px 12px;
    border: 1.5px solid #cbd5e1;
    border-top: none;
    display: none;
}

.sheet-dropdown a {
    display: block;
    text-decoration: none;
    color: #4a5568;
    padding: 7px 0;
    font-size: 13.5px;
    border-bottom: 1px solid #f1f4f6;
}

.sheet-dropdown a:hover {
    color: #3498db;
    padding-left: 6px;
}

/* ================= MODAL F2 ================= */
.f2-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    padding: 15px;
}

.f2-modal-box {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    padding: 25px;
    border-radius: 14px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
    position: relative;
    animation: modalIn 0.25s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.f2-modal-box.shake-anim {
    animation: shake 0.3s ease-in-out;
}

.f2-icon-lock {
    font-size: 32px;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 10px;
}

.f2-modal-title {
    font-size: 17px;
    font-weight: bold;
    color: #1e293b;
    text-align: center;
    margin-bottom: 4px;
}

.f2-modal-sub {
    font-size: 12.5px;
    color: #64748b;
    text-align: center;
    margin-bottom: 18px;
}

.f2-input-wrap {
    position: relative;
    margin-bottom: 12px;
}

.f2-error-msg {
    font-size: 12.5px;
    color: #dc2626;
    text-align: center;
    margin-bottom: 12px;
    min-height: 18px;
    font-weight: 500;
}

.f2-btn-group {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.f2-btn-cancel {
    background: #f1f5f9;
    color: #475569;
    border: none;
    padding: 9px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 13px;
}

.f2-btn-submit {
    background: var(--primary-color);
    color: #ffffff;
    border: none;
    padding: 9px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.f2-action-panel {
    display: none;
}

.btn-open-sheet-direct {
    width: 100%;
    padding: 12px;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 700;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
    transition: 0.2s;
}

.btn-open-sheet-direct:hover {
    background: var(--primary-dark);
}

.change-pass-box {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    background: #fafbfc;
}

.change-pass-title {
    font-size: 13px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.otp-flex {
    display: flex;
    gap: 8px;
}

.btn-get-otp {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.btn-get-otp:hover {
    background: #cbd5e1;
}

/* ================= DI ĐỘNG (< 768px) ================= */
@media (max-width: 768px) {
    body {
        padding: 0px;
        font-size: 13.5px;
    }

    .container {
        padding: 10px;
    }

    .admin-card {
        padding: 20px 15px;
    }

    .top-navbar {
        min-height: 48px;
        padding: 0 12px;
        justify-content: space-between;
        margin-bottom: 15px;
        border-radius: 0;
    }

    .user-brand-left {
        order: 1;
    }

    .user-name-tag {
        font-size: 12.5px;
        padding: 5px 12px;
    }

    .mobile-menu-btn {
        display: block;
        font-size: 24px;
        color: var(--primary-color);
        order: 2;
        cursor: pointer;
        padding: 4px;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -260px;
        left: auto;
        width: 240px;
        height: 100%;
        background-color: #ffffff;
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.12);
        z-index: 99999;
        flex-direction: column;
        padding-top: 50px;
        transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        align-items: flex-start;
    }

    .nav-menu.open {
        right: 0;
    }

    .mobile-close-btn {
        display: block;
        position: absolute;
        top: 12px;
        right: 15px;
        font-size: 22px;
        cursor: pointer;
        color: #475569;
    }

    .nav-item {
        padding: 12px 18px;
        font-size: 13.5px;
        border-bottom: none;
        width: 100%;
    }

    .nav-item.active {
        border-left: 4px solid var(--primary-color);
        background: #f1f5f9;
        color: var(--primary-color);
        border-bottom: none;
    }

    .bottom-logout-corner {
        bottom: 15px;
        right: 15px;
        gap: 8px;
    }

    .btn-admin-corner,
    .btn-logout {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 20px;
    }

    .filter-section, 
    .filter-container-left {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .filter-group {
        min-width: 100%;
    }

    .portal-container {
        flex-direction: column;
        gap: 12px;
    }

    th:nth-child(1), td:nth-child(1) {
        position: sticky;
        left: 0;
        z-index: 2;
        border-right: 1px solid #e2e8f0;
    }

    td:nth-child(1) {
        background-color: #ffffff;
    }

    tbody tr:nth-child(even) td:nth-child(1) {
        background-color: #fbfbfb;
    }

    th:nth-child(1) {
        background-color: var(--primary-color);
        color: #ffffff;
        border-right: none;
    }
}
