/* ===== Akshar Learning – Clean Professional Design ===== */
:root {
  --primary: #0A3D62;          /* Deep teal from logo */
  --primary-dark: #062A45;
  --accent: #E8A317;           /* Gold / yellow from logo */
  --accent-light: #F5C76B;
  --bg: #F7F9FC;
  --surface: #FFFFFF;
  --text: #1A2A3A;
  --text-muted: #5A6A7A;
  --border: #E2E8F0;
  --success: #10B981;
  --danger: #EF4444;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(10, 61, 98, 0.08);
  --shadow-lg: 0 10px 40px rgba(10, 61, 98, 0.12);
  --nav-height: 64px;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
}

/* ===== Screens ===== */
.screen {
  display: none;
  min-height: 100%;
  width: 100%;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* Splash */
#splash {
  background: linear-gradient(160deg, #0A3D62 0%, #0D4A75 100%);
  justify-content: center;
  align-items: center;
}
.splash-content {
  text-align: center;
  animation: fadeIn 0.8s ease;
}
.splash-logo {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  margin-bottom: 24px;
}
.splash-tagline {
  color: rgba(255,255,255,0.9);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

/* Onboarding */
#onboarding {
  padding: 40px 24px 32px;
  justify-content: space-between;
}
.onboarding-slides {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.slide {
  display: none;
  text-align: center;
  padding: 0 12px;
  animation: fadeIn 0.4s ease;
}
.slide.active { display: block; }
.slide-icon {
  font-size: 64px;
  margin-bottom: 28px;
}
.slide h2 {
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 12px;
}
.slide p {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
}
.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 24px 0;
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}
.dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}
.onboarding-actions {
  display: flex;
  gap: 12px;
}

/* Auth */
#auth {
  padding: 32px 24px 40px;
  background: var(--bg);
}
.auth-header {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.auth-header h1 {
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 6px;
}
.auth-header p {
  color: var(--text-muted);
  font-size: 14px;
}
.auth-tabs {
  display: flex;
  background: var(--surface);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--primary);
  color: white;
}
.auth-form {
  display: none;
}
.auth-form.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Forms */
.form-group {
  margin-bottom: 18px;
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10, 61, 98, 0.12);
}
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  padding-right: 48px;
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  opacity: 0.6;
}
.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  font-size: 13px;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  cursor: pointer;
}
.form-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}
.role-selector {
  display: flex;
  gap: 12px;
}
.role-selector.three,
.role-selector.four {
  flex-wrap: wrap;
}
.role-selector.three .role-option,
.role-selector.four .role-option {
  flex: 1 1 40%;
  min-width: 90px;
  font-size: 13px;
  padding: 12px 8px;
}
.role-selector.four .role-option {
  flex: 1 1 40%;
}
.role-option {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface);
}
.role-option input {
  display: none;
}
.role-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(10, 61, 98, 0.06);
  color: var(--primary);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:active {
  background: var(--primary-dark);
  transform: scale(0.98);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}
.btn-outline:active {
  background: var(--border);
}
.btn-full {
  width: 100%;
}
.btn-accent {
  background: var(--accent);
  color: var(--primary-dark);
}

/* Role Select */
#role-select {
  justify-content: center;
  align-items: center;
  padding: 32px 24px;
  background: linear-gradient(160deg, #0A3D62 0%, #0D4A75 100%);
}
.role-select-content {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.small-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 20px;
}
.role-select-content h2 {
  color: white;
  margin-bottom: 28px;
  font-size: 24px;
}
.role-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.role-card {
  background: white;
  border: none;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s;
}
.role-card:active {
  transform: scale(0.98);
}
.role-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 8px;
}
.role-card h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 4px;
}
.role-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ===== App Shell ===== */
.app-shell {
  display: none;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 20;
}
.app-shell.active {
  display: flex;
}

.app-header {
  height: var(--header-height);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  flex-shrink: 0;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: white;
  object-fit: cover;
}
.header-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.header-subtitle {
  font-size: 12px;
  opacity: 0.85;
  font-weight: 400;
}
.icon-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-height) + 16px + env(safe-area-inset-bottom));
}

