/* =========================================================
   EXCHOOL — TOP-TIER MOBILE-FIRST DESIGN SYSTEM
   Premium Visual Language v2.0
   ========================================================= */

/* === DESIGN TOKENS === */
:root {
  /* Core Palette */
  --color-navy: #0B1C3A;
  --color-navy-light: #142D5C;
  --color-gold: #E5B80B;
  --color-gold-hover: #C9A00A;
  --color-gold-light: rgba(229, 184, 11, 0.12);
  --color-bg-user: #F5F3EE;
  --color-admin-bg: #374151;
  --color-border: #E2DFD8;

  /* Semantic Surfaces */
  --bg-main: #F5F3EE;
  --bg-card: #FFFFFF;
  --bg-card-subtle: #FAF9F5;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-glass-strong: rgba(255, 255, 255, 0.96);
  --border-glass: rgba(0, 0, 0, 0.06);
  --border-subtle: #E8E5DE;
  --border-accent: #E5B80B;

  /* Typography */
  --text-primary: #1A1A2E;
  --text-secondary: #4A4A5A;
  --text-muted: #8A8A9A;
  --text-light: #FFFFFF;

  /* Accents */
  --accent-primary: #0B1C3A;
  --accent-gold: #E5B80B;
  --accent-gold-glow: rgba(229, 184, 11, 0.35);
  --accent-navy-glow: rgba(11, 28, 58, 0.15);
  --accent-amber: #D97706;
  --accent-rose: #E11D48;
  --accent-green: #059669;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04), 0 12px 40px -8px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 4px 12px rgba(0, 0, 0, 0.06), 0 20px 50px -10px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 24px rgba(229, 184, 11, 0.3);
  --shadow-float: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-nav: 0 -1px 0 rgba(0, 0, 0, 0.04), 0 -8px 32px rgba(0, 0, 0, 0.06);

  /* Typography */
  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family: var(--font-body);

  /* Timing */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;

  /* Layout */
  --header-h: 56px;
  --nav-h: 72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* === RESET & BASE === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Custom Slim Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(11, 28, 58, 0.2) transparent;
}
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(11, 28, 58, 0.2);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(212, 169, 23, 0.5);
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100%;
}

h1, h2, h3, h4, h5, h6,
.brand-title,
.landing-title,
.box-title,
.modal-title,
.btn-primary {
  font-family: var(--font-display);
}

img {
  display: block;
  max-width: 100%;
}

/* === APP HEADER === */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--bg-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
  transition: background var(--duration-normal) ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-img-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  background: transparent !important;
  border: none !important;
  filter: drop-shadow(0 1px 4px rgba(11, 28, 58, 0.18));
  transition: transform var(--duration-normal) var(--ease-spring);
}

.brand-img-logo:active {
  transform: scale(0.92);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--color-navy);
  border: 1.5px solid var(--color-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: var(--color-gold);
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--color-navy);
}

.block-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: var(--color-gold-light);
  color: var(--color-navy);
  border: 1px solid rgba(229, 184, 11, 0.3);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* === MAIN CONTENT === */
.main-content {
  margin-top: var(--header-h);
  margin-bottom: var(--nav-h);
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
}

/* === TAB VIEWS === */
.tab-view {
  display: none;
  animation: viewFadeIn 0.3s var(--ease-out-expo);
}

.tab-view.active {
  display: block;
}

#view-landing.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#view-reel.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - var(--nav-h));
  height: calc(100dvh - var(--header-h) - var(--nav-h));
  overflow: hidden;
}

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

/* === LANDING HERO === */
.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-h) - var(--nav-h));
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
  text-align: center;
  padding: 32px 24px;
  position: relative;
  overflow: hidden;
}

.landing-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 20%, rgba(229, 184, 11, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 80%, rgba(11, 28, 58, 0.05) 0%, transparent 70%);
  pointer-events: none;
  animation: landingShimmer 12s ease-in-out infinite alternate;
}

