:root {
  --bg-base: #F5F7FA;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #E2E8F0;
  --bg-glass: rgba(255, 255, 255, 0.8);
  --accent-primary: #008AA8;
  --accent-secondary: #6A1B9A;
  --secondary-rgb: 106, 27, 154;
  --secondary-button-end: #8A2BE2;
  --brand-navy: #0F172A;
  --brand-gold: #B8860B;
  --text-main: #140B28;
  --text-muted: #64748B;
  --nav-bg: rgba(255, 255, 255, 0.95);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 10px rgba(0, 138, 168, 0.2);
}

.dark-mode {
  /* Negro y grises neutros con acentos de la marca. */
  --bg-base: #0B0B0C;
  --bg-surface: #18181B;
  --bg-surface-hover: #27272A;
  --bg-glass: rgba(24, 24, 27, 0.85);
  --accent-primary: #00F2FF;
  --accent-secondary: #D4D4D8;
  --secondary-rgb: 212, 212, 216;
  --secondary-button-end: #3F3F46;
  --brand-navy: #18181B;
  /* Azul Marino */
  --brand-gold: #DAA520;
  /* Dorado / Ocre */
  --text-main: #FFFFFF;
  --text-muted: #A1A1AA;
  --nav-bg: rgba(11, 11, 12, 0.95);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 10px rgba(0, 242, 255, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  padding-bottom: 80px;
  /* Space for bottom nav */
}

/* Typography */
h1,
h2,
h3 {
  color: var(--text-main);
}

p {
  line-height: 1.6;
}

@font-face {
  font-family: 'Manrope';
  src: url('../fonts/manrope-variable.ttf') format('truetype');
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 1rem;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: var(--shadow-sm);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.marca {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.05em;
  color: #282827;
}
.marca span { font-family: inherit; }
.marca .marca-subtitle { font-size: .61rem; font-weight: 600; letter-spacing: .22em; line-height: 1.2; text-transform: uppercase; color: #85653c; }
.dark-mode .marca { color: #f1eee7; }
.dark-mode .marca .marca-subtitle { color: #c4a77b; }

/* Buttons */
.icon-btn {
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: var(--bg-surface-hover);
}

/* Main Content */
main {
  padding: 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

/* Views Management */
.view {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.nav-item i {
  stroke-width: 2px;
  width: 24px;
  height: 24px;
}

.nav-item.active {
  color: var(--accent-primary);
  text-shadow: var(--shadow-glow);
}

.nav-item.active i {
  filter: drop-shadow(0 0 5px var(--accent-primary));
}

/* Sections Styles (Cards) */
.card {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, 0.02);
  transition: transform 0.2s;
}

.card:active {
  transform: scale(0.98);
}

/* Wake lock banner */
.wakelock-banner {
  background: var(--accent-secondary);
  color: #fff;
  font-size: 0.8rem;
  padding: 6px;
  text-align: center;
  border-radius: 0 0 8px 8px;
  margin-top: -1.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
}

/* Search bar */
.search-bar {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  outline: none;
  transition: all 0.2s;
}

.search-bar:focus {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* List of hymns */
.hymn-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hymn-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-surface);
  border-radius: 12px;
  cursor: pointer;
}

.hymn-item:hover {
  background: var(--bg-surface-hover);
}

.hymn-number {
  color: var(--brand-gold);
  font-weight: 700;
  margin-right: 12px;
}

.hymn-title {
  font-weight: 600;
}

/* Video Grid */
.video-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  background: #000;
}

.video-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Helpers */
.flex-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chip {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 242, 255, 0.1);
  color: var(--accent-primary);
}

/* Forms (Login for choir) */
.input-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.2s;
  box-shadow: var(--shadow-glow);
}

.btn-primary:active {
  opacity: 0.8;
  transform: scale(0.98);
}

/* Print Styles */
@media print {
  html, body {
    background: white !important;
    height: auto !important;
    overflow: visible !important;
  }
  .app-container, .nav-bar, .choir-modal-overlay, #app-bg {
    display: none !important;
  }
  #choir-export-modal {
    display: block !important;
    position: relative !important;
    background: white !important;
    width: 100% !important;
    max-width: none !important;
  }
  #choir-export-modal .choir-modal {
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    box-shadow: none !important;
    border: none !important;
    display: block !important;
    position: relative !important;
  }
  #choir-export-capture-area {
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: none !important;
  }
  /* Ocultar UI de botones dentro del modal al imprimir */
  #choir-export-modal button, 
  #choir-export-modal .icon-btn,
  #choir-export-modal div[style*="border-top"],
  #choir-export-modal div[style*="border-bottom"] {
    display: none !important;
  }
}

/* Export Card Styles */
.export-header {
  background: #0F172A; /* brand-navy fixed for export contrast */
  color: white;
  padding: 2.5rem 1.5rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.export-header::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at top right, rgba(218, 165, 32, 0.25), transparent);
}

.export-body {
  padding: 1.5rem;
  background: white;
  color: #1a1a1a;
}

.export-block-title {
  color: #B8860B; /* brand-gold */
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 2px solid rgba(184, 134, 11, 0.2);
  padding-bottom: 6px;
  margin-top: 1.8rem;
  margin-bottom: 1rem;
}

.export-hymn-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.export-hymn-number {
  color: #B8860B;
  font-weight: 800;
  font-size: 1.1rem;
  min-width: 25px;
}

.export-hymn-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: #0F172A;
  line-height: 1.2;
}

.export-hymn-note {
  font-size: 0.88rem;
  color: #555;
  background: #f1f5f9;
  padding: 6px 12px;
  border-left: 4px solid #cbd5e1;
  margin-top: 6px;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.export-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
