/* Modern variables for premium dark theme */
:root {
  --bg-color: #080c14;
  --card-bg: #1a2336;
  --card-border: rgba(255, 255, 255, 0.15);
  --accent-color: #3b82f6;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --text-primary: #ffffff;
  --text-secondary: #f1f5f9;
  --text-muted: #cbd5e1;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  justify-content: center;
  height: 100vh;
  padding: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.8s ease-in-out;
}

body.loaded {
  opacity: 1;
}

.app-container {
  width: 100%;
  max-width: 480px; /* Mobile width constraint */
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  padding: 16px;
  overflow: hidden;
}

/* Very small title at top & simple nav menu */
.app-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}

.app-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-weight: 700;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background-color: var(--card-bg);
  padding: 8px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  justify-content: center;
}

.nav-link {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 18px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-link.active {
  background-color: var(--accent-color);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#nav-learned {
  font-style: italic;
  font-variant: small-caps;
}

/* Main content area */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-section {
  display: none;
  flex-direction: column;
  flex-grow: 1;
  overflow: hidden;
  animation: fadeIn 0.3s ease-in-out;
}

.page-section.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Verbs mode switch: learn vs test */
.mode-selector {
  display: flex;
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid var(--card-border);
  margin-bottom: 24px;
}

.mode-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: capitalize;
}

.mode-btn.active {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* View switcher content containers */
.view-content {
  display: none;
  flex-direction: column;
  flex-grow: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 64px;
}

.view-content.active {
  display: flex;
}

/* Scroll lock exception for the flat learned page */
#page-learned.page-section.active {
  display: flex;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 24px;
}

/* Verbs List (Learn Mode) */
.verbs-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.verb-card {
  background-color: transparent;
  border-top: 1px solid transparent;
  border-bottom: 1px solid var(--card-border);
  border-radius: 0;
  padding: 6px 4px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
  cursor: pointer;
}

.verb-card:active {
  background-color: rgba(255, 255, 255, 0.02);
}

.verb-card.row-learned {
  background-color: rgba(16, 185, 129, 0.05) !important;
  border-top-color: rgba(16, 185, 129, 0.3) !important;
  border-bottom-color: rgba(16, 185, 129, 0.3) !important;
}

/* Prevent double-thickness on adjacent highlighted borders */
.verb-card.row-learned + .verb-card.row-learned {
  border-top-color: transparent !important;
}

.verb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.verb-num-eng {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verb-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  background-color: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

.verb-english {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.verb-details {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.verb-russian {
  font-size: 1.15rem;
  font-weight: 700;
  color: #10b981; /* Premium green */
}

.verb-pron {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.verb-example-box {
  margin-top: 4px;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.15);
  border-left: 3px solid var(--accent-color);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Test Mode UI - Card Flip styling */
.test-card-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex-grow: 1;
  margin-top: 0;
  padding-top: 0;
}

.test-card {
  width: 100%;
  aspect-ratio: 4 / 3;
  perspective: 1000px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  margin-top: 0;
  margin-bottom: 24px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.test-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.card-front {
  background: radial-gradient(circle at top right, #1e293b, var(--card-bg));
}

.card-back {
  background: radial-gradient(circle at top right, #0f172a, var(--card-bg));
  transform: rotateY(180deg);
}

.card-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  font-weight: 600;
}

.verb-meaning {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.tap-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 20px;
  border: 1px dashed var(--text-muted);
  padding: 4px 12px;
  border-radius: 9999px;
  animation: pulse 2s infinite;
}

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

.verb-cyrillic {
  font-size: 2.4rem;
  font-weight: 700;
  color: #10b981;
}

.pronunciation-badge {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 6px 16px;
  border-radius: 9999px;
  border: 1px solid var(--card-border);
}

.pronunciation-badge span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.example-container {
  margin-top: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.verb-example {
  font-size: 1rem;
  color: var(--text-primary);
  font-style: italic;
}

/* Action button for Next Verb */
.action-btn {
  width: 100%;
  background: var(--accent-gradient);
  border: none;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

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

/* About Page styling */
.about-card {
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  margin-top: 10px;
}

.about-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-color);
}

.about-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Video Link Card styling for embed-disabled videos */
.video-link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.03) 100%);
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 12px;
  padding: 14px 18px;
  text-decoration: none;
  margin-bottom: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.video-link-card:active {
  transform: scale(0.98);
  border-color: rgba(16, 185, 129, 0.5);
}

.video-icon {
  font-size: 2.2rem;
  line-height: 1;
}

.video-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.video-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: #34d399;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.video-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.video-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Learned Toggle & Reset styles */
.learned-toggle {
  background: transparent;
  border: none;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-muted);
  opacity: 0.3; /* "empty" look */
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), color 0.2s ease, opacity 0.2s ease, filter 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.learned-toggle:active {
  transform: scale(0.8);
}

.learned-toggle.is-learned {
  color: #10b981; /* Green checkmark */
  opacity: 1; /* Fully opaque */
  filter: drop-shadow(0 0 4px rgba(16, 185, 129, 0.4));
}

.card-toggle {
  position: absolute !important;
  top: 16px;
  right: 16px;
  z-index: 10;
}

.card-back .card-toggle {
  right: 16px !important;
  left: auto !important;
  transform: none !important;
}

/* Prevent opposite face checkmark from bleeding through */
.test-card.flipped .card-front .card-toggle {
  display: none !important;
}

.test-card:not(.flipped) .card-back .card-toggle {
  display: none !important;
}

.verb-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Progress bar header styles */
.app-progress-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.progress-divider {
  color: var(--text-muted);
  opacity: 0.5;
}

/* Clickable CSV learned list items style */
.learned-list-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0;
}

.learned-csv-item {
  cursor: pointer;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.learned-csv-item:hover,
.learned-csv-item.is-revealed {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.unlearn-x {
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.unlearn-x:hover {
  transform: scale(1.3);
  opacity: 0.8;
}


