/**
 * Responsive & content — fluid typography, touch targets, breakpoints, content layout
 * Gen Z / Millennial polish: selection, focus, motion.
 */

/* ----- Global aesthetics ----- */
html {
  scroll-behavior: smooth;
}
::selection {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
::-moz-selection {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--app-primary);
  outline-offset: 2px;
}
.app-main {
  animation: app-content-in 0.4s var(--app-ease-out);
}
@keyframes app-content-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ----- Fluid typography & spacing ----- */
:root {
  --app-text-xs: clamp(0.6875rem, 1.5vw, 0.75rem);
  --app-text-sm: clamp(0.8125rem, 1.8vw, 0.875rem);
  --app-text-base: clamp(0.875rem, 2vw, 1rem);
  --app-text-lg: clamp(1rem, 2.2vw, 1.125rem);
  --app-text-xl: clamp(1.125rem, 2.5vw, 1.25rem);
  --app-text-2xl: clamp(1.25rem, 3vw, 1.5rem);
  --app-space: clamp(12px, 3vw, 20px);
  --app-space-lg: clamp(20px, 5vw, 32px);
  --app-content-max: 720px;
}

/* Touch targets: min 44x44px (Apple HIG) */
.app-header-btn,
.app-tab,
.hub-item,
.flow-card,
.explore-tile,
.topic-item,
.note-card,
.mock-card,
.profile-action-btn,
.notification-item,
.btn-primary-block {
  min-height: 44px;
}
.app-tab {
  min-height: 56px;
}
.hub-icon-wrap {
  min-width: 56px;
  min-height: 56px;
}

