@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;700;900&family=Outfit:wght@400;500;600;700&display=swap');

/* --- GLOBAL & STUDENT APP STYLING --- */
body { font-family: 'Nunito', sans-serif; background-color: #f8fafc; color: #333; display: flex; flex-direction: column; align-items: center; min-height: 100vh; margin: 0; padding: 40px 20px; box-sizing: border-box; transition: background-color 0.3s ease; }
.app-container { background: white; padding: 40px; border-radius: 25px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); text-align: center; max-width: 500px; width: 90%; border: 5px solid #4dd0e1; margin: auto; position: relative; }
h1 { color: #00838f; font-size: 2.5rem; margin-bottom: 10px; } h2 { color: #ff9800; font-size: 2rem; } p { font-size: 1.2rem; color: #555; }

input[type="text"], input[type="number"], input[type="password"] { width: 80%; padding: 15px; font-size: 1.8rem; border: 4px solid #b2ebf2; border-radius: 15px; margin: 15px auto; display: block; text-align: center; outline: none; font-family: 'Nunito', sans-serif; font-weight: 700; background-color: white; box-sizing: border-box; color: #333; transition: border-color 0.2s; }
input:focus { border-color: #00bcd4; }

.login-box { background: #e1f5fe; border: 4px solid #81d4fa; border-radius: 20px; padding: 25px 20px 10px 20px; margin: 20px auto 30px auto; }
.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; font-size: 1.2rem; font-weight: 900; color: #0277bd; margin-bottom: 12px; margin-left: 10px; }
.input-group input { width: 100%; margin: 0; text-align: left; padding-left: 20px; }

.class-buttons { display: flex; justify-content: space-between; gap: 10px; padding: 0 5px; }
.class-selector-btn { flex: 1; background-color: white; color: #0277bd; border: 3px solid #81d4fa; padding: 15px 0; font-size: 1.3rem; font-weight: 900; border-radius: 15px; cursor: pointer; box-shadow: 0 5px 0px #81d4fa; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); margin: 0; }
.class-selector-btn:hover { background-color: #e1f5fe; transform: translateY(2px); box-shadow: 0 3px 0px #81d4fa; }
.class-selector-btn.selected { background-color: #0288d1 !important; color: white !important; border-color: #01579b !important; box-shadow: 0 0px 0px #01579b !important; transform: translateY(5px) scale(1.05) !important; }
.class-selector-btn.dimmed { opacity: 0.35 !important; transform: translateY(0px) scale(0.85) !important; box-shadow: 0 2px 0px #cbd5e1 !important; background-color: #f1f5f9 !important; border-color: #cbd5e1 !important; color: #94a3b8 !important; }

button { background-color: #ff5252; color: white; border: none; padding: 15px 30px; font-size: 1.5rem; font-weight: 900; border-radius: 50px; cursor: pointer; transition: transform 0.1s, background-color 0.2s; margin: 10px; box-shadow: 0 5px 0px #d50000; }
button:hover { background-color: #ff1744; transform: translateY(2px); box-shadow: 0 3px 0px #d50000; }
button:active { transform: translateY(5px); box-shadow: 0 0px 0px #d50000; }

.secondary-btn { background-color: #e2e8f0; color: #0f172a; box-shadow: 0 4px 0px #cbd5e1; font-size: 1rem; padding: 10px 15px; border-radius: 12px; }
.secondary-btn:hover { background-color: #cbd5e1; box-shadow: 0 2px 0px #94a3b8; }

.quiz-navigation { display: flex; justify-content: center; gap: 20px; margin-top: 10px; }
.nav-arrow { font-size: 2rem; padding: 10px 40px; font-family: system-ui, sans-serif; display: flex; align-items: center; justify-content: center; border-radius: 15px; }
.blue-arrow { background-color: #2563eb !important; box-shadow: 0 5px 0px #1d4ed8 !important; }
.blue-arrow:hover { background-color: #3b82f6 !important; box-shadow: 0 3px 0px #1d4ed8 !important; }
.red-arrow { background-color: #ef4444 !important; box-shadow: 0 5px 0px #b91c1c !important; }
.red-arrow:hover { background-color: #f87171 !important; box-shadow: 0 3px 0px #b91c1c !important; }
/* NEW: Green arrow for the "Next Practice Question" button */
.green-arrow { background-color: #16a34a !important; box-shadow: 0 5px 0px #15803d !important; }
.green-arrow:hover { background-color: #22c55e !important; box-shadow: 0 3px 0px #15803d !important; }

#start-practice-btn { background-color: #4caf50; box-shadow: 0 5px 0px #2e7d32; } #start-practice-btn:hover { background-color: #43a047; box-shadow: 0 3px 0px #2e7d32; } 

.stats-box { background-color: #f3e5f5; padding: 15px; border-radius: 15px; margin: 20px 0; border: 3px dashed #ce93d8; }
.progress { background-color: #e8f5e9; color: #2e7d32; padding: 10px 20px; border-radius: 20px; font-weight: bold; font-size: 1.2rem; margin-bottom: 20px; display: inline-block; }
#question-text { font-size: 3.5rem; color: #1565c0; margin: 20px 0; white-space: nowrap; }

.review-container { max-height: 350px; overflow-y: auto; text-align: left; background: #f9f9f9; padding: 15px; border-radius: 15px; margin-bottom: 20px; border: 4px solid #b2ebf2; }
.review-item { padding: 15px 10px; border-bottom: 2px dashed #ccc; font-size: 1.2rem; } .review-item:last-child { border-bottom: none; }
.correct-text { color: #16a34a; font-weight: 900; } .wrong-text { color: #dc2626; font-weight: 900; }
.fraction { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; font-size: 0.8em; margin: 0 10px; color: #1565c0; } .fraction .numerator { border-bottom: 5px solid #1565c0; padding: 0 10px; } .fraction .denominator { padding: 0 10px; }
.review-item .fraction { color: #333 !important; } .review-item .fraction .numerator { border-bottom: 5px solid #333 !important; }

.secret-teacher-link { display: block; margin-top: 30px; color: #cbd5e1; font-size: 0.85rem; text-decoration: none; font-weight: 700; transition: color 0.2s; } .secret-teacher-link:hover { color: #94a3b8; }
.user-badge { background-color: #e1f5fe; color: #0288d1; padding: 8px 16px; border-radius: 50px; font-size: 1.1rem; font-weight: 900; display: inline-block; margin-bottom: 15px; border: 2px solid #81d4fa; }

.medals-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 15px; margin-top: 20px; }
.medal-card { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 16px; padding: 15px 10px; text-align: center; transition: all 0.3s ease; }
.medal-icon { font-size: 3rem; margin-bottom: 10px; display: block; line-height: 1; }
.medal-title { font-weight: 800; color: #0f172a; font-size: 0.95rem; margin: 0 0 5px 0; }
.medal-desc { font-size: 0.8rem; color: #64748b; margin: 0; line-height: 1.2; }
.medal-locked { filter: grayscale(100%); opacity: 0.5; background: #f1f5f9; border-color: #cbd5e1; }
.medal-earned { background: #fffcf2; border-color: #fde68a; box-shadow: 0 4px 10px rgba(251, 191, 36, 0.2); transform: scale(1.05); }

/* --- TEACHER DASHBOARD STYLING --- */
.teacher-container, .teacher-container input, .teacher-container button, .teacher-container select { font-family: 'Google Sans', 'Outfit', system-ui, -apple-system, sans-serif; }
.teacher-container { background: #ffffff; padding: 40px; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.05); text-align: left; max-width: 1000px; width: 95%; border: 1px solid #e2e8f0; margin: auto; color: #334155; }
.teacher-container h1 { color: #0f172a; font-size: 2rem; margin: 0; font-weight: 600; letter-spacing: -0.5px; }
.teacher-container h2 { color: #1e293b; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.5px; }
.teacher-container p { color: #64748b; font-size: 1rem; }

.teacher-badge { background-color: #f8fafc; color: #475569; padding: 6px 14px; border-radius: 50px; font-size: 0.9rem; font-weight: 600; border: 1px solid #e2e8f0; display: inline-block; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.dashboard-nav { display: flex; gap: 10px; border-bottom: 2px solid #e2e8f0; padding-bottom: 15px; margin-bottom: 25px; }
.nav-tab-btn { background: transparent; color: #64748b; border: none; font-size: 1.1rem; font-weight: 700; padding: 10px 20px; cursor: pointer; transition: all 0.2s; border-radius: 8px; margin: 0; box-shadow: none; }
.nav-tab-btn:hover { color: #0f172a; background: #f1f5f9; transform: none; }
.nav-tab-btn.active { background: #e2e8f0; color: #0f172a; }

.teacher-container .login-box { background: transparent; border: none; padding: 0; max-width: 400px; margin: 0 auto 30px auto; }
.teacher-container .input-group label { color: #475569; font-weight: 600; font-size: 0.95rem; margin-left: 5px; }
.teacher-container input[type="text"], .teacher-container input[type="password"], .teacher-container select { font-size: 1rem; padding: 12px 15px; border: 1px solid #cbd5e1; border-radius: 8px; box-shadow: none; font-weight: 400; color: #0f172a; width: 100%; box-sizing: border-box; }
.teacher-container input:focus, .teacher-container select:focus { border-color: #2563eb; outline: none; box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

.teacher-container button { border-radius: 8px; box-shadow: none; font-weight: 500; font-size: 1rem; padding: 10px 20px; margin: 5px 0; transition: all 0.2s; }
.primary-btn { background-color: #2563eb; color: white; width: 100%; max-width: 400px; display: block; margin: 10px auto; } .primary-btn:hover { background-color: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 6px rgba(37,99,235,0.2); }
#back-btn, #logout-btn { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; } #back-btn:hover, #logout-btn:hover { background-color: #e2e8f0; transform: none; box-shadow: none; }

.auth-toggle { text-align: center; margin-top: 15px; } .auth-toggle a { color: #2563eb; cursor: pointer; font-weight: 600; text-decoration: none; } .auth-toggle a:hover { text-decoration: underline; }

.leaderboard-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 24px; margin: 24px 0; box-shadow: none; transition: background-color 0.3s; }
.leaderboard-row { display: flex; justify-content: space-between; align-items: center; font-size: 1.1rem; font-weight: 500; padding: 12px; border-bottom: 1px solid #e2e8f0; color: #334155; }
.rank-1 { color: #b45309; background: #fffbeb; border-radius: 8px; border: none; } .rank-2 { color: #475569; background: #f1f5f9; border-radius: 8px; border: none; margin-top: 8px; } .rank-3 { color: #9a3412; background: #ffedd5; border-radius: 8px; border: none; margin-top: 8px; } 

.main-lb-tabs { display: flex; gap: 10px; margin-bottom: 20px; border-bottom: 2px solid #e2e8f0; padding-bottom: 10px; flex-wrap: wrap; }
.main-tab-btn { background: transparent; color: #64748b; border: none; font-size: 1.2rem; font-weight: 700; padding: 10px 15px; cursor: pointer; transition: all 0.2s; border-radius: 8px; margin: 0; box-shadow: none;}
.main-tab-btn:hover { color: #0f172a; background: #f1f5f9; transform: none; }
.main-tab-btn.active[data-type="practice"] { background: #fffff8; color: #b45309; box-shadow: inset 0 0 0 2px #fef3c7; } 
.main-tab-btn.active[data-type="test"] { background: #eff6ff; color: #1d4ed8; box-shadow: inset 0 0 0 2px #bfdbfe; }

.lb-time-tabs { display: flex; gap: 8px; margin-bottom: 15px; }
.lb-tab-btn { background: #e2e8f0; color: #475569; border: none; border-radius: 6px; padding: 6px 12px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.2s; margin: 0; box-shadow: none; }
.lb-tab-btn:hover { background: #cbd5e1; color: #0f172a; transform: none; } 
.lb-tab-btn.active { background: #475569; color: white; transform: none; }

.tab-container { display: flex; justify-content: flex-start; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.tab-btn { background: #f1f5f9; color: #64748b; border: none; border-radius: 8px; padding: 8px 20px; font-size: 0.95rem; margin: 0; font-weight: 500; transition: all 0.2s ease; cursor: pointer; box-shadow: none; }
.tab-btn:hover { background: #e2e8f0; color: #0f172a; transform: none; } .tab-btn.active { background: #2563eb; color: #ffffff; transform: none;}

.student-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 24px; margin: 20px 0; }
.student-card { background: #ffffff; padding: 20px; border-radius: 12px; border: 1px solid #e2e8f0; text-align: left; box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: relative; transition: all 0.2s; cursor: pointer; }
.student-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); border-color: #cbd5e1; transform: translateY(-2px); }
.student-card h3 { margin: 0; color: #0f172a; font-size: 1.25rem; font-weight: 600; letter-spacing: -0.5px; } 
.student-card p { font-size: 0.95rem; margin: 4px 0; color: #475569; }

.class-badge { background-color: #f1f5f9; color: #475569; padding: 3px 8px; border-radius: 6px; font-weight: 700; font-size: 0.85rem; border: 1px solid #e2e8f0; margin-left: 8px; vertical-align: middle; display: inline-block; pointer-events: none; }
.unlocked-badge { font-size:0.8rem; background-color:#dcfce7; color:#16a34a; padding:2px 6px; border-radius:4px; margin-left:5px; vertical-align: middle; font-weight:bold; }

.card-menu-btn { background: transparent; border: none; font-size: 1.8rem; color: #94a3b8; cursor: pointer; padding: 0 5px; border-radius: 50%; transition: all 0.2s; box-shadow: none; margin: 0; line-height: 1; display: flex; align-items: center; justify-content: center; height: 35px; width: 35px; }
.card-menu-btn:hover { color: #0f172a; background: #f1f5f9; transform: none; box-shadow: none; }

.card-dropdown { display: none; position: absolute; top: calc(100% + 5px); right: 0; background: white; border: 1px solid #e2e8f0; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); z-index: 10; overflow: hidden; min-width: 170px; text-align: left; }
.card-dropdown.show { display: block; }

.card-dropdown-item { padding: 12px 15px; font-size: 0.95rem; color: #334155; cursor: pointer; transition: background 0.2s; border-bottom: 1px solid #f1f5f9; font-weight: 600; }
.card-dropdown-item:last-child { border-bottom: none; }
.card-dropdown-item:hover { background: #f8fafc; color: #0f172a; }
.card-dropdown-item.danger { color: #dc2626; }
.card-dropdown-item.danger:hover { background: #fee2e2; color: #b91c1c; }

.topic-stat-row { margin-bottom: 12px; }
.topic-labels { display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 700; margin-bottom: 5px; color: #334155; }
.progress-track { width: 100%; height: 8px; background-color: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.fill-secure { background-color: #16a34a; } .fill-developing { background-color: #d97706; } .fill-support { background-color: #dc2626; }

.delete-btn { background-color: #fee2e2; color: #ef4444; border: none; padding: 8px 15px; border-radius: 8px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: background 0.2s; margin: 0; box-shadow: none; }
.delete-btn:hover { background-color: #fca5a5; transform: none; }

.modal-overlay { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); align-items: center; justify-content: center; }
.modal-content { background-color: #ffffff; padding: 30px; border-radius: 16px; width: 90%; max-width: 500px; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); position: relative; font-family: 'Google Sans', 'Outfit', sans-serif; }
.close-modal-btn { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; font-weight: bold; color: #94a3b8; cursor: pointer; transition: color 0.2s; } .close-modal-btn:hover { color: #0f172a; }
.modal-content h2 { margin-top: 0; color: #0f172a; font-size: 1.8rem; border-bottom: 2px solid #f1f5f9; padding-bottom: 10px; }
.modal-stat-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px; margin-bottom: 20px; display: flex; justify-content: space-between; }
.modal-stat { text-align: center; } .modal-stat span { display: block; font-size: 1.5rem; font-weight: 700; color: #2563eb; } .modal-stat label { font-size: 0.85rem; color: #64748b; font-weight: 600; text-transform: uppercase; }
.history-list { max-height: 200px; overflow-y: auto; padding: 0; margin: 0; list-style: none; }
.history-item { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid #f1f5f9; color: #334155; font-weight: 500; }