/* =====================================================
   C++ Hardcore Bootcamp – Study Tracker
   Dark Theme | Motivational | Responsive
   ===================================================== */

:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: #16163a;
  --bg-card-hover: #1e1e4a;
  --bg-input: #1a1a3e;
  --border-color: #2a2a5a;
  --border-active: #4f46e5;
  --text-primary: #e8e8f0;
  --text-secondary: #9090b8;
  --text-muted: #606080;
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --green: #22c55e;
  --green-glow: rgba(34, 197, 94, 0.2);
  --yellow: #eab308;
  --orange: #f97316;
  --red: #ef4444;
  --cyan: #06b6d4;
  --sidebar-width: 280px;
  --header-height: 56px;
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===================== LOGIN PAGE ===================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0a1a 0%, #111128 50%, #0d0d25 100%);
  position: relative;
  overflow: hidden;
}

.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particles::before,
.particles::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.15;
}

.particles::before {
  width: 600px; height: 600px;
  background: var(--accent);
  top: -200px; left: -200px;
  animation: float 10s ease-in-out infinite;
}

.particles::after {
  width: 500px; height: 500px;
  background: var(--cyan);
  bottom: -200px; right: -200px;
  animation: float 12s ease-in-out infinite reverse;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(40px, -40px); }
}

.login-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 20px;
  font-size: 28px;
  font-weight: 900;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px var(--accent-glow);
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 6px;
}

/* Tabs */
.login-tabs {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: var(--accent);
  color: white;
}

/* Forms */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.input-group {
  margin-bottom: 18px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 15px;
  transition: var(--transition);
  outline: none;
}

.input-group input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 4px;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
  min-height: 20px;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
}

/* ===================== APP LAYOUT ===================== */
.app-page {
  display: flex;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-close {
  display: none;
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}

/* Stats */
.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

.stat-card {
  text-align: center;
  padding: 8px 4px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}

.stat-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent-light);
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Progress */
.sidebar-progress {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
}

.progress-bar-container {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.sidebar-progress small {
  color: var(--text-muted);
  font-size: 11px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.week-group {
  margin-bottom: 4px;
}

.week-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.day-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.day-link:hover {
  background: var(--bg-card);
}

.day-link.active {
  background: var(--bg-card);
  border-left-color: var(--accent);
}

.day-link.completed .day-link-icon {
  background: var(--green);
  color: white;
}

.day-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--bg-card);
  color: var(--text-secondary);
  flex-shrink: 0;
  font-weight: 700;
}

.day-link-text {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.day-link.active .day-link-text {
  color: var(--text-primary);
  font-weight: 600;
}

.day-link-check {
  margin-left: auto;
  font-size: 14px;
  flex-shrink: 0;
}

/* Footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-logout {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  transition: var(--transition);
}

.btn-logout:hover {
  border-color: var(--red);
  color: var(--red);
}

/* ===================== MOBILE HEADER ===================== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  align-items: center;
  padding: 0 16px;
  z-index: 90;
  gap: 12px;
}

.hamburger {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 22px;
  cursor: pointer;
}

.mobile-title {
  font-weight: 700;
  font-size: 16px;
}

.mobile-day {
  margin-left: auto;
  font-size: 13px;
  color: var(--accent-light);
  font-weight: 600;
}

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 32px 40px;
  max-width: 900px;
}

/* Day Header */
.day-header {
  margin-bottom: 24px;
}

.day-header-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.day-number-badge {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.day-header-info {
  flex: 1;
}

.day-header-info h1 {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 4px;
}

.day-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
}

.day-date {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.day-nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-nav {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-nav:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Day Progress Bar */
.day-progress-bar-container {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.day-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 4px;
  transition: width 0.5s ease;
}

.day-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.day-meta-item {
  font-size: 12px;
  color: var(--text-muted);
  padding: 3px 10px;
  background: var(--bg-card);
  border-radius: 20px;
}

/* Project Badge */
.project-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid;
  letter-spacing: 0.3px;
  transition: var(--transition);
}

/* Reading Source Badges */
.source-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.source-badge.source-sergyan { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.source-badge.source-stroustrup { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.source-badge.source-cleancode { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.source-badge.source-online { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }

/* Quote */
.quote-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.05));
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.quote-card p {
  font-style: italic;
  color: var(--accent-light);
  font-size: 14px;
  line-height: 1.6;
}

/* Tips */
.tips-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.tips-header {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--yellow);
}

.tips-card p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Task Sections */
.task-section {
  margin-bottom: 28px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.section-count {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 3px 10px;
  border-radius: 20px;
}

/* Task Item */
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.task-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.task-item.completed {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.04);
}

.task-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: var(--transition);
  font-size: 13px;
  color: transparent;
}

.task-item.completed .task-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.task-text {
  flex: 1;
}

.task-text-main {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.task-item.completed .task-text-main {
  text-decoration: line-through;
  color: var(--text-secondary);
}

.task-text-details {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.5;
}

/* Notes Section */
.notes-section {
  margin-bottom: 32px;
}

.notes-section h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.notes-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
}

.notes-input-group {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.notes-input-group label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.notes-input-group input,
.notes-input-group textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
  resize: vertical;
}

.notes-input-group input:focus,
.notes-input-group textarea:focus {
  border-color: var(--accent);
}

.btn-save {
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-save:hover {
  background: var(--accent-light);
}

.btn-save.saved {
  background: var(--green);
}

/* Motivation */
.motivation-card {
  text-align: center;
  padding: 40px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.08), rgba(99, 102, 241, 0.05));
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: var(--radius);
}

.motivation-icon {
  font-size: 56px;
  margin-bottom: 12px;
}

.motivation-card h2 {
  font-size: 22px;
  color: var(--green);
  margin-bottom: 8px;
}

.motivation-card p {
  color: var(--text-secondary);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .main-content {
    margin-left: 0;
    padding: 20px 16px;
    padding-top: calc(var(--header-height) + 16px);
  }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.6);
  }

  .sidebar-close {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .notes-grid {
    grid-template-columns: 1fr;
  }

  .day-header-top {
    flex-wrap: wrap;
  }
}

@media (max-width: 500px) {
  .login-container {
    margin: 16px;
    padding: 28px 24px;
  }

  .day-header-info h1 {
    font-size: 20px;
  }

  .sidebar-stats {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    padding: 10px;
  }
}

/* ===================== ANIMATIONS ===================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-section {
  animation: fadeIn 0.3s ease;
}

.task-item {
  animation: fadeIn 0.2s ease;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  background: var(--green);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(20px); }
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
}

.sidebar-overlay.active {
  display: block;
}