/* Primary CTA — gradient, glow on hover */
.btn-primary-block {
  padding: 16px 24px;
  background: var(--app-gradient-primary);
  color: #fff;
  border: none;
  border-radius: var(--app-radius-lg);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow var(--app-duration) var(--app-ease), transform var(--app-duration-fast) var(--app-ease);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-primary-block:hover {
  box-shadow: var(--app-shadow-glow), 0 6px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.btn-primary-block:active {
  transform: translateY(0);
}

/* Main content: side padding on all devices */
.app-main-inner {
  padding-left: var(--app-space);
  padding-right: var(--app-space);
}

/* Page content: readable width on large screens */
.page-content,
.flow-cards,
.dashboard-hub,
.progress-card,
.practice-earn-card,
.notifications-list,
.explore-grid {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--app-content-max);
}
.page-content {
  padding: var(--app-space) var(--app-space) var(--app-space-lg);
}
.page-title {
  font-size: var(--app-text-2xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--app-space);
  line-height: 1.28;
  color: var(--app-text);
}
.page-subtitle {
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
  margin-bottom: var(--app-space);
  line-height: 1.55;
}
.feature-list li {
  line-height: 1.5;
}

/* Section headings */
.section-head {
  font-size: var(--app-text-lg);
  font-weight: 600;
  margin-bottom: var(--app-space);
  padding: 0 2px;
}
.section-head + * {
  margin-top: 0;
}

/* Topic list: larger tap area, clear hierarchy */
.topic-list {
  list-style: none;
}
.topic-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: clamp(12px, 2.5vw, 16px) 0;
  border-bottom: 1px solid var(--app-border-soft);
  min-height: 48px;
  transition: background var(--app-duration-fast) var(--app-ease);
}
.topic-item:hover {
  background: var(--app-gradient-soft);
}
.topic-item:last-child {
  border-bottom: none;
}
.topic-item input[type="checkbox"] {
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  accent-color: var(--app-primary);
  flex-shrink: 0;
}
.topic-item label {
  font-size: var(--app-text-base);
  cursor: pointer;
  flex: 1;
}
.topic-item.done label {
  color: var(--app-text-secondary);
  text-decoration: line-through;
}
.topic-group {
  margin-bottom: var(--app-space-lg);
}
.topic-group-title {
  font-size: var(--app-text-sm);
  font-weight: 600;
  color: var(--app-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding: 0 2px;
}

/* Note & mock cards */
.note-card,
.mock-card {
  display: block;
  padding: var(--app-space);
  margin-bottom: 12px;
  background: var(--app-surface);
  border-radius: var(--app-radius-md);
  border: 1px solid var(--app-border);
  text-decoration: none;
  color: var(--app-text);
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.note-card:hover,
.note-card:focus,
.mock-card:hover,
.mock-card:focus {
  background: var(--app-primary-soft);
  border-color: var(--app-primary);
  box-shadow: var(--app-shadow);
}
.note-card strong,
.mock-card strong {
  font-size: var(--app-text-base);
  display: block;
}
.note-card span,
.mock-card span {
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
  margin-top: 4px;
  display: block;
}
.mock-card .meta {
  font-size: var(--app-text-xs);
  color: var(--app-text-muted);
  margin-top: 6px;
}
.mock-card .btn-start {
  display: inline-block;
  margin-top: 10px;
  padding: 8px 16px;
  background: var(--app-primary);
  color: #fff;
  font-size: var(--app-text-sm);
  font-weight: 600;
  border-radius: var(--app-radius-sm);
  text-decoration: none;
}

/* Unlock CTA */
.unlock-cta {
  text-align: center;
  padding: var(--app-space-lg) var(--app-space);
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  margin: var(--app-space);
  max-width: var(--app-content-max);
  margin-left: auto;
  margin-right: auto;
}
.unlock-cta h2 {
  font-size: var(--app-text-xl);
  margin-bottom: 8px;
}
.unlock-cta p {
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
  margin-bottom: var(--app-space);
  line-height: 1.5;
}
.progress-to-unlock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: var(--app-space) 0;
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
}
.progress-to-unlock .bar {
  flex: 1;
  max-width: 160px;
  height: 8px;
  background: var(--app-border);
  border-radius: var(--app-radius-full);
  overflow: hidden;
}
.progress-to-unlock .fill {
  height: 100%;
  background: var(--app-success);
  border-radius: var(--app-radius-full);
  width: 50%;
}

/* Profile stats grid */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: var(--app-space) 0;
}
.profile-stat {
  text-align: center;
  padding: 18px 10px;
  background: var(--app-surface);
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border-soft);
  box-shadow: var(--app-shadow);
  transition: box-shadow var(--app-duration) var(--app-ease), transform var(--app-duration-fast) var(--app-ease);
}
.profile-stat:hover {
  box-shadow: var(--app-shadow-md);
}
.profile-stat-value {
  font-size: var(--app-text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: var(--app-gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
}
.profile-stat-label {
  font-size: var(--app-text-xs);
  font-weight: 500;
  color: var(--app-text-secondary);
  margin-top: 4px;
}

/* Notifications: timestamp & category */
.notification-item {
  display: flex;
  gap: 14px;
  padding: clamp(14px, 2.5vw, 18px) 0;
  border-bottom: 1px solid var(--app-border-soft);
  min-height: 56px;
  transition: background var(--app-duration-fast) var(--app-ease);
}
.notification-item:hover {
  background: var(--app-gradient-soft);
}
.notification-time {
  font-size: var(--app-text-xs);
  color: var(--app-text-muted);
  margin-top: 4px;
}

/* Explore tiles: description on larger screens */
.explore-tile-desc {
  display: none;
  font-size: var(--app-text-xs);
  color: var(--app-text-secondary);
  margin-top: 4px;
  text-align: center;
}

/* Search bar (inner pages) */
.page-search {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: var(--app-space);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-md);
  font-size: var(--app-text-base);
  background: var(--app-surface);
  color: var(--app-text);
}

/* Feature page content block */
.feature-intro {
  font-size: var(--app-text-base);
  color: var(--app-text-secondary);
  line-height: 1.6;
  margin-bottom: var(--app-space-lg);
}
.feature-list {
  list-style: none;
}
.feature-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--app-border);
  font-size: var(--app-text-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.feature-list li::before {
  content: "✓";
  color: var(--app-success);
  font-weight: 700;
}

/* ----- Breakpoints ----- */
@media (min-width: 480px) {
  .dashboard-hub {
    padding: var(--app-space) var(--app-space) var(--app-space-lg);
  }
  .hub-icon-wrap {
    width: 82px;
    height: 82px;
    min-width: 82px;
    min-height: 82px;
  }
  .hub-icon-wrap img {
    width: 52px;
    height: 52px;
  }
  .hub-item-usp .hub-icon-wrap img {
    width: 60px;
    height: 60px;
  }
  .hub-icon-wrap.hub-icon-avatar img,
  .hub-item-usp .hub-icon-wrap.hub-icon-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .hub-item-notes .hub-icon-wrap img {
    width: 64px;
    height: 64px;
  }
  .progress-card {
    padding: var(--app-space-lg) var(--app-space);
  }
  .practice-earn-card {
    padding: var(--app-space-lg) var(--app-space);
  }
  .flow-cards {
    padding: 0 var(--app-space) var(--app-space-lg);
  }
}

@media (min-width: 600px) {
  .explore-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    padding: var(--app-space-lg);
  }
  .explore-tile {
    padding: 28px 20px;
    min-height: 130px;
  }
  .explore-tile-desc {
    display: block;
  }
  .notifications-list {
    padding: var(--app-space-lg);
  }
  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

@media (min-width: 768px) {
  .page-content {
    padding: var(--app-space-lg) var(--app-space-lg) 32px;
  }
  .progress-card {
    flex-direction: row;
    gap: 28px;
    padding: var(--app-space-lg);
  }
  .progress-ring-wrap {
    flex-shrink: 0;
  }
  .progress-ring {
    width: 96px;
    height: 96px;
  }
  .progress-value {
    font-size: 1rem;
  }
  .progress-info h3 {
    font-size: var(--app-text-lg);
  }
  .progress-info p {
    font-size: var(--app-text-sm);
  }
  .practice-earn-card {
    padding: var(--app-space-lg);
    gap: 24px;
  }
  .practice-earn-title {
    font-size: var(--app-text-lg);
  }
  .practice-earn-desc {
    font-size: var(--app-text-sm);
  }
  .flow-card {
    padding: 20px;
  }
  .profile-header {
    padding: 32px 24px;
  }
  .profile-avatar {
    width: 96px;
    height: 96px;
    font-size: 2.5rem;
  }
}

@media (min-width: 1024px) {
  .app-main-inner {
    padding-bottom: 32px;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .flow-card,
  .note-card,
  .mock-card,
  .explore-tile {
    transition: none;
  }
}

/* AI Companion hub: exam, modes, quick actions */
.ai-comp-section {
  margin-bottom: var(--app-space-lg);
}
.ai-comp-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.ai-comp-mode {
  display: inline-block;
  padding: 10px 16px;
  border-radius: var(--app-radius-md);
  font-size: var(--app-text-sm);
  font-weight: 600;
  text-decoration: none;
  background: var(--app-border-soft);
  color: var(--app-text-secondary);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.ai-comp-mode:hover {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.ai-comp-mode.active {
  background: var(--app-primary-soft);
  color: var(--app-primary);
  border-color: var(--app-primary);
}
.ai-comp-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.ai-comp-quick-btn {
  display: inline-block;
  padding: 8px 14px;
  font-size: var(--app-text-xs);
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-sm);
  color: var(--app-text-secondary);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.ai-comp-quick-btn:hover {
  border-color: var(--app-primary);
  color: var(--app-primary);
  background: var(--app-primary-soft);
}

/* Shared: header with Back left, Prepriga logo, title center */
.header-with-back {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 8px;
}
.header-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 8px 6px;
  margin: 0 -4px;
  border-radius: var(--app-radius-md);
  color: var(--app-text);
  font-size: var(--app-text-sm);
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, color 0.15s;
}
.header-back-link:hover {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}
.header-back-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.header-with-back .app-header-logo {
  min-width: 0;
}
.header-with-back .app-header-logo img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.header-with-back .app-header-logo .logo-text-3d {
  font-size: 0.9375rem;
}
.header-with-back .app-header-badge {
  justify-self: center;
  max-width: 140px;
}

/* Explore: Free to try hero — mocks & personality test */
.explore-free-hero {
  margin-bottom: var(--app-space-lg);
  padding: var(--app-space-lg) 0;
}
.explore-free-hero-title {
  font-size: var(--app-text-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--app-text);
  margin: 0 0 4px 0;
}
.explore-free-hero-sub {
  font-size: var(--app-text-sm);
  color: var(--app-text-muted);
  margin: 0 0 var(--app-space) 0;
}
.explore-free-hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--app-space);
}
@media (min-width: 480px) {
  .explore-free-hero-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 720px) {
  .explore-free-hero-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
.explore-free-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: var(--app-space-lg);
  border-radius: var(--app-radius-lg);
  text-decoration: none;
  color: var(--app-text);
  border: 1px solid var(--app-border-soft);
  background: var(--app-surface);
  box-shadow: var(--app-shadow);
  transition: transform 0.2s var(--app-ease), box-shadow 0.2s var(--app-ease), border-color 0.2s;
  min-height: 140px;
}
.explore-free-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--app-shadow-lg), 0 8px 24px rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}
.explore-free-card:active {
  transform: translateY(-1px);
}
.explore-free-card-icon {
  display: block;
  margin-bottom: 12px;
  border-radius: var(--app-radius-md);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}
