/**
 * Paper-to-Speech Styles
 * ======================
 * Mobile-first PWA styling with safe area insets
 */

/* CSS Variables */
:root {
  /* Colors */
  --color-primary: #4A90D9;
  --color-primary-dark: #3A7BC8;
  --color-primary-light: #6BA5E7;
  --color-success: #4CAF50;
  --color-warning: #FF9800;
  --color-error: #F44336;

  /* Neutrals */
  --color-bg: #FFFFFF;
  --color-bg-secondary: #F5F7FA;
  --color-bg-card: #FFFFFF;
  --color-text: #1A1A2E;
  --color-text-secondary: #6B7280;
  --color-text-muted: #9CA3AF;
  --color-border: #E5E7EB;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Touch targets */
  --touch-target: 44px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* Safe area insets (for notched phones) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Layout */
  --header-height: 60px;
  --tab-nav-height: 60px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #1A1A2E;
    --color-bg-secondary: #16213E;
    --color-bg-card: #0F3460;
    --color-text: #E5E7EB;
    --color-text-secondary: #9CA3AF;
    --color-text-muted: #6B7280;
    --color-border: #374151;
  }
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans KR', sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* App container */
#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: calc(var(--tab-nav-height) + var(--safe-bottom));
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-md);
  padding-top: calc(var(--space-md) + var(--safe-top));
  text-align: center;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  margin: 0;
}

.app-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin: var(--space-xs) 0 0;
}

/* Main content */
.main-content {
  flex: 1;
  padding: var(--space-md);
  padding-left: calc(var(--space-md) + var(--safe-left));
  padding-right: calc(var(--space-md) + var(--safe-right));
  overflow-y: auto;
}

/* Bottom tab navigation */
.tab-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
  background: var(--color-bg);
  border-top: 1px solid var(--color-border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--tab-nav-height);
  padding: var(--space-sm);
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn:active {
  background: var(--color-bg-secondary);
}

.tab-btn.active {
  color: var(--color-primary);
}

.tab-icon {
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.tab-label {
  font-weight: 500;
  font-size: 0.7rem;
}

/* Cards */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-text);
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
}

.tag.venue {
  background: var(--color-primary-light);
  color: white;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-border);
}

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

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

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.875rem;
}

.btn-lg {
  min-height: 52px;
  padding: var(--space-md) var(--space-xl);
  font-size: 1.125rem;
}

/* Button group */
.btn-group {
  display: flex;
  gap: var(--space-sm);
}

.btn-group .btn {
  flex: 1;
}

/* Input fields */
.input-group {
  margin-bottom: var(--space-md);
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

.input {
  width: 100%;
  min-height: var(--touch-target);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.1);
}

.input.error {
  border-color: var(--color-error);
}

textarea.input {
  min-height: 100px;
  resize: vertical;
}

/* Script sentences */
.script-list {
  list-style: none;
}

.script-item {
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
}

.script-item.completed {
  border-left-color: var(--color-success);
  opacity: 0.7;
}

.script-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-xs);
}

.script-en {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: var(--space-xs);
}

