/* ============================================================
   COMMISSION PORTAL — STYLESHEET
   ============================================================ */

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Segoe UI', Arial, sans-serif; font-size: 1rem; color: #2d2d2d; background-color: #f4f6f9; min-height: 100vh; }
a { color: #1E3A5F; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1 { font-size: 1.8rem; font-weight: 700; color: #1E3A5F; }
h2 { font-size: 1.4rem; font-weight: 600; color: #1E3A5F; }
h3 { font-size: 1.1rem; font-weight: 600; color: #1E3A5F; }
.text-muted { color: #6c757d; font-size: 0.9rem; }

/* ── NAVBAR ─────────────────────────────────────────────────── */
.navbar { background-color: #1E3A5F; padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 60px; box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.navbar-brand { color: #ffffff; font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px; }
.navbar-menu { display: flex; align-items: center; gap: 1.5rem; }
.navbar-menu a { color: #c8d8ea; font-size: 0.9rem; text-decoration: none; transition: color 0.2s; }
.navbar-menu a:hover { color: #ffffff; text-decoration: none; }
.btn-logout { background-color: #e74c3c; color: #ffffff !important; padding: 0.35rem 0.9rem; border-radius: 4px; font-size: 0.85rem !important; transition: background-color 0.2s; }
.btn-logout:hover { background-color: #c0392b; }

/* ── MAIN CONTENT ───────────────────────────────────────────── */
.main-content { max-width: 1200px; margin: 2rem auto; padding: 0 1.5rem; }
.page-header { margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 2px solid #e0e7ef; }
.page-header h2 { margin-bottom: 0.25rem; }

/* ── FOOTER ─────────────────────────────────────────────────── */
.footer { text-align: center; padding: 1.5rem; font-size: 0.85rem; color: #999; border-top: 1px solid #e0e7ef; margin-top: 3rem; }

/* ── LOGIN PAGE ─────────────────────────────────────────────── */
.login-page { display: flex; flex-direction: column; align-items: center; justify-content: center; background-color: #f4f6f9; }
.login-container { width: 100%; max-width: 420px; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; }
.login-box { width: 100%; background: #ffffff; border-radius: 8px; box-shadow: 0 4px 16px rgba(30,58,95,0.10); padding: 2.5rem 2rem; }
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h1 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.login-header p { color: #6c757d; font-size: 0.9rem; }
.login-footer { margin-top: 1.5rem; font-size: 0.8rem; color: #999; }

/* ── FORMS ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.2rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 600; color: #444; margin-bottom: 0.4rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 0.6rem 0.85rem; border: 1px solid #ccd6e0; border-radius: 4px; font-size: 0.95rem; color: #2d2d2d; background-color: #fff; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #2E75B6; box-shadow: 0 0 0 3px rgba(46,117,182,0.12); }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn { display: inline-block; padding: 0.6rem 1.2rem; border: none; border-radius: 4px; font-size: 0.95rem; font-weight: 600; cursor: pointer; text-align: center; transition: background-color 0.2s; text-decoration: none; }
.btn-primary { background-color: #1E3A5F; color: #ffffff; }
.btn-primary:hover { background-color: #2E75B6; color: #ffffff; text-decoration: none; }
.btn:hover, .btn:focus { text-decoration: none !important; }
a.btn:hover, a.btn:focus { text-decoration: none !important; }
.btn-secondary { background-color: #6c757d; color: #ffffff; }
.btn-secondary:hover { background-color: #5a6268; }
.btn-danger { background-color: #e74c3c; color: #ffffff; }
.btn-danger:hover { background-color: #c0392b; }
.btn-full { width: 100%; padding: 0.75rem; }

/* ── ALERTS ─────────────────────────────────────────────────── */
.alert { padding: 0.85rem 1rem; border-radius: 4px; font-size: 0.9rem; margin-bottom: 1.2rem; }
.alert-error   { background-color: #fde8e8; border: 1px solid #f5c6c6; color: #c0392b; }
.alert-success { background-color: #e8f5ee; border: 1px solid #b8dfc9; color: #1a6b3c; }
.alert-warning { background-color: #fff8e6; border: 1px solid #f0d080; color: #856404; }
.alert-info    { background-color: #e8f0fb; border: 1px solid #b6cef2; color: #1E3A5F; }

/* ── DASHBOARD CARDS ────────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.dashboard-card { background: #ffffff; border: 1px solid #e0e7ef; border-radius: 8px; padding: 1.5rem; text-decoration: none; transition: box-shadow 0.2s, border-color 0.2s; display: block; }
.dashboard-card:hover { box-shadow: 0 4px 12px rgba(30,58,95,0.12); border-color: #2E75B6; text-decoration: none; }
.dashboard-card .card-title { font-size: 1rem; font-weight: 700; color: #1E3A5F; margin-bottom: 0.4rem; }
.dashboard-card .card-desc  { font-size: 0.85rem; color: #6c757d; }

/* ── TABLES ─────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: #ffffff; }
table th { background-color: #1E3A5F; color: #ffffff; padding: 0.75rem 1rem; text-align: left; font-weight: 600; white-space: nowrap; }
table td { padding: 0.7rem 1rem; border-bottom: 1px solid #e0e7ef; color: #2d2d2d; vertical-align: middle; }
table tr:nth-child(even) td { background-color: #f4f6f9; }
table tr:hover td { background-color: #e8f0fb; }

/* ── BADGES ─────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 0.25rem 0.6rem; border-radius: 12px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-success  { background-color: #e8f5ee; color: #1a6b3c; }
.badge-warning  { background-color: #fff8e6; color: #856404; }
.badge-danger   { background-color: #fde8e8; color: #c0392b; }
.badge-info     { background-color: #e8f0fb; color: #1E3A5F; }
.badge-neutral  { background-color: #f0f0f0; color: #555; }
.badge-pending  { background-color: #fff3e0; color: #e65c00; font-style: normal; }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar { padding: 0.75rem 1rem; flex-wrap: wrap; height: auto; gap: 0.5rem; }
    .navbar-menu { gap: 1rem; flex-wrap: wrap; }
    .main-content { padding: 0 1rem; margin: 1.25rem auto; }
    .login-box { padding: 1.75rem 1.25rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: #ffffff; border: 1px solid #e0e7ef; border-radius: 8px; padding: 1.25rem 1.5rem; display: flex; flex-direction: column; }
.stat-card--highlight { border-color: #2E75B6; background: #e8f0fb; }
.stat-label { font-size: 0.8rem; font-weight: 600; color: #6c757d; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.5rem; min-height: 2.4rem; display: flex; align-items: flex-start; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: #1E3A5F; margin-top: auto; }
.stat-card--highlight .stat-value { color: #2E75B6; }

/* ── SECTION BLOCKS ──────────────────────────────────────────── */
.section-block { background: #ffffff; border: 1px solid #e0e7ef; border-radius: 8px; padding: 1.5rem; margin-bottom: 1.5rem; }
.section-block h3 { margin-bottom: 1rem; }
.section-block-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.section-block-header h3 { margin-bottom: 0; }

/* ── TABLE FOOTER ────────────────────────────────────────────── */
table tfoot td { background-color: #f4f6f9; border-top: 2px solid #1E3A5F; padding: 0.75rem 1rem; }

/* ── EMPTY STATE ─────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: #6c757d; }
.empty-state p { margin-bottom: 1rem; }

/* ── SMALL BUTTON ────────────────────────────────────────────── */
.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.85rem; }

/* ── RESPONSIVE STAT GRID ────────────────────────────────────── */
@media (max-width: 768px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .section-block { padding: 1rem; }
}

/* ── ACTION BAR ──────────────────────────────────────────────── */
.action-bar { display: flex; gap: 0.75rem; margin-bottom: 1.25rem; }

/* ── FILTER FORM ─────────────────────────────────────────────── */
.filter-form .filter-row { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; }
.filter-form .form-group { margin-bottom: 0; min-width: 160px; flex: 1; }
.filter-actions { display: flex; gap: 0.5rem; align-items: flex-end; padding-bottom: 0; }

/* ── RECORD COUNT ────────────────────────────────────────────── */
.record-count { font-size: 0.85rem; font-weight: 400; color: #6c757d; margin-left: 0.5rem; }

/* ── DATE SUB-TEXT IN TABLE ──────────────────────────────────── */
.date-sub { font-size: 0.75rem; color: #999; margin-top: 2px; text-align: center; }

/* ── FORM CARD ───────────────────────────────────────────────── */
.form-card { max-width: 520px; }
.form-info { background: #f4f6f9; border-radius: 4px; padding: 0.85rem 1rem; margin-bottom: 1.25rem; font-size: 0.9rem; color: #555; }
.form-info p { margin-bottom: 0.25rem; }
.form-info p:last-child { margin-bottom: 0; }
.form-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }
.required { color: #e74c3c; }

/* ── DETAIL PAGE GRID ────────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1.25rem; align-items: start; }
.detail-left, .detail-right { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── DETAIL TABLE (inside section blocks) ────────────────────── */
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th { width: 38%; padding: 0.55rem 0.75rem 0.55rem 0; font-weight: 600; color: #555; font-size: 0.875rem; vertical-align: top; border-bottom: 1px solid #f0f0f0; background-color: transparent !important; white-space: normal; }
.detail-table td { padding: 0.55rem 0; font-size: 0.9rem; color: #2d2d2d; border-bottom: 1px solid #f0f0f0; background-color: transparent !important; }
.detail-table tr:last-child th, .detail-table tr:last-child td { border-bottom: none; }

/* ── STAGE BLOCK ─────────────────────────────────────────────── */
.stage-block .stage-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.85rem; }
.stage-block .stage-header h3 { margin-bottom: 0; }

/* ── RESPONSIVE DETAIL GRID ──────────────────────────────────── */
@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
    .filter-form .filter-row { flex-direction: column; }
    .filter-form .form-group { min-width: 100%; }
}

/* ── STAGE MARK FORM ──────────────────────────────────────────── */
.mark-form { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px dashed #ccd6e0; }
.mark-form h4 { font-size: 0.95rem; font-weight: 600; color: #1E3A5F; margin-bottom: 0.85rem; }
.mark-form .form-group { margin-bottom: 0.85rem; }
.mark-form .form-actions { margin-top: 0.85rem; }

/* ── COMMISSION NOTE ──────────────────────────────────────────── */
.commission-note { font-size: 0.85rem; color: #1a6b3c; background: #e8f5ee; border-radius: 4px; padding: 0.5rem 0.75rem; margin-bottom: 0.75rem; }

/* ── LOCKED NOTE ─────────────────────────────────────────────── */
.locked-note { font-size: 0.82rem; color: #6c757d; margin-top: 0.75rem; font-style: italic; }

/* ── STAGE NOTE ──────────────────────────────────────────────── */
.stage-note { font-size: 0.82rem; color: #2E75B6; margin-top: 0.4rem; }

/* ── PAGE HEADER WITH BACK BUTTON ────────────────────────────── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 2rem; padding-bottom: 1rem; border-bottom: 2px solid #e0e7ef; }
.page-header > div h2 { margin-bottom: 0.25rem; }

/* ── COMMISSION INFO BOX ─────────────────────────────────────── */
.commission-info-box { background: #f4f6f9; border-left: 3px solid #2E75B6; border-radius: 0 4px 4px 0; padding: 0.75rem 1rem; margin-bottom: 0.85rem; font-size: 0.875rem; color: #444; }
.commission-info-box p { margin-bottom: 0.35rem; }
.commission-info-box p:last-child { margin-bottom: 0; }

/* ── REPORT TABS ─────────────────────────────────────────────── */
.report-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.25rem; }
.report-tab { padding: 0.5rem 1rem; border-radius: 4px; font-size: 0.875rem; font-weight: 600; color: #444; background: #ffffff; border: 1px solid #d0d9e4; text-decoration: none; transition: all 0.2s; }
.report-tab:hover { background: #e8f0fb; border-color: #2E75B6; color: #1E3A5F; text-decoration: none; }
.report-tab.active { background: #1E3A5F; border-color: #1E3A5F; color: #ffffff; }

/* ── RESPONSIVE REPORT TABS ──────────────────────────────────── */
@media (max-width: 768px) {
    .report-tabs { flex-direction: column; }
    .report-tab  { text-align: center; }
}

/* ── ZERO-VALUE ROWS ─────────────────────────────────────────── */
.row-zero td { color: #aaa; }

/* ── PRINT STYLES ────────────────────────────────────────────── */
@media print {
    .no-print, .navbar, .footer, .btn, .report-tabs, .filter-form { display: none !important; }
    body { background: #fff; font-size: 12px; }
    .main-content { margin: 0; padding: 0; max-width: 100%; }
    .section-block { box-shadow: none; border: 1px solid #ccc; margin-bottom: 1rem; page-break-inside: avoid; }
    .stat-grid { grid-template-columns: repeat(3, 1fr); }
    table th { background-color: #1E3A5F !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .page-header { border-bottom: 2px solid #1E3A5F; margin-bottom: 1rem; }
}

/* ── INACTIVE USER ROWS ───────────────────────────────────────── */
.row-inactive td { color: #aaa; background-color: #fafafa; }
.row-inactive strong { color: #aaa; font-weight: 500; }

/* ── CLICKABLE STAT CARD ──────────────────────────────────────── */
.stat-card--link { text-decoration: none; cursor: pointer; transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s; }
.stat-card--link:hover { background-color: #e8f5ee; border-color: #1a6b3c; box-shadow: 0 4px 12px rgba(26,107,60,0.15); text-decoration: none; }
.stat-card--link:hover .stat-label { color: #1a6b3c; }
.stat-card--link:hover .stat-value { color: #1a6b3c; }
.stat-card--link:hover .stat-hint  { color: #1a6b3c; }
.stat-card--link .stat-value { color: #1E3A5F; }
.stat-hint { font-size: 0.75rem; color: #2E75B6; margin-top: 0.4rem; }

/* ── FILTER ACTIVE NOTE ──────────────────────────────────────── */
.filter-active-note { margin-top: 0.75rem; margin-bottom: 0; font-size: 0.875rem; color: #1E3A5F; background: #e8f0fb; border-radius: 4px; padding: 0.5rem 0.85rem; display: inline-block; }

/* ── RECENT LABEL ────────────────────────────────────────────── */
.recent-label { font-size: 0.78rem; color: #2E75B6; font-weight: 400; background: #e8f0fb; padding: 0.25rem 0.6rem; border-radius: 10px; margin-left: 0.5rem; white-space: nowrap; }

/* ── 3-COLUMN STAT GRID ──────────────────────────────────────── */
.stat-grid--3col { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 768px) {
    .stat-grid--3col { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stat-grid--3col { grid-template-columns: 1fr; }
}

/* ── ATTENDANCE TABLE ────────────────────────────────────────── */
.attendance-table td { vertical-align: middle; }
.attendance-table input[type="radio"] { width: 18px; height: 18px; cursor: pointer; accent-color: #1E3A5F; }
.attendance-table tr:hover td { background-color: #e8f0fb; }

/* ── ATTENDANCE SUBMIT BAR ───────────────────────────────────── */
.attendance-submit-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 1.5rem; padding-top: 1.25rem; padding-bottom: 0.5rem; border-top: 1px solid #e0e7ef; flex-wrap: wrap; gap: 0.75rem; }
.attendance-submit-bar p { margin: 0.75rem 0; }

/* ── ATTEMPT BLOCK ───────────────────────────────────────────── */
.attempt-block { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px dashed #e0e7ef; }
.attempt-block:last-of-type { border-bottom: none; }
.attempt-label { font-size: 0.875rem; font-weight: 600; color: #1E3A5F; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.5rem; }

/* ── RADIO GROUP ─────────────────────────────────────────────── */
.radio-group { display: flex; gap: 1.5rem; margin-top: 0.4rem; }
.radio-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: #2d2d2d; cursor: pointer; }
.radio-label input[type="radio"] { width: 18px; height: 18px; accent-color: #1E3A5F; cursor: pointer; }

/* ── BADGE CELL ALIGNMENT ────────────────────────────────────── */
/* Center badges inside table cells */
table td > .badge { display: block; width: fit-content; margin: 0 auto; }
table td > .badge + .date-sub { text-align: center; }

/* ── EXPORT BUTTON ───────────────────────────────────────────── */
.btn-export { background-color: #1a6b3c; color: #ffffff; padding: 0.6rem 1.2rem; border-radius: 4px; font-size: 0.95rem; font-weight: 600; text-decoration: none; display: inline-block; transition: background-color 0.2s; }
.btn-export:hover { background-color: #145530; color: #ffffff; text-decoration: none; }

/* ── LEFT-ALIGN BADGES (consultant commission page only) ─────── */
.table-left-badges td > .badge { margin: 0; display: inline-block; }

/* ── EXIT BADGE ──────────────────────────────────────────────── */
.badge-exit { background-color: #e8e8e8; color: #444444; font-weight: 700; }

/* ── STAT CARD COUNT ─────────────────────────────────────────── */
.stat-count { font-size: 0.78rem; color: #888; margin-top: 0.3rem; }
