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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Login Page */
.login-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 400px;
    margin: 100px auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

/* Dashboard */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.navbar h1 {
    color: #667eea;
    font-size: 24px;
}

.dashboard-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 20px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    width: auto;
    padding: 10px 20px;
}

/* Messages */
.error-message,
.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
}

.error-message {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.message.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
    display: block;
}

.message.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
    display: block;
}

/* Records */
#recordsList {
    margin-top: 20px;
}

.record-item {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.record-date {
    font-weight: 600;
    color: #333;
}

.record-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.record-status.present {
    background: #d4edda;
    color: #155724;
}

.record-status.absent {
    background: #f8d7da;
    color: #721c24;
}

.record-status.late {
    background: #fff3cd;
    color: #856404;
}

.spinner {
    text-align: center;
    padding: 20px;
    color: #667eea;
}

/* Result boxes & pre */
.result-box {
    margin-top: 15px;
}

.result-box pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    max-height: 400px;
    overflow-y: auto;
}

/* Class detail card */
.class-detail h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.detail-grid div {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #555;
}

.detail-grid strong {
    color: #333;
}

/* Stats */
.stat-card {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
}

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

.stat-rate {
    font-size: 28px;
    font-weight: 700;
    border-radius: 8px;
    padding: 4px 12px;
}

.stat-good {
    color: #155724;
    background: #d4edda;
}

.stat-warn {
    color: #856404;
    background: #fff3cd;
}

.stat-bad {
    color: #721c24;
    background: #f8d7da;
}

.stat-numbers {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    margin-top: 2px;
}

.lesson-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.lesson-dot {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
}

.lesson-attended {
    background: #d4edda;
    color: #155724;
}

.lesson-missed {
    background: #f8d7da;
    color: #721c24;
}

.lesson-upcoming {
    background: #e2e3e5;
    color: #999;
}

/* QR scanning */
.qr-info {
    background: #f0f4ff;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    font-size: 14px;
}

.qr-info div {
    color: #555;
}

.qr-info strong {
    color: #333;
}

#qrReader {
    border-radius: 8px;
    overflow: hidden;
}

/* Upcoming lesson buttons in Check In */
.upcoming-btn {
    display: block;
    width: 100%;
    background: #f0f4ff;
    border: 2px solid #e0e0f0;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 8px;
    cursor: pointer;
    text-align: left;
    color: #333;
    font-size: 14px;
    font-weight: normal;
}

.upcoming-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.upcoming-btn:hover div,
.upcoming-btn:hover span,
.upcoming-btn:hover a {
    color: white !important;
}

.upcoming-btn.today {
    border-color: #28a745;
    background: #f0fff4;
}

.upcoming-btn.today:hover {
    background: #28a745;
}

/* Custom lesson suggestions dropdown */
.suggestions-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.suggestions-dropdown.open {
    display: block;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: #f0f4ff;
}

.suggestion-item .suggestion-id {
    font-weight: 600;
    color: #333;
}

.suggestion-item .suggestion-detail {
    color: #666;
    font-size: 12px;
}

.suggestion-item .suggestion-status {
    float: right;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}

.suggestion-status.bookable { background: #d4edda; color: #155724; }
.suggestion-status.done { background: #e2e3e5; color: #666; }
.suggestion-status.upcoming { background: #cce5ff; color: #004085; }
.suggestion-status.unverified { background: #fff3cd; color: #856404; }

@media (max-width: 768px) {
    .dashboard-content {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: 15px;
    }
}
