/* ===========================
   ENGLISH COACHING PLATFORM
   Mobile-First CSS
   =========================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --secondary: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --text: #1f2937;
  --text-light: #6b7280;
  --bg: #ffffff;
  --bg-light: #f9fafb;
  --border: #e5e7eb;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text);
  background: var(--bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.page {
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Header */
.header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.nav-menu {
  display: flex;
  gap: 12px;
  list-style: none;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.2s;
}

.nav-link:hover {
  background: var(--bg-light);
}

.nav-link.active {
  background: var(--primary);
  color: white;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  text-align: center;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
}

.btn-small {
  padding: 6px 12px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
  display: block;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Cards */
.card {
  background: var(--bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-header {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  transition: border 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Dashboard */
.welcome {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 32px 20px;
  border-radius: 12px;
  margin-bottom: 24px;
  text-align: center;
}

.welcome h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

/* Lessons */
.lesson-item {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s;
}

.lesson-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.lesson-info {
  flex: 1;
}

.lesson-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.lesson-meta {
  font-size: 12px;
  color: var(--text-light);
}

.lesson-progress {
  width: 60px;
  text-align: center;
}

.progress-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.progress-circle.completed {
  background: var(--secondary);
  color: white;
}

/* Audio Player */
.audio-player {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 24px;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.play-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 24px;
  cursor: pointer;
  transition: transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-btn:hover {
  transform: scale(1.05);
}

.time-display {
  font-size: 14px;
  color: var(--text-light);
  min-width: 100px;
}

.seek-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-light);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.seek-bar-progress {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.1s;
}

.secondary-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  gap: 12px;
}

.speed-control {
  display: flex;
  gap: 8px;
}

.speed-btn {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.speed-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: var(--secondary);
  transition: width 0.3s;
}

/* Badges */
.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.badge-item {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: var(--bg-light);
}

.badge-item.earned {
  background: var(--secondary);
  color: white;
}

.badge-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.badge-name {
  font-size: 11px;
}

/* Admin Tables */
.admin-table {
  width: 100%;
  background: var(--bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.admin-table th {
  background: var(--bg-light);
  font-weight: 600;
  font-size: 14px;
}

.admin-table td {
  font-size: 14px;
}

.admin-table tr:hover {
  background: var(--bg-light);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-approved {
  background: #d1fae5;
  color: #065f46;
}

.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-suspended {
  background: #e5e7eb;
  color: #374151;
}

/* Alerts */
.alert {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
}

.alert-warning {
  background: #fef3c7;
  color: #92400e;
}

.alert-danger {
  background: #fee2e2;
  color: #991b1b;
}

.alert-success {
  background: #d1fae5;
  color: #065f46;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}

.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

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

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* Filters */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Utility */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.hidden { display: none !important; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .nav-menu {
    gap: 4px;
  }
  
  .nav-link {
    padding: 6px 10px;
    font-size: 13px;
  }
  
  .admin-table {
    overflow-x: auto;
  }
}
