/* =========================================
   GLOBAL PREMIUM BUTTON SYSTEM (A11Y & WCAG 2.2 AA)
   ========================================= */
.btn-premium-primary,
.btn-premium-secondary,
.btn-premium-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 11px;
  text-decoration: none !important;
  cursor: pointer;
  box-sizing: border-box;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  user-select: none;
}

/* Primary Button: Navy to DBB Blue controlled gradient with inner highlight */
.btn-premium-primary {
  background: linear-gradient(135deg, #083b66 0%, #0b6fa4 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff !important;
  box-shadow: 0 3px 10px rgba(8, 59, 102, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-premium-primary:hover {
  background: linear-gradient(135deg, #062f52 0%, #085985 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(11, 111, 164, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.30);
  color: #ffffff !important;
}

.btn-premium-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(8, 59, 102, 0.25);
}

.btn-premium-primary:focus-visible {
  outline: 3px solid #5cc8ff !important;
  outline-offset: 3px !important;
}

/* Secondary Button: White/translucent surface with refined cyan-blue border */
.btn-premium-secondary {
  background: #ffffff;
  border: 1px solid rgba(11, 111, 164, 0.24);
  color: #083b66 !important;
  box-shadow: 0 2px 6px rgba(11, 111, 164, 0.06);
}

.btn-premium-secondary:hover {
  background: #f0f7fb;
  border-color: #0b6fa4;
  color: #083b66 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(11, 111, 164, 0.12);
}

.btn-premium-secondary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(11, 111, 164, 0.08);
}

.btn-premium-secondary:focus-visible {
  outline: 3px solid #0b6fa4 !important;
  outline-offset: 3px !important;
}

/* Ghost Button: Clean transparent */
.btn-premium-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: #0b6fa4 !important;
  padding: 0 16px;
}

.btn-premium-ghost:hover {
  background: rgba(11, 111, 164, 0.08);
  color: #083b66 !important;
}

.btn-premium-ghost:focus-visible {
  outline: 3px solid #0b6fa4 !important;
  outline-offset: 2px !important;
}

/* Arrow Icon Animation inside Premium Buttons */
.btn-arrow-svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-premium-primary:hover .btn-arrow-svg,
.btn-premium-secondary:hover .btn-arrow-svg,
.btn-premium-ghost:hover .btn-arrow-svg {
  transform: translateX(3px);
}

/* A11Y: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .btn-premium-primary,
  .btn-premium-secondary,
  .btn-premium-ghost,
  .btn-arrow-svg {
    transform: none !important;
    transition: none !important;
  }
}

/* Legacy .btn helpers */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-weight: 700;
  transition: all var(--transition-fast);
  text-align: center;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, #083b66 0%, #0b6fa4 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #062f52 0%, #085985 100%);
  text-decoration: none;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  color: var(--color-text-primary);
}

.btn-icon:hover {
  background-color: var(--color-surface-hover);
}

/* =========================================
   HOMEPAGE ACTION CARDS
   ========================================= */

/* Base card wrapper — used as <a> element */
.card-square {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  text-align: center;
  border-radius: var(--radius-lg);       /* 16px */
  padding: 20px 16px;
  text-decoration: none;
  border: 1px solid transparent;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  /* height set per breakpoint in home.blade.php */
}

.card-square:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
  text-decoration: none;
}

/* WCAG keyboard focus visible */
.card-square:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
  box-shadow: none;
}

/* Icon — centered, large */
.card-icon {
  font-size: 2rem;        /* 32px */
  line-height: 1;
  display: block;
  margin-bottom: 10px;
  flex-shrink: 0;
}

/* Title */
.card-title {
  font-size: 0.875rem;   /* 14px */
  font-weight: 700;
  line-height: 1.25;
  display: block;
  margin-bottom: 4px;
}

/* Description / CTA text */
.card-action {
  font-size: 0.75rem;    /* 12px */
  font-weight: 500;
  display: block;
  opacity: 0.7;
  line-height: 1.3;
}

/* ── Institutional Color Variants ───────────────────────
   Professional municipal palette:
   Primary: blue on white (#1d4ed8 on #ffffff)
   Neutral: dark on light gray (#1e293b on #f1f5f9)
   Soft Blue: medium blue on pale (#1e40af on #eff6ff)
   Muted: slate on very light (#334155 on #f8fafc)
   Accent: white on deep blue (#ffffff on #1d4ed8)
   Secondary: white on navy (#ffffff on #0f172a)
   ─────────────────────────────────────────────────── */