.page {
  display: none;
  padding: 20px 16px;
  animation: fadeIn 0.25s ease;
}
.page.active {
  display: block;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header h2 {
  font-size: 20px;
  color: var(--primary);
}
.back-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Welcome Card */
.welcome-card {
  background: linear-gradient(135deg, var(--primary) 0%, #0D4A75 100%);
  color: white;
  border-radius: var(--radius);
  padding: 24px 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.welcome-card h2 {
  font-size: 22px;
  margin-bottom: 4px;
}
.welcome-card p {
  opacity: 0.9;
  font-size: 14px;
}
.welcome-card.student {
  background: linear-gradient(135deg, #0A3D62 0%, #1A5A8A 100%);
}

/* Quick Actions */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}
.action-card {
  background: var(--surface);
  border: none;
  border-radius: 14px;
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.action-card:active {
  transform: scale(0.95);
}
.action-card span {
  font-size: 26px;
  display: block;
  margin-bottom: 6px;
}
.action-card p {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

/* Admin Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  font-family: 'Poppins', sans-serif;
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.section-title {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 14px;
  font-weight: 600;
}

/* Class Cards */
.class-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}
.class-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.class-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.class-subject {
  font-weight: 600;
  font-size: 16px;
  color: var(--primary);
}
.class-time {
  font-size: 13px;
  color: var(--text-muted);
}
.class-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}
.class-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}
.btn-meet {
  background: #00AC47;
  color: white;
  flex: 1;
}
.btn-meet:active {
  background: #008C3A;
}

/* Subject Grid */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.subject-card {
  background: var(--surface);
  border-radius: 14px;
  padding: 18px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s;
}
.subject-card:active {
  transform: scale(0.97);
}
.subject-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.subject-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Teachers */
.teacher-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.teacher-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
}
.teacher-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #1A5A8A);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
}
.teacher-info h4 {
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 2px;
}
.teacher-info p {
  font-size: 13px;
  color: var(--text-muted);
}
.teacher-subjects {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  margin-top: 4px;
}

/* Progress */
.progress-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.progress-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.progress-card h4 {
  font-size: 15px;
  color: var(--primary);
  margin-bottom: 10px;
}
.progress-bar-bg {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 4px;
  transition: width 0.5s ease;
}
.progress-stats {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-muted);
}

/* Homework */
.homework-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hw-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--accent);
}
.hw-card.done {
  border-left-color: var(--success);
  opacity: 0.85;
}
.hw-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}
.hw-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.hw-status {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}
.hw-status.pending {
  background: #FEF3C7;
  color: #92400E;
}
.hw-status.done {
  background: #D1FAE5;
  color: #065F46;
}

/* Contact */
.contact-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  text-align: center;
}
.contact-card p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 14px;
}
.contact-btn {
  display: block;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s;
}
.contact-btn:active {
  background: var(--border);
}
.contact-btn.whatsapp {
  background: #25D366;
  color: white;
  border-color: #25D366;
}

.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.form-card h3 {
  font-size: 16px;
  color: var(--primary);
  margin-bottom: 16px;
}

/* Profile */
.profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  text-align: center;
}
.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #1A5A8A);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  margin: 0 auto 14px;
}
.profile-name {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}
.profile-role {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.profile-details {
  text-align: left;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.profile-row span:first-child {
  color: var(--text-muted);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 50;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.nav-item {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  min-width: 56px;
  transition: color 0.2s;
}
.nav-item span {
  font-size: 22px;
}
.nav-item.active {
  color: var(--primary);
}
.nav-item.active span {
  transform: scale(1.1);
}

/* Tabs */
.tabs {
  display: flex;
  background: var(--surface);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 10px;
  cursor: pointer;
}
.tab.active {
  background: var(--primary);
  color: white;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: white;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
}
.modal-content h3 {
  font-size: 18px;
  color: var(--primary);
  margin-bottom: 8px;
}
.modal-content p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.modal-content input {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .btn {
  flex: 1;
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
  max-width: 90%;
  text-align: center;
}
.toast.hidden {
  display: none;
}
.toast.success {
  background: var(--success);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state span {
  font-size: 48px;
  display: block;
  margin-bottom: 12px;
}

/* Responsive tweaks for larger phones / tablets */
@media (min-width: 480px) {
  .quick-actions {
    grid-template-columns: repeat(4, 1fr);
  }
  .subject-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .app-main {
    max-width: 560px;
    margin: 0 auto;
  }
  .bottom-nav {
    max-width: 560px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}