.explore-free-card-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-primary);
  margin-bottom: 4px;
}
.explore-free-card-title {
  font-size: var(--app-text-base);
  font-weight: 700;
  color: var(--app-text);
  margin-bottom: 6px;
  line-height: 1.3;
}
.explore-free-card-desc {
  font-size: var(--app-text-sm);
  color: var(--app-text-secondary);
  line-height: 1.45;
  margin-bottom: 12px;
  flex: 1;
}
.explore-free-card-cta {
  font-size: var(--app-text-sm);
  font-weight: 600;
  color: var(--app-primary);
  margin-top: auto;
}
.explore-free-card-mocks {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(99, 102, 241, 0.04) 100%);
}
.explore-free-card-personality {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(139, 92, 246, 0.05) 100%);
}
.explore-free-card-personality .explore-free-card-label {
  color: #7c3aed;
}
.explore-free-card-personality:hover .explore-free-card-cta {
  color: #6d28d9;
}
.explore-free-card-jobs {
  background: linear-gradient(145deg, var(--app-surface) 0%, rgba(16, 185, 129, 0.05) 100%);
}
.explore-free-card-jobs .explore-free-card-label {
  color: var(--app-success);
}
.explore-free-card-jobs:hover .explore-free-card-cta {
  color: var(--app-success);
}