/* card-blue → primary white card, blue border accent */
.card-blue {
  background-color: #ffffff;
  border-color: #bfdbfe;
  color: #1e3a5f;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-blue .card-icon { color: #2563eb; }
.card-blue:hover { background-color: #f0f7ff; border-color: #93c5fd; }

/* card-green → soft gray neutral */
.card-green {
  background-color: #f8fafc;
  border-color: #e2e8f0;
  color: #1e293b;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card-green .card-icon { color: #475569; }
.card-green:hover { background-color: #f1f5f9; border-color: #cbd5e1; }

/* card-gold → pale blue */
.card-gold {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card-gold .card-icon { color: #1d4ed8; }
.card-gold:hover { background-color: #dbeafe; border-color: #93c5fd; }

/* card-indigo → white with slate border */
.card-indigo {
  background-color: #ffffff;
  border-color: #e2e8f0;
  color: #334155;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.card-indigo .card-icon { color: #1e40af; }
.card-indigo:hover { background-color: #f8fafc; border-color: #bfdbfe; }

/* card-teal → deep blue solid (accent) */
.card-teal {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(29,78,216,0.25);
}
.card-teal .card-icon { color: #bfdbfe; }
.card-teal:hover { background-color: #1e40af; border-color: #1e40af; }

/* card-orange → navy dark solid (secondary) */
.card-orange {
  background-color: #0f172a;
  border-color: #1e293b;
  color: #f1f5f9;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.card-orange .card-icon { color: #93c5fd; }
.card-orange:hover { background-color: #1e293b; border-color: #334155; }

/* ── Dark Mode Overrides ─────────────────── */
.theme-dark .card-blue   { background-color: #1e3a5f; border-color: #2563eb; color: #dbeafe; }
.theme-dark .card-blue .card-icon { color: #93c5fd; }

.theme-dark .card-green  { background-color: #1e293b; border-color: #334155; color: #f1f5f9; }
.theme-dark .card-green .card-icon { color: #94a3b8; }

.theme-dark .card-gold   { background-color: #1e3a5f; border-color: #2563eb; color: #bfdbfe; }
.theme-dark .card-gold .card-icon { color: #93c5fd; }

.theme-dark .card-indigo { background-color: #0f172a; border-color: #334155; color: #e2e8f0; }
.theme-dark .card-indigo .card-icon { color: #60a5fa; }

.theme-dark .card-teal   { background-color: #1d4ed8; border-color: #2563eb; color: #ffffff; }
.theme-dark .card-teal .card-icon { color: #bfdbfe; }

.theme-dark .card-orange { background-color: #020617; border-color: #1e293b; color: #e2e8f0; }
.theme-dark .card-orange .card-icon { color: #60a5fa; }

/* ── High Contrast Override ──────────────── */
.theme-hc-light .card-square,
.theme-hc-dark  .card-square {
  border-width: 2px;
  border-color: var(--color-text-primary);
  background-color: var(--color-surface-1);
  color: var(--color-text-primary);
}
.theme-hc-light .card-square:focus-visible,
.theme-hc-dark  .card-square:focus-visible {
  box-shadow: 0 0 0 4px var(--color-text-primary);
}

/* Book card components removed */


/* =========================================
   INPUTS
   ========================================= */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.input-label {
  font-size: var(--font-size-caption);
  font-weight: 700;
  color: var(--color-text-primary);
}

.input-control {
  padding: 0 var(--space-md);
  height: 44px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  background-color: var(--color-surface-1);
  color: var(--color-text-primary);
  font-family: inherit;
  font-size: var(--font-size-body);
}

.input-control:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: -1px;
}

/* =========================================
   MODALS / PANELS / DRAWERS
   ========================================= */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5);
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast);
}

.panel-overlay.active {
  opacity: 1;
  visibility: visible;
}

.panel-content {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 100vw;
  background-color: var(--color-surface-1);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  padding: var(--space-lg);
  transform: translateX(100%);
  transition: transform var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.panel-overlay.active .panel-content {
  transform: translateX(0);
}

.reduced-motion .panel-content {
  transition: none;
}

.contrast-high .panel-content {
  border-left: 3px solid var(--color-text-primary);
}

/* =========================================
   CATALOG COMPONENTS
   ========================================= */

/* Filter Badges */
.badge-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  background-color: var(--color-surface-hover);
  color: var(--color-text-primary);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-caption);
  font-weight: 700;
  border: 1px solid var(--color-border-subtle);
}

.badge-filter button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  color: var(--color-text-secondary);
}

.badge-filter button:hover {
  background-color: var(--color-text-primary);
  color: var(--color-surface-1);
}

/* Checkbox Groups */
.filter-group {
  margin-bottom: var(--space-xl);
  border: none;
  padding: 0;
}

.filter-legend {
  font-weight: 700;
  font-size: var(--font-size-body);
  margin-bottom: var(--space-sm);
  color: var(--color-text-primary);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  font-size: var(--font-size-body);
  color: var(--color-text-secondary);
  /* A11Y Touch Target */
  min-height: 44px;
}

.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] {
  width: 24px;
  height: 24px;
  accent-color: var(--color-primary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-2xl);
}

.page-link {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-weight: 700;
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-subtle);
  background-color: var(--color-surface-1);
}

.page-link:hover {
  background-color: var(--color-surface-hover);
  text-decoration: none;
}

.page-link.active {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.page-link[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Book list view removed */

/* =========================================
   PLAYER FULL SCREEN
   ========================================= */

.player-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
  gap: var(--space-xl);
}

@media (min-width: 1024px) {
  .player-container {
    flex-direction: row;
    max-width: 1000px;
    align-items: flex-start;
  }
  .player-left {
    flex: 1;
    position: sticky;
    top: calc(var(--header-height) + var(--space-xl));
  }
  .player-right {
    flex: 1.5;
  }
}

@media (max-width: 1023px) {
  .player-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.player-cover-large {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  background-color: var(--color-surface-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xl);
  overflow: hidden;
}

.no-covers .player-cover-large {
  display: none;
}

.player-timeline-wrapper {
  margin: var(--space-xl) 0;
}

.player-timeline {
  width: 100%;
  height: 8px;
  background-color: var(--color-surface-hover);
  border-radius: var(--radius-full);
  outline: 2px solid transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  background-image: linear-gradient(var(--color-primary), var(--color-primary));
  background-repeat: no-repeat;
  background-size: 0% 100%; /* JS will update this */
}

.player-timeline::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background-color: var(--color-primary);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.player-timeline::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background-color: var(--color-primary);
  border-radius: 50%;
  border: none;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.player-timeline:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.btn-play-large {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast);
}

.btn-play-large:hover {
  background-color: var(--color-primary-hover);
  box-shadow: var(--shadow-lg);
}

.btn-seek {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  background-color: var(--color-surface-1);
  border: 1px solid var(--color-border-subtle);
}

.btn-seek:hover {
  background-color: var(--color-surface-hover);
}

.player-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
  margin-bottom: var(--space-xl);
}

.chapter-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.chapter-item {
  border-radius: var(--radius-md);
  background-color: var(--color-surface-1);
  border: 1px solid var(--color-border-subtle);
  overflow: hidden;
}

.chapter-item.active {
  border-left: 4px solid var(--color-primary);
}

.chapter-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-md);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  transition: background-color var(--transition-fast);
}

.chapter-button:hover {
  background-color: var(--color-surface-hover);
}

.chapter-item.active .chapter-button {
  background-color: rgba(109, 40, 217, 0.05);
}

.chapter-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

/* =========================================
   SPRINT 9 PRODUCTION READINESS
   ========================================= */
.btn {
  border: 1px solid transparent;
  min-width: 44px;
  min-height: 44px;
}

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

.btn-icon,
.btn-seek,
.btn-play-large {
  min-width: 44px;
  min-height: 44px;
}

.btn-icon.btn-primary {
  color: var(--color-on-primary);
}

.btn:disabled,
.btn[aria-disabled="true"],
.sidebar-link[aria-disabled="true"],
.profile-list-link[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:disabled:hover,
.btn[aria-disabled="true"]:hover,
.sidebar-link[aria-disabled="true"]:hover,
.profile-list-link[aria-disabled="true"]:hover {
  background-color: inherit;
  color: inherit;
  text-decoration: none;
}

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

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background-color: var(--color-surface-hover);
  text-decoration: none;
}

.btn-danger {
  background-color: var(--color-error);
  border-color: var(--color-error);
  color: #ffffff;
}

.btn.loading,
.btn[aria-busy="true"] {
  cursor: wait;
  opacity: 0.72;
}

/* Book card components removed */
.badge-filter {
  min-height: 44px;
}

.badge-filter button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  margin: -10px -10px -10px 0;
}

.player-timeline {
  height: 44px;
  min-height: 44px;
  background-color: transparent;
  background-image: linear-gradient(var(--color-primary), var(--color-primary)), linear-gradient(var(--color-surface-hover), var(--color-surface-hover));
  background-position: left center, left center;
  background-repeat: no-repeat;
  background-size: 0% 8px, 100% 8px;
}

.player-timeline::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
}

.player-timeline::-moz-range-thumb {
  width: 24px;
  height: 24px;
}

/* media query removed */