@keyframes landingShimmer {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

.landing-logo-container {
  margin: 0 auto 20px;
  background: transparent !important;
  position: relative;
  z-index: 1;
}

.landing-logo-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  background: transparent !important;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 8px 24px rgba(11, 28, 58, 0.2)) drop-shadow(0 0 40px rgba(229, 184, 11, 0.15));
  animation: logoFloat 6s ease-in-out infinite;
}

@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.landing-title {
  font-size: 36px;
  font-weight: 900;
  color: var(--color-navy);
  margin-bottom: 4px;
  letter-spacing: -1.2px;
  position: relative;
  z-index: 1;
}

.landing-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 500;
  max-width: 280px;
  margin: 0 auto 36px;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* === PASSWORD ALERT & WARNING BANNER === */
.warning-banner {
  background: rgba(229, 184, 11, 0.08);
  border: 1.5px solid rgba(229, 184, 11, 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  color: #78350F;
  text-align: left;
}

.warning-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 12.5px;
  color: #92400E;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.warning-banner-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: #78350F;
}

.school-request-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--accent-green);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  text-decoration: none;
  font-weight: 700;
  transition: color var(--duration-fast) ease;
  border-bottom: 1.5px solid transparent;
}

.school-request-link:hover {
  color: #047857;
  border-bottom-color: #047857;
}

.btn-denunciar {
  background: rgba(225, 29, 72, 0.06);
  color: var(--accent-rose);
  border: 1px solid rgba(225, 29, 72, 0.2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast) ease;
}

.btn-denunciar:hover {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(225, 29, 72, 0.4);
}

.btn-denunciar:active {
  transform: scale(0.95);
}

/* === REEL / FEED CONTAINER === */
.reel-container {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 10px 24px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
}

.reel-container::-webkit-scrollbar {
  width: 0;
  display: none;
}

@media (min-width: 640px) {
  .reel-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 680px;
    margin: 0 auto;
    width: 100%;
    padding: 12px 16px 32px;
  }
}

@media (min-width: 1024px) {
  .reel-container {
    grid-template-columns: repeat(3, 1fr);
    max-width: 960px;
  }
}

.reel-container > .page-container,
.reel-container > div:only-child,
.reel-empty-state {
  grid-column: 1 / -1;
  width: 100%;
}

/* === REEL CARD === */
.reel-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: none;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition:
    transform var(--duration-normal) var(--ease-out-expo),
    box-shadow var(--duration-normal) var(--ease-out-expo);
  will-change: transform;
}

.reel-card:hover {
  box-shadow: var(--shadow-card-hover);
}

@media (hover: hover) {
  .reel-card:hover {
    transform: translateY(-2px);
  }
}

.reel-card:active {
  transform: scale(0.985);
}

.reel-card-img-wrap {
  position: relative;
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0B1C3A 100%);
  overflow: hidden;
  cursor: pointer;
}

@media (max-height: 700px) {
  .reel-card-img-wrap {
    height: 160px;
  }
}

@media (min-width: 640px) {
  .reel-card-img-wrap {
    height: 220px;
  }
}

.reel-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s var(--ease-out-expo);
}

.reel-card:hover .reel-card-img-wrap img {
  transform: scale(1.03);
}

/* Top-left Badges */
.reel-card-top-left-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  z-index: 3;
  pointer-events: none;
}

.reel-card-school-badge {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.95);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 175px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.2px;
}

/* Favorite Heart Button */
.reel-card-fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  transition:
    transform var(--duration-fast) var(--ease-spring),
    background var(--duration-fast) ease;
  padding: 0;
  z-index: 4;
}

.reel-card-fav-btn:hover {
  transform: scale(1.12);
  background: #FFFFFF;
}

.reel-card-fav-btn:active {
  transform: scale(0.88);
}

/* Price Badge */
.reel-card-price-badge {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: var(--accent-green);
  color: #FFFFFF;
  font-weight: 800;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  font-size: 15px;
  border: none;
  box-shadow: 0 2px 12px rgba(5, 150, 105, 0.35);
  letter-spacing: -0.3px;
  display: inline-flex;
  align-items: center;
  z-index: 2;
  font-family: var(--font-display);
}

