:root {
    --primary-color: #0056b3;
    --primary-light: #4d94ff;
    --secondary-color: #ffffff;
    --text-dark: #333333;
    --text-light: #666666;
    --bg-gradient: linear-gradient(135deg, #09285e 0%, #1754a6 100%);
    --card-bg: rgba(255, 255, 255, 0.95);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    padding-bottom: 60px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
    max-width: 600px;
}

h1 {
    color: #ffffff;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
    color: #e0e0e0;
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.page-title {
    background: #ffc107;
    color: #000;
    display: inline-block;
    padding: 5px 20px;
    border-radius: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.step {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.3rem;
    color: var(--text-dark);
}

/* Button Grids */
.btn-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    padding: 5px;
    max-width: 210px; /* Constrict grid width further for smaller icon sizes (approx 95px squares) */
    margin: 0 auto;
}

.btn {
    background: white;
    border: 2px solid var(--primary-light);
    color: var(--primary-color);
    padding: 15px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-align: center;
}

.btn:hover, .btn.selected {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 86, 179, 0.3);
}

/* App-like Square Buttons specifically for the selection grids */
.btn-grid .btn {
    width: calc(50% - 8px); /* 2 columns with 15px gap */
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px; /* Slightly round, app-like */
    font-size: 1.3rem; /* Scaled down text */
    font-weight: 800;
    border: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
}

.btn-grid .btn:hover, .btn-grid .btn.selected {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 6px 14px rgba(0, 86, 179, 0.4);
    transform: scale(1.02);
}

/* Vertical Stacking for Streams */
.btn-grid.stream-grid {
    flex-direction: column;
    max-width: 250px;
}

.btn-grid.stream-grid .btn {
    width: 100%;
    aspect-ratio: auto;
    padding: 20px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 100%;
    padding: 18px;
    margin-top: 25px;
    font-size: 1.2rem;
    border-radius: 30px;
}

.btn-primary:hover {
    background: #004494;
}

/* Datesheet Results */
.month-group {
    margin-bottom: 25px;
}

.month-title {
    font-size: 1.2rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.exam-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 15px;
    background: white;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border-left: 4px solid var(--primary-color);
}

.exam-subject {
    font-weight: 600;
}

.exam-date {
    color: var(--text-light);
    font-weight: 500;
}

.no-data {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
    font-size: 1.1rem;
    font-style: italic;
}

.back-btn {
    display: block;
    text-align: center;
    margin-top: 20px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.back-btn:hover {
    text-decoration: underline;
}

/* Admin Styles */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.badge {
    background: var(--primary-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: var(--primary-light);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
}

.btn-edit {
    background: #ffc107;
    color: #000;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

/* Loading */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Custom Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.active {
    display: flex;
}
.modal-box {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-box h3 {
    margin-bottom: 15px;
    color: var(--text-dark);
}
.modal-box p {
    color: var(--text-light);
    margin-bottom: 20px;
}
.modal-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}
.modal-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.btn-cancel {
    background: #e0e0e0;
    color: #333;
}
.btn-confirm {
    background: #dc3545;
    color: white;
}
