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

/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #fdf2f8 0%, #faf5ff 100%);
  min-height: 100vh;
  color: #5c1d40;
}

a { color: inherit; text-decoration: none; }

/* ── Keyframes ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes popIn {
  0%   { transform: scale(0.9); opacity: 0; }
  70%  { transform: scale(1.03); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Gradient text helper ── */
.grad-text {
  background: linear-gradient(135deg, #ec4899, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── App header ── */
.app-header {
  background: #fff;
  border-bottom: 1.5px solid #fce7f3;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(236,72,153,0.08);
}
.app-header .logo {
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.app-header .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.app-header .username {
  font-size: 14px;
  font-weight: 700;
  color: #c4698b;
}

/* ── Buttons ── */
.btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 14px;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover  { transform: translateY(-2px); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #f472b6, #ec4899);
  color: #fff;
  box-shadow: 0 3px 12px rgba(236,72,153,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 18px rgba(236,72,153,0.45); }

.btn-secondary {
  background: linear-gradient(135deg, #fce7f3, #fbcfe8);
  color: #be185d;
  box-shadow: 0 2px 8px rgba(236,72,153,0.15);
}
.btn-secondary:hover { box-shadow: 0 4px 14px rgba(236,72,153,0.25); }

.btn-purple {
  background: linear-gradient(135deg, #c084fc, #a855f7);
  color: #fff;
  box-shadow: 0 3px 12px rgba(168,85,247,0.35);
}
.btn-purple:hover { box-shadow: 0 6px 18px rgba(168,85,247,0.45); }

.btn-ghost {
  background: transparent;
  color: #c4698b;
  box-shadow: none;
  font-size: 13px;
}
.btn-ghost:hover { background: #fce7f3; transform: none; }

.btn-danger {
  background: linear-gradient(135deg, #fca5a5, #f87171);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.btn-sm { font-size: 12px; padding: 0.35rem 0.85rem; }

/* ── Page container ── */
.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  animation: fadeUp 0.4s ease both;
}

/* ── Cards ── */
.card {
  background: #fff;
  border: 1.5px solid #fce7f3;
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(236,72,153,0.08);
  transition: box-shadow 0.2s, transform 0.2s;
}
.card:hover {
  box-shadow: 0 8px 28px rgba(236,72,153,0.14);
}

/* ── Auth page ── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(135deg, #fdf2f8 0%, #faf5ff 100%);
}
.auth-card {
  background: #fff;
  border: 1.5px solid #fce7f3;
  border-radius: 28px;
  padding: 2.5rem 2.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 10px 50px rgba(236,72,153,0.15);
  animation: popIn 0.4s cubic-bezier(0.34,1.56,0.64,1) both;
}
.auth-card h1 {
  font-size: 2.4rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 0.25rem;
  background: linear-gradient(135deg, #ec4899, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.auth-subtitle {
  text-align: center;
  font-size: 14px;
  color: #c4698b;
  font-weight: 600;
  margin-bottom: 1.75rem;
}
.auth-tabs {
  display: flex;
  background: #fff0f6;
  border: 1.5px solid #f9a8d4;
  border-radius: 50px;
  padding: 4px;
  margin-bottom: 1.5rem;
}
.auth-tab {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #c4698b;
  padding: 0.45rem;
  border-radius: 50px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  user-select: none;
}
.auth-tab.active {
  background: linear-gradient(135deg, #f472b6, #ec4899);
  color: #fff;
  box-shadow: 0 3px 10px rgba(236,72,153,0.35);
}

/* ── Form inputs ── */
.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: #e879a0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  font-family: 'Nunito', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #5c1d40;
  background: #fff5f9;
  border: 1.5px solid #f9a8d4;
  border-radius: 12px;
  padding: 0.7rem 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field textarea { resize: vertical; min-height: 90px; }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: #ec4899;
  box-shadow: 0 0 0 3px rgba(236,72,153,0.15);
}
.field input::placeholder,
.field textarea::placeholder { color: #e4aac5; }

.field-row { display: flex; gap: 0.75rem; }
.field-row .field { flex: 1; }

.btn-full { width: 100%; justify-content: center; font-size: 15px; padding: 0.75rem; }

/* ── Error / success messages ── */
.msg {
  border-radius: 12px;
  padding: 0.75rem 1rem;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 1rem;
  display: none;
  animation: popIn 0.3s ease both;
}
.msg.error  { background: #fff0f6; border: 1.5px solid #f9a8d4; color: #9d174d; }
.msg.success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.msg.show   { display: block; }

/* ── Section headers ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-header h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #6b2150;
}

/* ── Deck grid ── */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.deck-card {
  background: linear-gradient(135deg, #fff0f6, #fdf3ff);
  border: 1.5px solid #f9a8d4;
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  animation: fadeUp 0.3s ease both;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.deck-card:hover {
  box-shadow: 0 8px 24px rgba(236,72,153,0.18);
  transform: translateY(-3px);
}
.deck-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: #6b2150;
}
.deck-card .deck-meta {
  font-size: 12px;
  font-weight: 700;
  color: #c4698b;
}
.deck-card .deck-desc {
  font-size: 13px;
  color: #a0527a;
  line-height: 1.4;
  flex: 1;
}
.deck-card .deck-actions {
  display: flex;
  gap: 6px;
  margin-top: 0.5rem;
}

/* New deck card (create button) */
.deck-card-new {
  background: #fff;
  border: 2px dashed #f9a8d4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #e879a0;
  font-weight: 800;
  font-size: 14px;
  min-height: 140px;
}
.deck-card-new:hover {
  background: #fff0f6;
  border-color: #ec4899;
  color: #be185d;
}
.deck-card-new .plus {
  font-size: 2rem;
  line-height: 1;
}

/* ── Modal ── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(100, 20, 60, 0.25);
  backdrop-filter: blur(3px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border: 1.5px solid #fce7f3;
  border-radius: 24px;
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(236,72,153,0.2);
  animation: popIn 0.3s cubic-bezier(0.34,1.56,0.64,1) both;
}
.modal h3 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #6b2150;
  margin-bottom: 1.25rem;
}
.modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

/* ── Question list ── */
.question-list { display: flex; flex-direction: column; gap: 0.75rem; }
.q-item {
  background: linear-gradient(135deg, #fff0f6, #fdf3ff);
  border: 1.5px solid #f9a8d4;
  border-radius: 14px;
  overflow: hidden;
  animation: fadeUp 0.3s ease both;
}
.q-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  gap: 1rem;
}
.q-item-header:hover { background: rgba(249,168,212,0.12); }
.q-item-topic {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: linear-gradient(90deg, #ec4899, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
}
.q-item-question {
  font-size: 14px;
  font-weight: 700;
  color: #6b2150;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.q-item-actions { display: flex; gap: 4px; flex-shrink: 0; }
.q-item-body {
  display: none;
  padding: 0 1.1rem 1rem;
  border-top: 1px solid #fce7f3;
}
.q-item-body.open { display: block; }
.q-item-body .answer-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #e879a0;
  margin: 0.75rem 0 0.4rem;
}
.q-item-body .answer-text {
  font-size: 13px;
  font-weight: 600;
  color: #a0527a;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #c4698b;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.empty-state p { font-size: 15px; font-weight: 700; }
.empty-state .empty-sub { font-size: 13px; font-weight: 600; margin-top: 0.35rem; opacity: 0.75; }

/* ── Practice sets section (Jasmine only) ── */
.practice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}
.practice-card {
  background: linear-gradient(135deg, #fdf3ff, #f5f3ff);
  border: 1.5px solid #e9d5ff;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  transition: box-shadow 0.2s, transform 0.2s;
  display: block;
}
.practice-card:hover {
  box-shadow: 0 6px 20px rgba(168,85,247,0.18);
  transform: translateY(-2px);
}
.practice-card .pc-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #a855f7;
  margin-bottom: 0.35rem;
}
.practice-card .pc-title {
  font-size: 14px;
  font-weight: 800;
  color: #6b21a8;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1.5px solid #fce7f3;
  margin: 2rem 0;
}

/* ── Spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid #fce7f3;
  border-top-color: #ec4899;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 800;
  color: #c4698b;
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}
.back-link:hover { color: #ec4899; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .auth-card { padding: 2rem 1.5rem; }
  .page { padding: 1.5rem 1rem 3rem; }
  .app-header { padding: 0 1rem; }
  .deck-grid { grid-template-columns: 1fr; }
}