.script-ko {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* Cloze exercise */
.cloze-item {
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.cloze-sentence {
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.cloze-blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 600;
}

.cloze-input {
  display: inline-block;
  width: 120px;
  padding: var(--space-xs) var(--space-sm);
  border: none;
  border-bottom: 2px solid var(--color-primary);
  background: transparent;
  font-size: 1rem;
  color: var(--color-text);
}

.cloze-input:focus {
  outline: none;
  border-bottom-color: var(--color-primary-dark);
}

.cloze-result {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.cloze-result.correct {
  background: rgba(76, 175, 80, 0.1);
  color: var(--color-success);
}

.cloze-result.incorrect {
  background: rgba(244, 67, 54, 0.1);
  color: var(--color-error);
}

.cloze-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* SRS Review */
.srs-card {
  text-align: center;
  padding: var(--space-xl);
}

.srs-phrase {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-md);
}

.srs-hint {
  font-size: 1rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.srs-example {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-style: italic;
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}

.srs-buttons {
  display: flex;
  gap: var(--space-md);
}

.srs-buttons .btn {
  flex: 1;
}

/* Archive list */
.archive-list {
  list-style: none;
}

.archive-item {
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--color-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.archive-date {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

.archive-text {
  font-size: 0.875rem;
  color: var(--color-text);
}

.archive-delete {
  margin-top: var(--space-sm);
  font-size: 0.75rem;
  color: var(--color-error);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
}

/* Progress */
.progress-bar {
  height: 8px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.step-indicator {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.step-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-border);
}

.step-dot.active {
  background: var(--color-primary);
}

.step-dot.completed {
  background: var(--color-success);
}

/* Skeleton loading */
.loading-skeleton {
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line {
  height: 16px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
}

.skeleton-line.short {
  width: 60%;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--space-md));
  left: var(--space-md);
  right: var(--space-md);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--color-text);
  color: var(--color-bg);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  pointer-events: auto;
}

.toast.success {
  background: var(--color-success);
  color: white;
}

.toast.error {
  background: var(--color-error);
  color: white;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: var(--space-md);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.modal-content h2 {
  margin-bottom: var(--space-md);
  color: var(--color-text);
}

.modal-content p {
  color: var(--color-text-secondary);
  margin-bottom: var(--space-md);
}

.modal-content .tip {
  font-size: 0.875rem;
  color: var(--color-primary);
  font-weight: 500;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-xl);
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.empty-state-text {
  font-size: 0.875rem;
}

/* Speech controls */
.speech-controls {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.speech-btn {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
}

.speech-btn:hover {
  background: var(--color-border);
}

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

/* Checklist */
.checklist {
  list-style: none;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  cursor: pointer;
}

.checklist-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checklist-item.checked .checklist-checkbox {
  background: var(--color-success);
  border-color: var(--color-success);
  color: white;
}

.checklist-label {
  font-size: 0.875rem;
  color: var(--color-text);
}

.checklist-item.checked .checklist-label {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* Disclaimer */
.disclaimer {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-md);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-lg);
}

/* Utilities */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-success {
  color: var(--color-success);
}

.text-error {
  color: var(--color-error);
}

.mt-md {
  margin-top: var(--space-md);
}

.mb-md {
  margin-bottom: var(--space-md);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* ==========================================================================
   Paper Navigation Styles
   ========================================================================== */

.paper-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border);
}

.paper-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-nav-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: white;
}

.paper-nav-btn:active {
  transform: scale(0.95);
}

.paper-nav-info {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Paper list modal */
.paper-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 60vh;
  overflow-y: auto;
}

.paper-list-item {
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.paper-list-item:hover {
  border-color: var(--color-primary);
  background: var(--color-bg-secondary);
}

.paper-list-item.active {
  border-color: var(--color-primary);
  background: rgba(74, 144, 217, 0.1);
}

.paper-list-venue {
  font-size: 0.75rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.paper-list-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.4;
  margin-bottom: var(--space-xs);
}

.paper-list-meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.tag-sm {
  display: inline-block;
  padding: 2px 6px;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

/* ==========================================================================
   TOEFL Speaking Styles
   ========================================================================== */

/* Task selection buttons */
.toefl-task-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.toefl-task-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-bg);
}

.toefl-task-btn:active {
  transform: scale(0.98);
}

.toefl-task-icon {
  font-size: 2rem;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.toefl-task-info {
  flex: 1;
}

.toefl-task-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
}

.toefl-task-desc {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.toefl-task-time {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Timer */
.toefl-timer {
  font-size: 4rem;
  font-weight: 700;
  text-align: center;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.toefl-timer.large {
  font-size: 5rem;
}

.toefl-timer.warning {
  color: var(--color-warning);
}

.toefl-timer.danger {
  color: var(--color-error);
  animation: pulse 0.5s ease-in-out infinite;
}

/* Phase indicator */
.toefl-phase-indicator {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.phase-badge {
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--color-bg-secondary);
  color: var(--color-text-muted);
}

.phase-badge.active {
  background: var(--color-primary);
  color: white;
}

.phase-badge.completed {
  background: var(--color-success);
  color: white;
}

/* Question display */
.toefl-question {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text);
}

.toefl-question-small {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* Lecture content */
.toefl-lecture {
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--color-primary);
}

.toefl-lecture h5 {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-sm);
}

/* Hints */
.toefl-hints {
  padding: var(--space-md);
  background: rgba(74, 144, 217, 0.1);
  border-radius: var(--radius-md);
}

.toefl-hints h5 {
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

.toefl-hints ul {
  padding-left: var(--space-lg);
  margin: 0;
}

.toefl-hints li {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-xs);
}

/* Recording indicator */
.toefl-recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-primary);
}

.recording-dot {
  width: 12px;
  height: 12px;
  background: var(--color-error);
  border-radius: 50%;
  animation: pulse 1s ease-in-out infinite;
}

/* Self evaluation */
.toefl-self-eval {
  text-align: center;
}

.toefl-score-buttons {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.score-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  font-size: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.score-btn:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  color: white;
}

.score-btn:active {
  transform: scale(0.95);
}

/* Speak card */
.toefl-speak-card {
  text-align: center;
  padding: var(--space-xl);
}

/* Stats card */
.toefl-stats {
  display: flex;
  justify-content: space-around;
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.toefl-stat {
  text-align: center;
}

.toefl-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.toefl-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* History list */
.toefl-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.875rem;
}

.toefl-history-task {
  font-weight: 500;
}

.toefl-history-score {
  color: var(--color-primary);
  font-weight: 600;
}

/* Tip box */
.toefl-tip {
  padding: var(--space-md);
  background: rgba(74, 144, 217, 0.1);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--color-primary);
  margin-top: var(--space-md);
}