/* Free / Donation — vibrant yellow */
.reel-card-price-badge--free {
  background: linear-gradient(135deg, #FBBF24 0%, #F59E0B 100%);
  color: #713F12;
  font-weight: 800;
  border: none;
  box-shadow: 0 2px 12px rgba(245, 158, 11, 0.4);
}

/* Reserved label */
.reel-card-reserved-cartel {
  background: linear-gradient(135deg, #FB923C 0%, #EA580C 100%);
  color: #FFFFFF;
  font-weight: 800;
  font-size: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 10px rgba(234, 88, 12, 0.35);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
}

.reel-card--reserved .reel-card-img-wrap img {
  filter: saturate(0.7) brightness(0.92);
}

/* Card Body */
.reel-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reel-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.reel-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  letter-spacing: -0.2px;
}

.reel-card-talla {
  font-size: 10px;
  padding: 3px 8px;
  flex-shrink: 0;
  font-weight: 700;
}

.reel-card-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.reel-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}

.reel-card-actions .btn {
  padding: 8px 12px;
  font-size: 12px;
}

/* Photos Badge */
.reel-card-photos-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  border: none;
  pointer-events: none;
}

/* === CAROUSEL === */
.carousel-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: scroll;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.carousel-wrapper::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: center;
  position: relative;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-dots {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 10;
}

.carousel-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.carousel-dot.active {
  width: 20px;
  border-radius: var(--radius-full);
  background: var(--color-gold);
  box-shadow: 0 0 8px rgba(229, 184, 11, 0.5);
}

/* Card Overlay (gradient info at bottom of card) */
.card-overlay {
  position: relative;
  z-index: 10;
  padding: 18px 18px 20px 18px;
  background: linear-gradient(to top, rgba(11, 28, 58, 0.96) 0%, rgba(11, 28, 58, 0.75) 65%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* === PILLS === */
.pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

.card-overlay .pill {
  background: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.9);
}

.pill-green {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.pill-amber {
  background: rgba(217, 119, 6, 0.1);
  color: #92400E;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.card-title-price {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.card-title {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.card-price {
  font-size: 22px;
  font-weight: 800;
  color: var(--color-gold);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.card-details {
  font-size: 12.5px;
  color: #E2E8F0;
  display: flex;
  gap: 12px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.card-actions .btn {
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 700;
}

/* === FILTER BAR === */
.filter-bar {
  flex-shrink: 0;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 8px 12px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-glass);
  z-index: 15;
}

.filter-select {
  flex: 1;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--duration-fast) ease, box-shadow var(--duration-fast) ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238A8A9A' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.filter-select:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(229, 184, 11, 0.15);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition:
    all var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-spring);
  text-decoration: none;
  font-family: var(--font-body);
  letter-spacing: -0.1px;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-navy);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 2px 12px rgba(11, 28, 58, 0.2);
}

.btn-primary:hover {
  background: var(--color-navy-light);
  box-shadow: 0 4px 20px rgba(11, 28, 58, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1.5px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-subtle);
  border-color: var(--color-gold);
}

.btn-gold {
  background: linear-gradient(135deg, var(--color-gold) 0%, #C9A00A 100%);
  color: var(--color-navy);
  font-weight: 800;
  border: none;
  box-shadow: 0 2px 16px rgba(229, 184, 11, 0.3);
}

.btn-gold:hover {
  box-shadow: 0 4px 24px rgba(229, 184, 11, 0.45);
}

.btn-danger {
  background: rgba(225, 29, 72, 0.08);
  color: var(--accent-rose);
  border: 1.5px solid rgba(225, 29, 72, 0.25);
}

.btn-danger:hover {
  background: var(--accent-rose);
  color: #FFFFFF;
  border-color: var(--accent-rose);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* === BOTTOM NAVIGATION === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  background: var(--bg-glass-strong);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
  box-shadow: var(--shadow-nav);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  position: relative;
  padding: 6px 12px;
  letter-spacing: 0.1px;
}

.nav-item.active {
  color: var(--color-navy);
  font-weight: 800;
}

.nav-item.active .nav-icon {
  transform: translateY(-1px) scale(1.08);
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--color-gold);
  animation: navIndicatorIn 0.25s var(--ease-out-expo);
}

