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

:root {
  --primary: #2a3a79;
  --primary-rgb: 42, 58, 121;
  --primary-50: #eef1f8;
  --primary-100: #d4d9ec;
  --primary-700: #1e2d5f;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --text: #1a1e33;
  --text-secondary: #5c6278;
  --border: #e0e4ed;
  --radius-2xl: 24px;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-sm: 0 2px 8px rgba(42, 58, 121, 0.05);
  --shadow-md: 0 8px 24px rgba(42, 58, 121, 0.07);
  --shadow-lg: 0 20px 50px rgba(42, 58, 121, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(circle at 50% 0%, rgba(var(--primary-rgb), 0.045) 0%, transparent 50%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

p {
  margin: 0;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
  animation: pageIn 0.5s ease-out both;
}

.hero {
  background: linear-gradient(135deg, var(--primary-700) 0%, var(--primary) 45%, #3c50a0 100%);
  color: #fff;
  padding: 24px 20px;
  border-radius: var(--radius-2xl);
  display: grid;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.07) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -30%;
  left: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.hero-kicker {
  width: fit-content;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.hero h1 {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
}

.hero-metrics {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.metric-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: grid;
  gap: 2px;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease;
}

.metric-card:hover {
  background: rgba(255, 255, 255, 0.13);
}

.metric-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
  font-weight: 600;
}

.metric-card strong {
  font-size: 1.05rem;
  font-weight: 700;
}

.tabs-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-md);
  padding: 16px;
  display: grid;
  gap: 16px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--primary-50);
  padding: 4px;
  border-radius: var(--radius-lg);
  position: relative;
}

.tabs::after {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: var(--primary);
  border-radius: var(--radius-md);
  box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.3);
  transition: left 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  z-index: 0;
}

.tabs[data-active="kartice"]::after {
  left: 50%;
}

.tab-btn {
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  min-height: 44px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: color 0.2s ease;
  position: relative;
  z-index: 1;
}

.tab-btn:hover {
  color: var(--text);
}

.tab-btn.active {
  color: #fff;
}

.tab-btn:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.small-btn:focus-visible,
.search-field input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tab-panel {
  animation: panelIn 0.25s ease both;
}

.list-toolbar {
  display: grid;
  gap: 16px;
}

.list-toolbar h2 {
  font-size: 1.35rem;
  font-weight: 700;
}

.section-lead {
  margin-top: 4px;
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 0.88rem;
}

.search-field {
  display: grid;
  gap: 6px;
}

.search-field span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

.search-field input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-field input::placeholder {
  color: #9ca3b4;
}

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

.status-row {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.84rem;
  min-height: 1.3em;
}

.question-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.question-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  transition: box-shadow 0.15s ease;
}

.question-meta {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
}

.question-title {
  font-size: 0.95rem;
  line-height: 1.5;
  font-weight: 500;
}

.category-tag {
  width: fit-content;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--primary);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
  border-radius: 999px;
  padding: 3px 10px;
}

.answer-text {
  border-radius: var(--radius-md);
  border: 1px solid var(--primary-100);
  background: var(--primary-50);
  padding: 12px 14px;
  line-height: 1.55;
  font-size: 0.9rem;
}

.small-btn,
.primary-btn,
.secondary-btn {
  border: none;
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: 0 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.small-btn {
  justify-self: start;
  color: var(--primary);
  background: var(--primary-50);
  border: 1px solid var(--primary-100);
}

.primary-btn {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.25);
}

.primary-btn:hover {
  background: var(--primary-700);
  box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.3);
}

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

.small-btn:disabled,
.primary-btn:disabled,
.secondary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
  box-shadow: none;
}

.empty-state {
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
  padding: 24px 16px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.9rem;
}

.flashcard-shell {
  display: grid;
  gap: 16px;
}

.flashcard-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  flex-wrap: wrap;
}

.progress-bar {
  height: 4px;
  background: var(--primary-50);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #3c50a0);
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}

.flashcard {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  min-height: 220px;
  padding: 28px 20px;
  box-shadow: var(--shadow-md);
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

.flashcard.is-flipping {
  animation: flashFlip 460ms cubic-bezier(0.45, 0.05, 0.2, 1);
}

.flash-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-50);
  padding: 4px 14px;
  border-radius: 999px;
}

#flash-pitanje {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  max-width: 38ch;
}

.flash-category {
  background: var(--primary-50);
  border-color: var(--primary-100);
  color: var(--primary);
}

#flash-odgovor {
  margin-top: 4px;
  line-height: 1.55;
}

.flash-actions {
  display: grid;
  gap: 8px;
}

.page-footer {
  color: var(--text-secondary);
  text-align: center;
  font-size: 0.78rem;
  padding: 8px 0;
  opacity: 0.7;
}

[hidden] {
  display: none !important;
}

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

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

@keyframes flashFlip {
  0% {
    opacity: 1;
    transform: perspective(1100px) rotateY(0deg) scale(1);
  }
  49% {
    opacity: 0.3;
    transform: perspective(1100px) rotateY(90deg) scale(0.97);
  }
  51% {
    opacity: 0.3;
    transform: perspective(1100px) rotateY(-90deg) scale(0.97);
  }
  100% {
    opacity: 1;
    transform: perspective(1100px) rotateY(0deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flashcard.is-flipping {
    animation: none;
  }
  .page-shell {
    animation: none;
  }
}

@media (hover: hover) {
  .question-item:hover {
    box-shadow: var(--shadow-sm);
  }

  .small-btn:hover,
  .primary-btn:hover,
  .secondary-btn:hover {
    transform: translateY(-1px);
  }
}

@media (min-width: 640px) {
  .page-shell {
    padding: 28px 24px;
    gap: 20px;
  }

  .hero {
    padding: 40px 36px;
    gap: 16px;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .hero-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .tabs-wrap {
    padding: 20px;
    gap: 20px;
  }

  .list-toolbar {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .search-field {
    width: 300px;
  }

  .list-toolbar h2 {
    font-size: 1.5rem;
  }

  .flashcard {
    min-height: 280px;
    padding: 40px 36px;
  }

  #flash-pitanje {
    font-size: 1.5rem;
  }

  .flash-actions {
    max-width: 280px;
    margin: 0 auto;
    width: 100%;
  }
}

@media (min-width: 1024px) {
  .page-shell {
    padding: 40px 16px;
    gap: 24px;
  }

  .hero {
    padding: 52px 48px;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .tabs-wrap {
    padding: 28px;
  }

  .list-toolbar h2 {
    font-size: 1.65rem;
  }

  .flashcard {
    min-height: 320px;
    padding: 52px 48px;
  }

  #flash-pitanje {
    font-size: 1.8rem;
  }
}
