
/* School Theme Styles - Professional and User Friendly */
body {
    background: #fffef6;
    font-family: 'Segoe UI', 'Arial', sans-serif;
    margin: 0;
    color: #8c6c00;
}

.container, .main.container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px #ffe680;
    margin: 32px auto;
    padding: 32px 24px;
    max-width: 900px;
}

.navbar, .sidebar {
    background: linear-gradient(90deg, #f0b400 80%, #ffe680 100%);
    color: #fff;
    font-weight: bold;
    border-radius: 0 20px 20px 0;
    box-shadow: 0 2px 8px #ffe680;
}

.navbar a, .sidebar a {
    color: #fff;
    text-decoration: none;
    padding: 14px 24px;
    display: block;
    border-left: 5px solid transparent;
    transition: background 0.2s, border 0.2s;
    font-size: 1.1em;
}
.navbar a.active, .sidebar a.active, .navbar a:hover, .sidebar a:hover {
    background: #d99e00;
    border-left: 5px solid #ffe680;
}

h1, h2, h3 {
    color: #f0b400;
    margin-top: 0;
}

input, select, button, textarea {
    font-size: 1em;
    border-radius: 6px;
    border: 1px solid #ffe680;
    padding: 8px 12px;
    margin-bottom: 8px;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: #f0b400;
    box-shadow: 0 0 4px #f0b400;
}
button {
    background: #f0b400;
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: bold;
    padding: 8px 20px;
    transition: background 0.2s;
}
button:hover {
    background: #d99e00;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 24px;
}
th, td {
    border: 1px solid #ffe680;
    padding: 10px 14px;
    text-align: left;
}
th {
    background: #fffde6;
    color: #f0b400;
}
tr:nth-child(even) {
    background: #fffef8;
}

.form-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px #ffe680;
    padding: 32px 24px;
    max-width: 400px;
    margin: 40px auto;
}
.form-box h2 {
    text-align: center;
    margin-bottom: 24px;
}
.form-box label {
    display: block;
    margin-bottom: 6px;
    color: #f0b400;
    font-weight: 500;
}
.form-box input, .form-box select, .form-box button {
    width: 100%;
    margin-bottom: 16px;
}
.form-box .actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.form-box .actions a {
    color: #f0b400;
    text-decoration: underline;
    font-size: 0.95em;
}
.success {
    color: #8c6c00;
    background: #fffde6;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    text-align: center;
}
.error {
    color: #b00;
    background: #ffeaea;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 16px;
    text-align: center;
}
.dashboard-cards {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}
.dashboard-card {
    background: #fffde6;
    padding: 20px;
    border-radius: 10px;
    min-width: 150px;
    text-align: center;
    flex: 1;
    box-shadow: 0 2px 8px #ffe680;
}
.dashboard-card h3 {
    margin-bottom: 10px;
}
.dashboard-card .stat {
    font-size: 2em;
    font-weight: bold;
}
.dashboard-card.absent {
    background: #ffeaea;
    color: #b00;
}
.dashboard-card.present {
    background: #fff9cc;
    color: #f0b400;
}
.dashboard-card.late {
    background: #fffbe6;
    color: #e6a800;
}
.dashboard-card.excuse {
    background: #fffde6;
    color: #f0b400;
}
.dashboard-card.morning-half {
    background: #fff4e6;
    color: #ff8c00;
}
.dashboard-card.afternoon-half {
    background: #f0f0ff;
    color: #6666ff;
}
.qr-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px #ffe680;
    padding: 32px 24px;
    max-width: 400px;
    margin: 40px auto;
    text-align: center;
}
.qr-box img {
    max-width: 200px;
    margin-bottom: 16px;
}
.sidebar {
    min-width: 210px;
}
.sidebar a {
    font-size: 1.1em;
}

/* =========================================================
   Unified Green Theme (aligned with index.php look & feel)
   ========================================================= */