@keyframes navIndicatorIn {
  from { width: 0; opacity: 0; }
  to { width: 24px; opacity: 1; }
}

.nav-icon {
  font-size: 22px;
  transition: transform var(--duration-fast) var(--ease-spring);
  line-height: 1;
}

/* Unread messages bullet */
.nav-bullet {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  width: 8px;
  height: 8px;
  background: var(--accent-rose);
  border: 2px solid var(--bg-card);
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(225, 29, 72, 0.5);
  animation: pulseBullet 2s infinite ease-in-out;
  pointer-events: none;
}

@keyframes pulseBullet {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.8; }
}

/* Chat delete button */
.btn-borrar-chat {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 8px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-borrar-chat:hover {
  background: rgba(225, 29, 72, 0.08);
  color: #E11D48;
}

.btn-borrar-chat:active {
  transform: scale(1.15);
}

/* === FORMS & CARDS === */
.page-container {
  padding: 20px 16px calc(var(--nav-h) + 24px) 16px;
  max-width: 560px;
  margin: 0 auto;
}

.content-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: none;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}

.box-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.4px;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition:
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background var(--duration-fast) ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-gold);
  box-shadow: 0 0 0 3px rgba(229, 184, 11, 0.12);
  background: #FFFFFF;
}

.form-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.form-select option,
.form-select optgroup {
  background-color: #FFFFFF;
  color: var(--text-primary);
}

/* === PHOTO THUMBNAILS === */
.thumb-card {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1.5px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  background: #FFFFFF;
  transition: transform var(--duration-fast) ease;
}

.thumb-card:hover {
  transform: scale(1.04);
}

.thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--accent-rose);
  color: #fff;
  border: none;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform var(--duration-fast) var(--ease-spring);
}

.thumb-delete-btn:hover {
  transform: scale(1.12);
}

.thumb-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  background: var(--color-navy);
  color: var(--color-gold);
  font-size: 8px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}

/* === CHAT VIEW === */
.chat-thread-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - var(--nav-h));
  height: calc(100dvh - var(--header-h) - var(--nav-h));
}

.chat-header {
  padding: 12px 16px;
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-main);
}

.message-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
  animation: msgAppear 0.2s var(--ease-out-expo);
}

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

.message-bubble.mine {
  align-self: flex-end;
  background: var(--color-navy);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  border: none;
}

.message-bubble.theirs {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-primary);
  border: none;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.message-meta {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 4px;
  text-align: right;
}

.chat-input-bar {
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: var(--bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  display: flex;
  gap: 8px;
}

.chat-input-bar .form-input {
  border-radius: var(--radius-full);
  padding: 10px 18px;
  font-size: 14px;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.modal-overlay.active {
  display: flex;
  animation: modalBgIn 0.25s ease;
}

#modal-alta-colegio {
  z-index: 250;
}

@keyframes modalBgIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 8px 24px 28px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
  color: var(--text-primary);
  position: relative;
  animation: modalSlideUp 0.35s var(--ease-out-expo);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-card::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border-subtle);
  border-radius: 2px;
  margin: 8px auto 16px;
}

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

