/**
 * Flashcard Maker — DOLY Studio
 * Design System: Notion (rules/design-system/notion/DESIGN.md)
 * Overrides base.css CSS variables + service-specific styles only.
 */

/* ============================================================
   Notion Design System Overrides (Dark)
   ============================================================ */
:root {
  --accent: #5645d4;
  --accent-hover: #4534b3;
  --accent-soft: rgba(86, 69, 212, 0.12);
  --bg: #0a1530;
  --bg-elevated: #101d3e;
  --bg-card: #131b38;
  --bg-hover: #1a2a52;
  --border: #253560;
  --border-subtle: #1e2d55;
  --text-primary: #ffffff;
  --text-secondary: #a4a097;
  --text-muted: #787671;
  --danger: #e03131;
  --warning: #dd5b00;
  --success: #1aae39;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 20px rgba(86, 69, 212, 0.15);
  --card-radius: 12px;
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --accent: #5645d4;
  --accent-hover: #4534b3;
  --accent-soft: rgba(86, 69, 212, 0.08);
  --bg: #ffffff;
  --bg-elevated: #f6f5f4;
  --bg-card: #ffffff;
  --bg-hover: #f0eeec;
  --border: #e5e3df;
  --border-subtle: #ede9e4;
  --text-primary: #1a1a1a;
  --text-secondary: #5d5b54;
  --text-muted: #a4a097;
  --shadow-sm: rgba(15, 15, 15, 0.04) 0px 1px 2px 0px;
  --shadow-md: rgba(15, 15, 15, 0.08) 0px 4px 12px 0px;
  --shadow-lg: rgba(15, 15, 15, 0.16) 0px 16px 48px -8px;
  --shadow-glow: none;
}

body {
  font-family: var(--font-family);
}

/* Override header background for Notion navy */
.global-header {
  background: rgba(10, 21, 48, 0.9);
}
[data-theme="light"] .global-header {
  background: rgba(255, 255, 255, 0.92);
}

/* Override primary button for Notion purple */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md), 0 0 30px rgba(86, 69, 212, 0.2);
}

/* ============================================================
   Review Badge
   ============================================================ */
.review-badge-wrap {
  margin-bottom: 20px;
}
.review-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--card-radius);
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.review-badge-icon {
  font-size: 22px;
}
.btn-review-now {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-review-now:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
.btn-review-now:active {
  transform: scale(0.97);
}

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.btn-sm {
  padding: 8px 18px;
  font-size: 13px;
}
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.deck-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.deck-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.deck-card:active {
  transform: scale(0.98);
}
.deck-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}
.deck-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deck-card-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}
.deck-card-meta .badge {
  font-size: 11px;
}
.deck-card-review {
  background: rgba(86, 69, 212, 0.12);
  color: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-state p {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.6;
}

/* Limit Message */
.limit-msg {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(245, 197, 24, 0.08);
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--warning);
  margin-top: 12px;
}
.limit-icon {
  font-size: 16px;
}

/* ============================================================
   Deck Editor
   ============================================================ */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.btn-danger {
  color: var(--danger);
}
.btn-danger:hover {
  color: #ff4444;
}
.editor-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}
.editor-meta input {
  font-size: 16px;
  font-weight: 600;
}
.editor-meta input:first-child {
  font-size: 20px;
  font-weight: 700;
}

/* Card Adder */
.card-adder {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--card-radius);
  padding: 20px;
  margin-bottom: 20px;
}
.card-adder-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}
.card-adder-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.card-adder-fields textarea {
  resize: vertical;
  min-height: 60px;
}

/* Card List */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.card-item {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  transition: all var(--transition-fast);
}
.card-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.card-item-text {
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-item-front {
  font-weight: 500;
}
.card-item-back {
  color: var(--text-secondary);
}
.card-item-actions {
  display: flex;
  gap: 4px;
}
.card-item-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}
.card-item-actions button:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.card-item-actions .btn-del:hover {
  color: var(--danger);
}

/* Editor Actions */
.editor-actions {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

/* ============================================================
   Study Mode
   ============================================================ */
.study-mode {
  min-height: 400px;
}
.study-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.study-progress-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.flashcard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
}
.flashcard {
  width: 100%;
  max-width: 520px;
  min-height: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  position: relative;
}
.flashcard:hover {
  box-shadow: var(--shadow-lg);
}
.flashcard-face {
  text-align: center;
  width: 100%;
}
.flashcard-face p {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  word-break: break-word;
  white-space: pre-wrap;
}
.flashcard-back p {
  color: var(--accent);
}
.btn-show-answer {
  min-width: 200px;
}
.rating-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.btn-rate {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  min-width: 90px;
}
.btn-rate:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.btn-rate:active {
  transform: scale(0.97);
}
.btn-rate--again {
  border-color: var(--danger);
  color: var(--danger);
}
.btn-rate--again:hover {
  background: rgba(224, 49, 49, 0.1);
}
.btn-rate--hard {
  border-color: var(--warning);
  color: var(--warning);
}
.btn-rate--hard:hover {
  background: rgba(221, 91, 0, 0.1);
}
.btn-rate--good {
  border-color: var(--success);
  color: var(--success);
}
.btn-rate--good:hover {
  background: rgba(26, 174, 57, 0.1);
}
.btn-rate--easy {
  border-color: var(--accent);
  color: var(--accent);
}
.btn-rate--easy:hover {
  background: var(--accent-soft);
}

/* Study Complete */
.study-complete {
  text-align: center;
  padding: 48px 20px;
}
.complete-icon {
  font-size: 56px;
  margin-bottom: 16px;
}
.study-complete h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: -0.3px;
}
.complete-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-bottom: 32px;
}
.complete-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.complete-stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}
.complete-stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
  .card-adder-fields {
    grid-template-columns: 1fr;
  }
  .card-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .card-item-actions {
    justify-content: flex-end;
  }
  .deck-grid {
    grid-template-columns: 1fr;
  }
  .rating-buttons {
    gap: 8px;
  }
  .btn-rate {
    padding: 10px 16px;
    min-width: 70px;
    font-size: 13px;
  }
  .complete-stats {
    gap: 16px;
  }
  .flashcard {
    padding: 28px 20px;
    min-height: 180px;
  }
  .flashcard-face p {
    font-size: 17px;
  }
  .review-badge {
    flex-wrap: wrap;
  }
  .btn-review-now {
    margin-left: 0;
    width: 100%;
    text-align: center;
  }
}