/* ==========================================================================
   Vocabulary Flashcard Styles
   ========================================================================== */

/* Stats bar */
.vocab-stats {
  display: flex;
  justify-content: space-around;
  padding: var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.vocab-stat {
  text-align: center;
}

.vocab-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.vocab-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Flashcard */
.flashcard {
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.flashcard:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.flashcard.flipped {
  background: rgba(74, 144, 217, 0.05);
  border-color: var(--color-primary);
}

.flashcard-word {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.flashcard-pos {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.flashcard-meaning {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin-top: var(--space-md);
  text-align: center;
}

.flashcard-example {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-top: var(--space-md);
  text-align: center;
  line-height: 1.6;
  max-width: 300px;
}

.flashcard-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: var(--space-lg);
}

.flashcard-status {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

.flashcard-status.new {
  background: rgba(74, 144, 217, 0.2);
  color: var(--color-primary);
}

.flashcard-status.learning {
  background: rgba(255, 193, 7, 0.2);
  color: var(--color-warning);
}

.flashcard-status.learned {
  background: rgba(76, 175, 80, 0.2);
  color: var(--color-success);
}

/* Answer buttons */
.vocab-answer-buttons {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.vocab-answer-btn {
  flex: 1;
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  background: var(--color-bg);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vocab-answer-btn.wrong {
  color: var(--color-error);
}

.vocab-answer-btn.wrong:hover {
  background: rgba(244, 67, 54, 0.1);
  border-color: var(--color-error);
}

.vocab-answer-btn.correct {
  color: var(--color-success);
}

.vocab-answer-btn.correct:hover {
  background: rgba(76, 175, 80, 0.1);
  border-color: var(--color-success);
}

/* Vocabulary list */
.vocab-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vocab-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.vocab-list-word {
  font-weight: 600;
  color: var(--color-text);
}

.vocab-list-meaning {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.vocab-list-status {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
}

/* Progress indicator */
.vocab-progress {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
}

/* Tab switcher within vocab page */
.vocab-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.vocab-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vocab-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* ==========================================================================
   Admin Dashboard Styles
   ========================================================================== */

/* Admin navigation */
.admin-nav {
  display: flex;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-nav-btn {
  flex: 1;
  min-width: 70px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.admin-nav-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

/* Stats grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.admin-stat-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.admin-stat-icon {
  font-size: 1.5rem;
}

.admin-stat-info {
  flex: 1;
}

.admin-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.admin-stat-label {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.admin-stat-sub {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  margin-top: var(--space-xs);
}

/* Popular papers list */
.admin-popular-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-popular-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-popular-item:last-child {
  border-bottom: none;
}

.admin-popular-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-popular-title {
  flex: 1;
  font-size: 0.875rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-popular-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Paper list */
.admin-paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-paper-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-sm);
}

.admin-paper-info {
  flex: 1;
  min-width: 0;
}

.admin-paper-venue {
  font-size: 0.7rem;
  color: var(--color-primary);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.admin-paper-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}

.admin-paper-id {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  font-family: monospace;
}

.admin-paper-actions {
  display: flex;
  gap: var(--space-xs);
  flex-shrink: 0;
}

/* Word list */
.admin-word-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-word-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.admin-word-item:last-child {
  border-bottom: none;
}

.admin-word-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-word-info {
  flex: 1;
  min-width: 0;
}

.admin-word-text {
  font-weight: 600;
  color: var(--color-text);
}

.admin-word-meaning {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-left: var(--space-sm);
}

.admin-word-count {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Event list */
.admin-event-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.admin-event-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
  font-size: 0.75rem;
}

.admin-event-type {
  font-weight: 600;
  color: var(--color-primary);
}

.admin-event-time {
  color: var(--color-text-secondary);
}

.admin-event-session {
  color: var(--color-text-muted);
  font-family: monospace;
}

.admin-event-meta {
  margin-top: var(--space-xs);
  color: var(--color-text-muted);
  font-family: monospace;
  font-size: 0.7rem;
  word-break: break-all;
}

/* PDF Upload & Preview Styles */
.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.loading-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  text-align: center;
}

.loading-indicator p {
  margin-top: var(--space-md);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-left: var(--space-xs);
}

.badge-success {
  background: var(--color-success);
  color: white;
}

.badge-warning {
  background: var(--color-warning);
  color: white;
}

/* Script Item Display */
.script-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.script-item:last-child {
  border-bottom: none;
}

.script-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.script-text {
  color: var(--color-text);
  font-size: 0.9rem;
}

/* Paper Meta & Tags */
.paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.paper-takeaway {
  background: var(--color-bg-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.paper-keywords {
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* Text preview */
.text-preview {
  background: var(--color-bg-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-family: monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 200px;
  overflow-y: auto;
  color: var(--color-text-muted);
}

/* Print styles */
@media print {
  .tab-nav,
  .toast-container,
  .modal {
    display: none !important;
  }

  #app {
    padding-bottom: 0;
  }
}