/* ----- Search-as-you-type (mocks, syllabus, etc.) ----- */
.list-search-wrap {
  margin-bottom: var(--app-space-lg);
}
.list-search-wrap[role="search"] {
  margin-top: 0;
}
.list-search-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--app-text-secondary);
  margin-bottom: 6px;
}
.list-search-input {
  width: 100%;
  max-width: 100%;
  padding: 14px 18px 14px 44px;
  font-size: 1rem;
  font-family: var(--app-font);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23475569' viewBox='0 0 24 24'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 14px center;
  background-size: 20px 20px;
  color: var(--app-text);
  box-sizing: border-box;
  transition: border-color var(--app-duration-fast) var(--app-ease), box-shadow var(--app-duration-fast) var(--app-ease);
}
.list-search-input::placeholder {
  color: var(--app-text-muted);
}
.list-search-input:focus {
  outline: none;
  border-color: var(--app-primary);
  box-shadow: 0 0 0 3px var(--app-primary-soft);
}
.list-search-hint {
  display: block;
  font-size: 0.75rem;
  color: var(--app-text-muted);
  margin-top: 6px;
}
.list-search-no-results {
  padding: var(--app-space-xl);
  text-align: center;
  color: var(--app-text-secondary);
  display: none;
}
.list-search-no-results.visible {
  display: block;
}
