/* index.html */
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/plusjakartasans/PlusJakartaSans-Regular.ttf") format('truetype');
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/plusjakartasans/PlusJakartaSans-SemiBold.ttf") format('truetype');
}
@font-face {
    font-family: 'Plus Jakarta Sans';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("/fonts/plusjakartasans/PlusJakartaSans-Bold.ttf") format('truetype');
}

/* Reset & Global Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f8f9fa;
    color: #212529;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 16px;
    -webkit-tap-highlight-color: transparent; /* Removes flash on mobile tap */
}

/* Header Component */
.main-header {
    text-align: center;
    padding: 24px 16px;
    margin-bottom: 20px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.banner-badge {
    display: inline-block;
    background-color: #e63946;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.main-header h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: #1d3557;
    line-height: 1.2;
    margin-bottom: 8px;
}

.main-header .subtitle {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Menu Container Layout */
.menu-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-grow: 1;
}

/* Menu Card Components */
.menu-card {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 16px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

/* Mobile Touch Feedback */
.menu-card:active {
    transform: scale(0.98);
}

/* Theme Variation: Red Card */
.card-red {
    background-color: #e63946;
    color: #ffffff;
}
.card-red h2 { color: #ffffff; }
.card-red p { color: rgba(255, 255, 255, 0.85); }
.card-red .card-arrow { color: rgba(255, 255, 255, 0.6); }

/* Theme Variation: White Card */
.card-white {
    background-color: #ffffff;
    color: #212529;
    border: 2px solid #f1f3f5;
}
.card-white h2 { color: #1d3557; }
.card-white p { color: #6c757d; }
.card-white .card-arrow { color: #adb5bd; }

/* Inner Card Structure */
.card-icon {
    font-size: 2.2rem;
    margin-right: 16px;
    min-width: 45px;
    text-align: center;
}

.card-content {
    flex-grow: 1;
}

.card-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.card-content p {
    font-size: 0.85rem;
    line-height: 1.4;
}

.card-arrow {
    font-size: 1.2rem;
    font-weight: 600;
    margin-left: 8px;
}

/* Footer Component */
.main-footer {
    text-align: center;
    padding: 24px 12px 8px 12px;
    font-size: 0.75rem;
    color: #adb5bd;
}

/* Responsive Enhancements for Desktop/Tablets */
@media (min-width: 768px) {
    body {
        padding: 40px;
        max-width: 500px;
        margin: 0 auto; /* Keeps the application styled like a native mobile app view on big screens */
    }
}

/* attendance.html */

/* Back Button Style */
.back-link {
    display: inline-block;
    color: #e63946;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    float: left;
}

/* Form Layout Styles */
.form-container {
    background: #ffffff;
    padding: 24px 20px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1d3557;
    margin-bottom: 8px;
}

/* Modern App Inputs and Dropdowns */
.form-group select,
.form-group input {
    font-family: inherit;
    font-size: 1rem;
    padding: 12px;
    border: 2px solid #f1f3f5;
    border-radius: 10px;
    background-color: #f8f9fa;
    color: #212529;
    outline: none;
    transition: border-color 0.2s;
}

.form-group select:focus,
.form-group input:focus {
    border-color: #e63946;
}

.form-group select:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

/* Admin Verification Section Context styling */
.admin-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 2px dashed #f1f3f5;
}

.help-text {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 6px;
    line-height: 1.3;
}

/* Red Submission Button Action component */
.btn-submit {
    font-family: inherit;
    width: 100%;
    padding: 14px;
    background-color: #e63946;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(230, 57, 70, 0.2);
}

.btn-submit:active {
    transform: scale(0.99);
}

/* Dynamic error message alert bar */
.alert-box {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
}

.success-box {
    background-color: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: center;
}

.scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffffee;
    z-index: 9999;
    display: none; /* Controlled via JS toggles */
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 24px 16px;
    box-sizing: border-box;
}

.camera-box-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 1 / 1;
    background-color: #000000;
    border-radius: 20px;
    overflow: hidden;
    border: 4px solid #ffffff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    position: relative;
}

#reader {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

#reader th, #reader button { display: none !important; }

.btn-close-camera {
    font-family: inherit;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid #e63946;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}

.btn-close-camera:active {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Container Box for Table Elements */
.table-card-container {
    background: #ffffff;
    padding: 20px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.table-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 0 4px;
}

.table-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1d3557;
}

.live-indicator {
    font-size: 0.75rem;
    font-weight: 800;
    color: #e63946;
    letter-spacing: 0.5px;
    animation: blink 1.5s infinite ease-in-out;
}

/* RESPONSIVE BARRIER INTERCEPTOR */
.responsive-table-wrapper {
    width: 100%;
    overflow-x: auto; /* Forces graceful horizontal swipe on phone viewports */
    -webkit-overflow-scrolling: touch; /* Smooth inertia scrolling for iOS devices */
    border-radius: 10px;
    border: 1px solid #f1f3f5;
}

/* Core Table Element styling rules */
.patriotic-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
    white-space: nowrap; /* Prevents text from ugly mid-sentence breaking on small width slots */
}

/* Table Header Styles */
.patriotic-table th {
    background-color: #f8f9fa;
    color: #1d3557;
    font-weight: 700;
    padding: 14px 12px;
    border-bottom: 2px solid #e9ecef;
}

/* Table Body Row Cells Styles */
.patriotic-table td {
    padding: 14px 12px;
    border-bottom: 1px solid #f1f3f5;
    color: #212529;
    vertical-align: middle;
}

/* Zebra Striping Alternative rows for modern contrast layout */
.patriotic-table tbody tr:nth-of-type(even) {
    background-color: #fafbfc;
}

/* Interactive Highlight State on Mobile Click/Hover */
.patriotic-table tbody tr:active {
    background-color: #f1f3f5;
}

/* Special Podium Style Highlights for Top 3 Ranks */
.rank-cell {
    font-weight: 600;
    color: #6c757d;
}
.rank-first { background-color: rgba(255, 215, 0, 0.05) !important; } /* Soft Gold tint */
.rank-first .rank-cell { color: #b8860b; font-weight: 700; }

.rank-second { background-color: rgba(192, 192, 192, 0.05) !important; } /* Soft Silver tint */
.rank-second .rank-cell { color: #708090; font-weight: 700; }

.rank-third { background-color: rgba(205, 127, 50, 0.05) !important; } /* Soft Bronze tint */
.rank-third .rank-cell { color: #8b4513; font-weight: 700; }

/* Score emphasis column styling rules */
.points-cell {
    text-align: right;
    font-weight: 700;
    color: #1d3557;
}

/* Blinking animation logic for the Live Indicator */
@keyframes blink {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* 1. Spinner Elements inside Admin Section */
.admin-section {
    position: relative; /* Anchor for loading overlay if needed later */
}

/* Base loading spinner layout */
.admin-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(230, 57, 70, 0.2); /* Light red tint background */
    border-radius: 50%;
    border-top-color: #e63946; /* Solid red leading edge */
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 8px; /* Gap when placed next to label or input text */
}

/* Spinner Animation Keyframe */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 2. Unique Code Pills Container Component */
.pills-container {
    display: flex;
    flex-wrap: wrap; /* Automatically wraps items onto next row on mobile layout */
    gap: 8px; /* Clean gap space between code blocks */
    margin-top: 12px;
    padding: 12px;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    max-height: 180px; /* Restricts excessive vertical growth */
    overflow-y: auto; /* Adds clean scrollbar if handling > 20 pills */
}

/* Individual Pill Component Styling */
.code-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    color: #1d3557; /* Deep Navy text */
    font-family: 'Courier New', Courier, monospace; /* Monospace keeps 4 digits exactly aligned */
    font-size: 0.9rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 50px; /* Force curved capsule appearance */
    border: 1.5px solid #f1f3f5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    user-select: all; /* Allows quick double-tap copy-paste action on smartphones */
    transition: all 0.2s ease;
}

/* Active touch states for mobile users */
.code-pill:active {
    background-color: #e63946;
    color: #ffffff;
    border-color: #e63946;
    transform: scale(0.95);
}

/* Alternative Flag Variant: Used/Claimed Code Layout Tint */
.code-pill.claimed {
    background-color: #e9ecef;
    color: #adb5bd;
    border-color: #e9ecef;
    text-decoration: line-through; /* Striking look for used items */
    cursor: not-allowed;
}