@media (min-width: 640px) {
  .modal-overlay {
    align-items: center;
    padding: 20px;
  }

  .modal-card {
    border-radius: var(--radius-xl);
    padding: 28px;
    animation: modalScaleIn 0.3s var(--ease-out-expo);
  }

  .modal-card::before {
    display: none;
  }

  @keyframes modalScaleIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.4px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  padding: 4px;
  border-radius: 50%;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.privacy-checklist {
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.check-item input {
  margin-top: 3px;
  accent-color: var(--color-gold);
  width: 16px;
  height: 16px;
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 420px;
}

.toast {
  background: rgba(11, 28, 58, 0.96);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: toastIn 0.35s var(--ease-out-expo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 169, 23, 0.3);
  text-align: center;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Password Toggle & Strength Meter */
.btn-toggle-password-visibility {
  transition: opacity 0.2s, transform 0.15s;
  user-select: none;
}
.btn-toggle-password-visibility:hover {
  opacity: 0.8;
  transform: scale(1.1);
}
.btn-toggle-password-visibility:active {
  transform: scale(0.95);
}

/* === LIGHTBOX (Photo Viewer) === */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  user-select: none;
  touch-action: pan-y;
  animation: lightboxFadeIn 0.25s var(--ease-out-expo);
}

.lightbox-overlay.active {
  display: flex;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10002;
  transition: all var(--duration-fast) ease;
  backdrop-filter: blur(8px);
}

.lightbox-close-btn:hover,
.lightbox-close-btn:active {
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  transform: scale(1.05);
}

.lightbox-counter {
  position: absolute;
  top: 18px;
  left: 18px;
  padding: 5px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  backdrop-filter: blur(8px);
  z-index: 10001;
}

.lightbox-content-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  cursor: zoom-out;
}

.lightbox-img {
  max-width: 95vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transition: transform var(--duration-normal) var(--ease-out-expo);
  cursor: default;
}

.lightbox-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10001;
  opacity: 0.5;
  transition: all var(--duration-fast) ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.lightbox-arrow:hover,
.lightbox-arrow:active {
  opacity: 1;
  background: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
  transform: translateY(-50%) scale(1.06);
}

.lightbox-arrow-left {
  left: 10px;
}

.lightbox-arrow-right {
  right: 10px;
}

.lightbox-dots {
  position: absolute;
  bottom: 58px;
  display: flex;
  gap: 7px;
  z-index: 10001;
}

.lightbox-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  transition: all var(--duration-normal) var(--ease-out-expo);
  cursor: pointer;
}

.lightbox-dot.active {
  background: var(--color-gold);
  width: 22px;
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(229, 184, 11, 0.4);
}

.lightbox-caption {
  position: absolute;
  bottom: 16px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  max-width: 90vw;
  z-index: 10001;
}

.lightbox-titulo {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.lightbox-precio {
  font-weight: 800;
  color: var(--color-gold);
}

/* === GLOBAL ANIMATIONS === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* === SCROLLBAR (Web) === */
@media (min-width: 768px) {
  ::-webkit-scrollbar {
    width: 6px;
  }

  ::-webkit-scrollbar-track {
    background: transparent;
  }

  ::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }
}

/* === SAFE AREA INSETS (Notched phones) === */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: env(safe-area-inset-bottom);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }

  .main-content {
    margin-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }

  .chat-input-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
}

/* === UTILITY CLASSES === */
.text-center {
  text-align: center;
}

/* === LOADING SKELETON === */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* === DESKTOP REFINEMENTS === */
@media (min-width: 768px) {
  .app-header {
    padding: 0 28px;
  }

  .page-container {
    padding: 28px 24px calc(var(--nav-h) + 28px) 24px;
  }

  .landing-hero {
    padding: 48px 32px;
  }

  .landing-logo-img {
    width: 140px;
    height: 140px;
  }

  .landing-title {
    font-size: 44px;
  }

  .landing-subtitle {
    font-size: 17px;
    max-width: 360px;
  }

  .content-box {
    padding: 28px;
  }

  .reel-card-img-wrap {
    height: 240px;
  }
}

@media (min-width: 1024px) {
  .reel-card-img-wrap {
    height: 260px;
  }

  .bottom-nav {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border: 1px solid var(--border-glass);
    border-bottom: none;
  }
}

/* Submenú de Selección de Origen de Fotos y Captura Webcam */
#modal-origen-foto {
  z-index: 260;
}

#modal-webcam-captura {
  z-index: 270;
}

.btn-origen-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  width: 100%;
  text-align: left;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.btn-origen-card:hover {
  border-color: var(--color-primary);
  background: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.btn-origen-card:active {
  transform: translateY(0);
}

.webcam-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  display: inline-block;
  animation: webcamPulse 1.5s infinite;
}

@keyframes webcamPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
