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

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

body {
  min-height: 100vh;
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  background-attachment: fixed;
}

/* Loading */
.loading { text-align: center; padding: 40px; color: white; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 10px;
  border: 4px solid rgba(255,255,255,0.3); border-top-color: white;
  border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Auth Pages */
.auth-page {
  min-height: 100vh; padding: 20px 16px;
  display: flex; align-items: center; justify-content: center;
}
.auth-container {
  max-width: 420px; width: 100%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 24px; padding: 24px;
  box-shadow: 0 25px 80px rgba(0,0,0,0.2);
}
.logo-container { text-align: center; margin-bottom: 16px; }
.logo-icon {
  width: 56px; height: 56px; margin: 0 auto 10px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 16px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}
.logo-icon svg { width: 32px; height: 32px; fill: white; }
.app-title {
  font-family: 'Quicksand', sans-serif; font-size: 1.8rem; font-weight: 800;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: 2px;
}
.app-subtitle { color: #666; font-size: 0.85rem; margin-top: 4px; }

/* Tabs */
.auth-tabs, .auth-tabs-3 {
  display: flex; background: #f0f0f5; border-radius: 12px;
  padding: 4px; margin-bottom: 16px;
}
.tab-btn {
  flex: 1; padding: 10px; border: none; background: transparent;
  border-radius: 10px; font-family: 'Nunito', sans-serif;
  font-weight: 600; font-size: 0.9rem; color: #666; cursor: pointer;
  transition: all 0.3s ease;
}
.tab-btn:hover { background: rgba(255,255,255,0.5); }
.tab-btn.active {
  background: white; color: #667eea;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.auth-tabs-3 .tab-btn { font-size: 0.8rem; padding: 8px 4px; }

/* User Type Selector */
.user-type-selector { display: flex; gap: 10px; margin-bottom: 14px; }
.type-btn {
  flex: 1; padding: 12px 8px; border: 2px solid #e0e0e0; background: white;
  border-radius: 12px; cursor: pointer; transition: all 0.3s ease;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: 'Nunito', sans-serif; font-weight: 600; font-size: 0.85rem;
}
.type-btn:hover { border-color: #667eea; }
.type-btn.active {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
}
.type-icon { font-size: 1.8rem; }

/* Forms */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-weight: 600; color: #444; margin-bottom: 4px; font-size: 0.8rem; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 10px 12px; border: 2px solid #e0e0e0;
  border-radius: 10px; font-family: 'Nunito', sans-serif; font-size: 0.9rem;
  transition: border-color 0.3s ease; background: white; outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-hint { font-size: 0.75rem; color: #888; margin-top: 4px; text-align: center; }

.submit-btn, .btn-primary {
  width: 100%; padding: 12px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none; border-radius: 10px; color: white;
  font-family: 'Nunito', sans-serif; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; transition: all 0.3s ease; margin-top: 6px;
}
.submit-btn:hover, .btn-primary:hover { 
  transform: translateY(-2px); 
  box-shadow: 0 10px 30px rgba(102,126,234,0.4); 
}
.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Panel Layout */
.panel { min-height: 100vh; padding: 16px; }
.panel-header {
  background: rgba(255,255,255,0.95); border-radius: 16px;
  padding: 14px 20px; display: flex; justify-content: space-between;
  align-items: center; margin-bottom: 16px; box-shadow: 0 6px 25px rgba(0,0,0,0.08);
  flex-wrap: wrap; gap: 12px;
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: white;
}
.teacher-avatar { background: linear-gradient(135deg, #667eea, #764ba2); }
.student-avatar { background: linear-gradient(135deg, #11998e, #38ef7d); }
.parent-avatar { background: linear-gradient(135deg, #f093fb, #f5576c); }
.user-details h2 { font-size: 1rem; color: #333; }
.user-details p { font-size: 0.75rem; color: #888; }
.user-id {
  display: inline-block; background: #f0f0f5; padding: 2px 8px;
  border-radius: 6px; font-size: 0.7rem; color: #667eea; font-weight: 600; margin-top: 2px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.notification-btn {
  width: 36px; height: 36px; border-radius: 10px; border: none;
  background: #f0f0f5; font-size: 1.1rem; cursor: pointer; position: relative;
}
.notification-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ff5757; color: white; font-size: 0.65rem;
  padding: 2px 5px; border-radius: 10px; font-weight: 700;
}
.logout-btn {
  padding: 8px 16px; background: transparent; border: 2px solid #ff5757;
  color: #ff5757; border-radius: 8px; font-weight: 600; font-size: 0.8rem;
  cursor: pointer; transition: all 0.3s;
}
.logout-btn:hover { background: #ff5757; color: white; }

/* Panel Content Grid */
.panel-content {
  display: grid; grid-template-columns: 220px 1fr;
  gap: 16px; max-width: 1200px; margin: 0 auto;
}

/* Sidebar */
.panel-sidebar, .student-sidebar, .parent-sidebar {
  background: rgba(255,255,255,0.95); border-radius: 14px;
  padding: 14px; box-shadow: 0 6px 25px rgba(0,0,0,0.06);
  height: fit-content; position: sticky; top: 16px;
}
.sidebar-section { margin-bottom: 16px; }
.sidebar-section h3 { font-size: 0.85rem; color: #333; margin-bottom: 10px; }

/* Navigation */
.sidebar-nav, .student-nav, .parent-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-btn, .student-nav-btn, .parent-nav-btn {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: none; background: #f8f9ff; border-radius: 8px;
  font-family: 'Nunito', sans-serif; font-weight: 600; font-size: 0.8rem;
  color: #666; cursor: pointer; transition: all 0.2s; text-align: left;
}
.nav-btn:hover, .student-nav-btn:hover, .parent-nav-btn:hover { background: #f0f0f5; }
.nav-btn.active { background: linear-gradient(135deg, #667eea, #764ba2); color: white; }
.student-nav-btn.active { background: linear-gradient(135deg, #11998e, #38ef7d); color: white; }
.parent-nav-btn.active { background: linear-gradient(135deg, #f093fb, #f5576c); color: white; }
.nav-icon { font-size: 1rem; }
.nav-badge {
  margin-left: auto; background: rgba(0,0,0,0.1);
  padding: 2px 6px; border-radius: 10px; font-size: 0.7rem;
}

/* Info Cards */
.student-info-card {
  background: linear-gradient(135deg, #11998e, #38ef7d);
  border-radius: 10px; padding: 12px; color: white; margin-bottom: 14px; text-align: center;
}
.parent-info-card {
  background: linear-gradient(135deg, #f093fb, #f5576c);
  border-radius: 10px; padding: 12px; color: white; margin-bottom: 14px; text-align: center;
}
.student-info-card h4, .parent-info-card h4 { font-size: 0.9rem; margin-bottom: 2px; }
.student-info-card p, .parent-info-card p { font-size: 0.7rem; opacity: 0.9; }
.student-id-box, .child-info {
  background: rgba(255,255,255,0.2); padding: 6px 10px; border-radius: 6px;
  margin-top: 8px; font-size: 0.75rem; font-weight: 600;
}

/* Mini Stats */
.student-stats-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.mini-stat {
  background: #f8f9ff; border-radius: 8px; padding: 8px; text-align: center;
}
.mini-stat-value { font-size: 1.2rem; font-weight: 800; color: #333; display: block; }
.mini-stat-label { font-size: 0.65rem; color: #888; text-transform: uppercase; }

/* Main Content */
.panel-main { display: flex; flex-direction: column; gap: 14px; }
.student-main, .parent-main { display: flex; flex-direction: column; gap: 14px; }

/* Section Cards */
.section-card {
  background: rgba(255,255,255,0.95); border-radius: 14px;
  padding: 16px; box-shadow: 0 6px 25px rgba(0,0,0,0.06);
}
.section-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.section-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center; font-size: 1rem;
}
.section-header h3 { font-size: 0.95rem; color: #333; }
.count-badge {
  margin-left: auto; background: #667eea; color: white;
  padding: 2px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 600;
}

/* Classes Grid */
.classes-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px;
}
.class-card {
  background: #f8f9ff; border-radius: 12px; padding: 14px;
  cursor: pointer; transition: all 0.3s; border: 2px solid transparent;
}
.class-card:hover { border-color: #667eea; transform: translateY(-2px); }
.class-card.selected { border-color: #667eea; background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1)); }
.class-card h4 { font-size: 0.9rem; color: #333; margin-bottom: 4px; }
.class-id { font-size: 0.7rem; color: #667eea; font-weight: 600; }
.class-stats { margin-top: 8px; font-size: 0.75rem; color: #888; }

/* Enrolled Grid */
.enrolled-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px;
}
.enrolled-card {
  background: #f8f9ff; border-radius: 10px; padding: 12px;
  border-left: 3px solid #667eea;
}
.enrolled-card h4 { font-size: 0.85rem; color: #333; margin-bottom: 4px; }
.enrolled-card .teacher { font-size: 0.75rem; color: #888; }

/* Assignments Grid */
.assignments-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px;
}
.assignment-card {
  background: #f8f9ff; border-radius: 12px; padding: 14px;
  border: 2px solid transparent; transition: all 0.3s;
}
.assignment-card:hover { border-color: #667eea; }
.assignment-card.completed { background: #e8f5e9; border-color: #4caf50; }
.assignment-card.expired { background: #ffebee; border-color: #f44336; }
.assignment-card h4 { font-size: 0.9rem; color: #333; margin-bottom: 6px; }
.assignment-desc { font-size: 0.8rem; color: #666; margin-bottom: 8px; }
.assignment-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.meta-tag {
  background: #e8eaf6; padding: 3px 8px; border-radius: 6px;
  font-size: 0.7rem; color: #5c6bc0;
}
.class-badge {
  background: #667eea; color: white; padding: 2px 8px;
  border-radius: 6px; font-size: 0.7rem; font-weight: 600;
}
.complete-btn {
  width: 100%; padding: 8px; background: linear-gradient(135deg, #11998e, #38ef7d);
  border: none; border-radius: 8px; color: white; font-weight: 600;
  font-size: 0.8rem; cursor: pointer;
}
.complete-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.completed-badge, .expired-badge {
  text-align: center; padding: 6px; border-radius: 6px;
  font-size: 0.75rem; font-weight: 600;
}
.completed-badge { background: #c8e6c9; color: #2e7d32; }
.expired-badge { background: #ffcdd2; color: #c62828; }

/* Announcements */
.announcement-item {
  background: #f8f9ff; border-radius: 10px; padding: 12px;
  margin-bottom: 10px; border-left: 3px solid #667eea;
}
.announcement-item h4 { font-size: 0.9rem; color: #333; margin-bottom: 4px; }
.announcement-item p { font-size: 0.8rem; color: #666; margin-bottom: 6px; }
.announcement-meta { font-size: 0.7rem; color: #888; }

/* Comments */
.comment-card {
  background: #f8f9ff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
  border-left: 3px solid #667eea;
}
.comment-card p { font-size: 0.85rem; color: #333; margin-bottom: 6px; }
.comment-meta { font-size: 0.7rem; color: #888; }
.comment-input-group { display: flex; gap: 8px; margin-top: 10px; }
.comment-input-group input {
  flex: 1; padding: 8px 12px; border: 2px solid #e0e0e0;
  border-radius: 8px; font-family: 'Nunito', sans-serif; font-size: 0.85rem;
}
.comment-input-group button {
  padding: 8px 16px; background: linear-gradient(135deg, #667eea, #764ba2);
  border: none; border-radius: 8px; color: white; font-weight: 600;
  font-size: 0.8rem; cursor: pointer;
}

/* Child Stats */
.child-stats-card {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 14px; padding: 16px; color: white;
}
.child-stats-card h3 { font-size: 1rem; margin-bottom: 12px; }
.child-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.child-stat {
  background: rgba(255,255,255,0.15); border-radius: 10px; padding: 10px; text-align: center;
}
.child-stat-value { font-size: 1.3rem; font-weight: 800; display: block; }
.child-stat-label { font-size: 0.65rem; opacity: 0.9; text-transform: uppercase; }

/* Request Card */
.request-card {
  background: #fff8e1; border: 2px solid #ffd54f; border-radius: 10px;
  padding: 12px; margin-bottom: 10px;
}
.request-card h4 { font-size: 0.9rem; color: #f57f17; margin-bottom: 4px; }
.request-card p { font-size: 0.8rem; color: #5d4037; margin-bottom: 8px; }
.request-actions { display: flex; gap: 8px; }
.approve-btn {
  padding: 6px 14px; background: linear-gradient(135deg, #11998e, #38ef7d);
  border: none; border-radius: 6px; color: white; font-weight: 600;
  font-size: 0.75rem; cursor: pointer;
}
.reject-btn {
  padding: 6px 14px; background: transparent; border: 2px solid #ff5757;
  border-radius: 6px; color: #ff5757; font-weight: 600;
  font-size: 0.75rem; cursor: pointer;
}
.reject-btn:hover { background: #ff5757; color: white; }

/* Empty State */
.empty-state {
  text-align: center; padding: 30px 20px; color: #888;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }
.empty-hint { font-size: 0.75rem; margin-top: 4px; }

/* Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal {
  background: white; border-radius: 20px; padding: 24px;
  max-width: 600px; width: 100%; max-height: 85vh;
  overflow-y: auto; position: relative;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px solid #f0f0f5;
}
.modal-header h3 { font-size: 1.1rem; color: #333; }
.modal-header p { font-size: 0.8rem; color: #888; }
.modal-badge {
  background: #667eea; color: white; padding: 4px 10px;
  border-radius: 8px; font-size: 0.75rem; font-weight: 600;
}
.close-btn {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 8px;
  border: none; background: #f0f0f5; font-size: 1rem;
  cursor: pointer; color: #666;
}
.close-btn:hover { background: #ff5757; color: white; }

.modal-section { margin-bottom: 20px; }
.modal-section h4 { font-size: 0.9rem; color: #333; margin-bottom: 10px; }

/* List Items */
.list-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; background: #f8f9ff; border-radius: 8px; margin-bottom: 8px;
}
.list-item-info { display: flex; flex-direction: column; gap: 2px; }
.list-item-name { font-size: 0.85rem; font-weight: 600; color: #333; }
.list-item-sub { font-size: 0.7rem; color: #888; }
.list-item-badge {
  background: #667eea; color: white; padding: 2px 6px;
  border-radius: 4px; font-size: 0.65rem; font-weight: 600;
}
.remove-btn {
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: #ffebee; color: #f44336;
  cursor: pointer; font-size: 0.8rem;
}
.remove-btn:hover { background: #f44336; color: white; }

/* Add Row */
.add-row { display: flex; gap: 8px; }
.add-row input {
  flex: 1; padding: 10px 12px; border: 2px solid #e0e0e0;
  border-radius: 8px; font-family: 'Nunito', sans-serif; font-size: 0.85rem;
}
.add-row button {
  padding: 10px 20px; background: linear-gradient(135deg, #667eea, #764ba2);
  border: none; border-radius: 8px; color: white; font-weight: 600;
  font-size: 0.85rem; cursor: pointer;
}

/* Assignment Item in Modal */
.assignment-item {
  background: #f8f9ff; border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.assignment-item.expired { background: #ffebee; }
.assignment-item-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}
.assignment-title { font-weight: 600; color: #333; font-size: 0.9rem; }
.assignment-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 600;
}
.badge-deadline { background: #e3f2fd; color: #1976d2; }
.badge-expired { background: #ffcdd2; color: #c62828; }
.badge-target { background: #e8f5e9; color: #388e3c; }

.status-list { margin-top: 10px; }
.status-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; background: white; border-radius: 6px; margin-bottom: 4px;
  font-size: 0.8rem;
}
.status-item.completed { background: #e8f5e9; }
.status-item.expired { background: #ffebee; }
.status-badge { font-weight: 600; }

/* Create Class Form */
.create-class-form { display: flex; flex-direction: column; gap: 8px; }
.create-class-form input {
  padding: 10px 12px; border: 2px solid #e0e0e0; border-radius: 8px;
  font-family: 'Nunito', sans-serif; font-size: 0.85rem;
}
.create-btn {
  padding: 10px; background: linear-gradient(135deg, #667eea, #764ba2);
  border: none; border-radius: 8px; color: white; font-weight: 600;
  font-size: 0.85rem; cursor: pointer;
}
.create-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Assignment Form */
.assignment-form { display: flex; flex-direction: column; gap: 12px; }

/* Profile Section */
.profile-section { display: flex; gap: 20px; align-items: flex-start; }
.profile-avatar {
  width: 80px; height: 80px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; flex-shrink: 0;
}
.profile-form { flex: 1; }

/* Delete Button */
.delete-btn {
  padding: 8px 16px; background: transparent; border: 2px solid #ff5757;
  color: #ff5757; border-radius: 8px; font-weight: 600; font-size: 0.8rem;
  cursor: pointer; transition: all 0.3s;
}
.delete-btn:hover { background: #ff5757; color: white; }

/* Save Button */
.save-btn {
  padding: 10px 20px; background: linear-gradient(135deg, #667eea, #764ba2);
  border: none; border-radius: 8px; color: white; font-weight: 600;
  font-size: 0.85rem; cursor: pointer;
}

/* Notifications Panel */
.notifications-panel {
  position: absolute; top: 100%; right: 0; margin-top: 10px;
  background: white; border-radius: 12px; padding: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15); width: 300px;
  max-height: 400px; overflow-y: auto; z-index: 100;
}
.notifications-panel h4 { font-size: 0.9rem; margin-bottom: 10px; color: #333; }
.notification-item {
  padding: 10px; background: #f8f9ff; border-radius: 8px;
  margin-bottom: 8px; font-size: 0.8rem; color: #333;
}
.notification-item.unread { background: #e8eaf6; border-left: 3px solid #667eea; }
.notification-time { font-size: 0.7rem; color: #888; margin-top: 4px; }

/* Alert Messages */
.alert {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 14px;
  font-size: 0.85rem; font-weight: 600;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* Responsive */
@media (max-width: 900px) {
  .panel-content { grid-template-columns: 1fr; }
  .panel-sidebar, .student-sidebar, .parent-sidebar { position: static; }
  .child-stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .panel-header { flex-direction: column; text-align: center; padding: 12px; }
  .user-info { flex-direction: column; text-align: center; }
  .header-actions { width: 100%; justify-content: center; }
  .child-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .classes-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { margin: 10px; padding: 20px; }
  .notifications-panel { right: 10px; left: 10px; width: auto; }
  .profile-section { flex-direction: column; align-items: center; }
}
