/* Dashboard Styles for Wawa Works */
:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --secondary: #64748b;
  --success: #16a34a;
  --warning: #f59e0b;
  --bg-main: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius-lg: 16px;
  --radius-md: 10px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  padding-bottom: 40px;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Hero Header */
.hero {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 40px 0;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.hero-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-icon {
  font-size: 2.8em;
  background: rgba(255, 255, 255, 0.1);
  width: 68px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.hero h1 {
  font-size: 2em;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero-subtitle {
  color: #94a3b8;
  font-size: 1.05em;
  margin-top: 4px;
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 0.9em;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-indicator.online {
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--card-bg);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 2.2em;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.95em;
  font-weight: 500;
  margin-top: 4px;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  margin-top: 12px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Subjects Nav */
.subjects-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 25px;
  overflow-x: auto;
  padding-bottom: 5px;
}

.subject-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.9em;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

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

/* Chapters Grid */
.chapters-grid {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-bottom: 35px;
}

.chapter-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chapter-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.chapter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 15px;
  flex-wrap: wrap;
}

.chapter-title-group h2 {
  font-size: 1.4em;
  font-weight: 700;
  color: #0f172a;
}

.chapter-subtitle {
  color: var(--text-muted);
  font-size: 0.95em;
  font-weight: 500;
  margin-top: 2px;
}

.badge-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chapter-desc {
  color: #475569;
  font-size: 1em;
  line-height: 1.5;
}

/* Chapter Progress Bar */
.chapter-progress-box {
  background: #f8fafc;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  border: 1px solid #edf2f7;
}

.chapter-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.85em;
  font-weight: 600;
  margin-bottom: 6px;
}

.chapter-progress-text {
  color: var(--text-muted);
}

.chapter-progress-percent {
  color: var(--primary);
}

.chapter-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95em;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}

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

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

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Info Card / PWA */
.info-card {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.info-icon {
  font-size: 2.4em;
  flex-shrink: 0;
}

.info-text h3 {
  font-size: 1.15em;
  font-weight: 700;
  color: #1e3a8a;
  margin-bottom: 4px;
}

.info-text p {
  color: #1e40af;
  font-size: 0.95em;
}

/* Footer */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9em;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.loading-placeholder {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 1.1em;
}

@media (max-width: 600px) {
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .chapter-actions {
    flex-direction: column;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
}
