/* leitner.css — Leitner flashcard app styles */

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8f7f4;
  color: #1a1a1a;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.container-narrow { max-width: 520px; }

/* Headers */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.back-link {
  font-size: 0.875rem;
  color: #666;
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

header { margin-bottom: 2rem; }

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  color: #111;
}

.subtitle {
  color: #666;
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
}

/* Home */
.home-section {
  background: #fff;
  border: 1px solid #e5e2db;
  border-radius: 12px;
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.due-count-block {
  display: flex;
  flex-direction: column;
}

.due-count {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: #111;
}

.due-label {
  font-size: 0.9rem;
  color: #666;
  margin-top: 0.25rem;
}

.home-links {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.link-card {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid #e5e2db;
  border-radius: 8px;
  background: #fff;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s;
}

.link-card:hover { background: #f0ede8; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s, background 0.15s;
}

.btn-primary {
  background: #1a1a1a;
  color: #fff;
}

.btn-primary:hover { background: #333; }

.btn-secondary {
  background: #fff;
  color: #1a1a1a;
  border: 1px solid #e5e2db;
}

.btn-secondary:hover { background: #f0ede8; }

.btn-disabled, .btn[aria-disabled="true"] {
  opacity: 0.35;
  pointer-events: none;
}

.btn-correct {
  background: #d4edda;
  color: #155724;
  border: 1px solid #b8dab8;
}

.btn-correct:hover { background: #c3e6cb; }

.btn-wrong {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.btn-wrong:hover { background: #f1b0b7; }

/* Form */
.card-form { display: flex; flex-direction: column; gap: 1.5rem; }

.field { display: flex; flex-direction: column; gap: 0.4rem; }

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

textarea {
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  line-height: 1.5;
}

textarea:focus {
  outline: none;
  border-color: #1a1a1a;
}

.char-count {
  font-size: 0.75rem;
  color: #999;
  text-align: right;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.5rem;
}

.error-banner {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

/* Flashcard */
.flashcard {
  background: #fff;
  border: 1px solid #e5e2db;
  border-radius: 12px;
  padding: 2rem;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 1rem;
}

.card-text {
  font-size: 1.2rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.flashcard-back { border-top: 1px solid #eee; margin-top: 1.5rem; padding-top: 1.5rem; }

.review-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.review-buttons .btn {
  flex: 1;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.review-form { margin: 0; }

.btn-reveal {
  display: block;
  width: 100%;
  padding: 0.8rem;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
  color: #333;
}

.btn-reveal:hover { background: #f5f5f5; }

/* Progress bar */
.progress-bar {
  margin-bottom: 1.5rem;
  padding: 0.5rem 0;
}

.session-counts {
  display: flex;
  gap: 1.5rem;
  font-size: 0.875rem;
  color: #666;
}

.session-counts strong { color: #111; }

/* Cards table */
.cards-toolbar { margin-bottom: 1rem; }

.cards-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e2db;
  border-radius: 10px;
  overflow: hidden;
}

.cards-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8f7f4;
  border-bottom: 1px solid #e5e2db;
}

.cards-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f0ede8;
  font-size: 0.9rem;
  vertical-align: top;
}

.cards-table tr:last-child td { border-bottom: none; }
.cards-table tr:hover td { background: #faf9f7; }

.box-cell { color: #555; font-weight: 500; }

/* Session summary */
.summary-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.summary-stat {
  background: #fff;
  border: 1px solid #e5e2db;
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
}

.summary-number {
  display: block;
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
  color: #111;
}

.summary-label {
  display: block;
  font-size: 0.85rem;
  color: #666;
  margin-top: 0.5rem;
  text-transform: lowercase;
}

.summary-actions {
  display: flex;
  gap: 0.75rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  background: #fff;
  border: 1px solid #e5e2db;
  border-radius: 12px;
  color: #666;
}

.empty-state p { margin: 0 0 1.5rem; }

@media (max-width: 480px) {
  .summary-block { grid-template-columns: repeat(3, 1fr); }
  .summary-number { font-size: 1.8rem; }
  .home-section { flex-direction: column; align-items: flex-start; gap: 1.5rem; }
  .review-buttons { flex-direction: column; }
}