:root {
    --primary: #196619;
    --primary-dark: #155a15;
    --primary-light: #2b8a2b;
    --accent: #b2e2b2;
    --bg-soft: linear-gradient(135deg, #d6f5d6 0%, #eaffea 100%);
    --text: #164a16;
    --shadow: rgba(25, 102, 25, 0.18);
}

body {
    background: var(--bg-soft);
    color: var(--text);
}

.container, .main.container, .form-box, .qr-box, .dashboard-card {
    box-shadow: 0 6px 24px var(--shadow);
    border: 1px solid #d8f2d8;
}

.navbar, .sidebar {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 2px 10px var(--shadow);
}

.navbar a, .sidebar a {
    border-left-color: transparent;
}
.navbar a.active, .sidebar a.active, .navbar a:hover, .sidebar a:hover {
    background: var(--primary-light);
    border-left-color: var(--accent);
}

h1, h2, h3 {
    color: var(--primary);
}

input, select, button, textarea {
    border: 1px solid #cceacc;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 6px rgba(25, 102, 25, 0.25);
}

button {
    background: var(--primary);
    color: #fff;
}
button:hover {
    background: var(--primary-dark);
}

table th, table td {
    border-color: #d8f2d8;
}
th {
    background: #f2fbf2;
    color: var(--primary);
}
tr:nth-child(even) {
    background: #f8fdf8;
}

.form-box label, .form-box .actions a {
    color: var(--primary);
}

.success {
    color: var(--primary-dark);
    background: #f2fbf2;
}

.dashboard-card {
    background: #f6fdf6;
    color: var(--primary-dark);
}
.dashboard-card.present,
.dashboard-card.late,
.dashboard-card.excuse,
.dashboard-card.morning-half,
.dashboard-card.afternoon-half {
    background: #eef9ee;
    color: var(--primary);
}
.dashboard-card.absent {
    background: #fff0f0;
    color: #b00000;
}

.qr-box img {
    filter: drop-shadow(0 4px 8px var(--shadow));
}
.sidebar a.logout {
    color: #ffeaea;
    font-weight: bold;
}
.clock {
    font-size: 1.1em;
    color: #d99e00;
    text-align: right;
    margin-bottom: 10px;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile First - Base styles for small screens */
@media screen and (max-width: 768px) {
    
    /* Body and container adjustments */
    body {
        font-size: 14px;
        padding: 0;
        margin: 0;
    }
    
    .container, .main.container {
        margin: 8px;
        padding: 16px 12px;
        border-radius: 12px;
        max-width: 100%;
        box-shadow: 0 2px 12px rgba(255, 230, 128, 0.3);
    }
    
    /* Navbar/Sidebar - Make it horizontal on mobile */
    .navbar, .sidebar {
        width: 100%;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1000;
        padding: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .sidebar a {
        padding: 12px 16px;
        font-size: 0.9em;
        border-left: none;
        border-bottom: 3px solid transparent;
    }
    
    .sidebar a.active, .sidebar a:hover {
        border-left: none;
        border-bottom: 3px solid #ffe680;
    }
    
    /* Add top padding to content to account for fixed navbar */
    body.teacher-dashboard,
    body.student-dashboard {
        padding-top: 60px;
    }
    
    /* Form elements - Make them full width */
    input, select, button, textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 12px;
    }
    
    button {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        margin-top: 8px;
    }
    
    /* Tables - Make them scrollable */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        width: 100%;
    }
    
    table thead {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    table tbody {
        display: table;
        width: 100%;
        table-layout: fixed;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.85em;
    }
    
    /* Headings */
    h1 {
        font-size: 1.5em;
        margin-bottom: 12px;
    }
    
    h2 {
        font-size: 1.3em;
        margin-bottom: 10px;
    }
    
    h3 {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
    
    /* Cards and panels */
    .card, .panel {
        margin-bottom: 16px;
        padding: 12px;
    }
    
    /* Dashboard stats cards - Stack vertically */
    .stats-container,
    .dashboard-stats {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .stat-card {
        width: 100%;
        margin: 0;
        padding: 16px;
    }
    
    /* QR Scanner adjustments */
    #qr-reader {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    #qr-reader video {
        width: 100% !important;
        height: auto !important;
    }
    
    /* Login/Signup forms */
    .login-container,
    .signup-container {
        margin: 16px;
        padding: 20px;
        max-width: 100%;
    }
    
    /* Student/Teacher List */
    .student-card,
    .teacher-card {
        margin-bottom: 12px;
        padding: 12px;
    }
    
    /* Navigation links */
    nav a {
        display: block;
        padding: 10px;
        margin: 4px 0;
    }
    
    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }
    
    /* Action buttons - Stack vertically on mobile */
    .action-buttons,
    .button-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons button,
    .button-group button {
        width: 100%;
        margin: 0;
    }
    
    /* Attendance records table */
    .attendance-table {
        font-size: 0.8em;
    }
    
    .attendance-table th,
    .attendance-table td {
        padding: 6px 4px;
    }
    
    /* Print SF2 button */
    .print-button {
        width: 100%;
        padding: 14px;
        margin: 12px 0;
    }
    
    /* Search boxes */
    .search-box {
        width: 100%;
        margin-bottom: 12px;
    }
    
    /* Modal adjustments */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 16px;
    }
    
    /* Review Center AI Chat */
    #reviewerOutput {
        font-size: 0.95em;
        padding: 12px;
        max-height: 400px;
        overflow-y: auto;
    }
    
    /* PDF Upload section */
    #uploadStatus {
        padding: 12px;
        font-size: 0.9em;
    }
}

/* Tablet adjustments (768px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .container, .main.container {
        margin: 16px;
        padding: 24px 20px;
        max-width: 95%;
    }
    
    .sidebar {
        width: 200px;
    }
    
    table {
        font-size: 0.95em;
    }
}

/* Landscape mobile adjustments */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .container, .main.container {
        margin: 8px;
        padding: 12px;
    }
    
    h1 {
        font-size: 1.3em;
    }
    
    .sidebar a {
        padding: 8px 12px;
        font-size: 0.85em;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    input, select, textarea {
        font-size: 16px; /* Prevent zoom on focus */
    }
    
    body {
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
}
