/*
  Estilos de la app.

  La identidad toma referencias de la home de Tatuia:
  fondo claro calido, tipografia mono, tarjetas blancas suaves y botones redondeados.
*/

:root {
  color-scheme: light;
  --bg: #f2ede5;
  --ink: #242424;
  --muted: #6d6962;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --line: rgba(36, 36, 36, 0.12);
  --soft: #f8f5ee;
  --accent: #4f46e5;
  --accent-dark: #3730a3;
  --danger: #b42318;
  --shadow: 0 24px 80px rgba(36, 36, 36, 0.12);
}

html.dark {
  color-scheme: dark;
  --bg: #111111;
  --ink: #e5e3df;
  --muted: #a8a29a;
  --panel: rgba(30, 41, 59, 0.78);
  --panel-solid: #1e293b;
  --line: rgba(226, 232, 240, 0.16);
  --soft: #172033;
  --accent: #818cf8;
  --accent-dark: #6366f1;
  --danger: #fca5a5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.message-modal {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(36, 36, 36, 0.28);
  backdrop-filter: blur(8px);
}

.message-modal[hidden] {
  display: none;
}

.message-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(420px, 100%);
  border: 1px solid rgba(79, 70, 229, 0.24);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  padding: 22px;
  box-shadow: var(--shadow);
  text-align: center;
}

.message-card strong {
  font-size: 1.18rem;
}

.message-card span {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.message-socials {
  display: grid;
  gap: 10px;
  width: 100%;
  margin: 6px 0;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.message-socials[hidden] {
  display: none;
}

.message-socials p {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
}

.message-socials div {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.message-socials a {
  border-radius: 999px;
  color: #ffffff;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.message-socials .social-youtube {
  background: #ff0000;
}

.message-socials .social-instagram {
  background: linear-gradient(35deg, #fd1d1d, #833ab4);
}

.message-socials .social-tiktok {
  background: #000000;
}

.message-modal[data-type="error"] .message-card {
  border-color: rgba(180, 35, 24, 0.25);
}

html.dark .message-card {
  background: rgba(30, 41, 59, 0.94);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand-logo {
  width: 70px;
  height: 46px;
  object-fit: contain;
  border-radius: 14px;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 12px 30px rgba(36, 36, 36, 0.1);
}

html.dark .brand-logo {
  background: #ffffff;
}

.brand-link strong,
.brand-link small {
  display: block;
}

.brand-link small {
  color: var(--muted);
  font-size: 0.78rem;
}

.header-actions,
.social-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.social-nav a,
.button,
.dark-toggle,
.nav-pill,
.youtube-subscribe-link {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  color: var(--ink);
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(36, 36, 36, 0.08);
}

.social-nav a:hover,
.button:hover,
.dark-toggle:hover,
.nav-pill:hover,
.youtube-subscribe-link:hover {
  transform: translateY(-1px);
}

.dark-toggle {
  background: #f1f5f9;
  color: #334155;
}

html.dark .dark-toggle {
  background: #334155;
  color: #e2e8f0;
}

.social-nav a {
  color: #ffffff;
}

.social-nav .social-youtube {
  border-color: #ff0000;
  background: #ff0000;
}

.social-nav .social-instagram {
  border-color: transparent;
  background: linear-gradient(35deg, #fd1d1d, #833ab4);
}

.social-nav .social-tiktok {
  border-color: transparent;
  background: #000000;
}

html.dark .social-nav .social-tiktok {
  border-color: #334155;
  background: #0f172a;
}

.social-nav a:hover {
  border-color: #000000;
  background: #ffffff;
  color: #000000;
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  max-width: 860px;
  padding: 34px 0 24px;
}

.local-file-warning {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(180, 35, 24, 0.25);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--danger);
  font-size: 0.86rem;
  line-height: 1.45;
}

html.dark .local-file-warning {
  background: rgba(15, 23, 42, 0.64);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 920px;
  font-size: 3.8rem;
  line-height: 1;
}

h2 {
  font-size: clamp(1.45rem, 5vw, 2.35rem);
  line-height: 1.05;
}

.hero p,
.section-heading p,
.youtube-section p {
  max-width: 68ch;
  color: var(--muted);
  line-height: 1.55;
}

.hero a {
  color: var(--accent);
  font-weight: 900;
}

.app-shell {
  display: grid;
  gap: 20px;
  padding: 0 0 34px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.controls-panel {
  order: 2;
  padding: 20px;
}

.section-heading {
  margin-bottom: 18px;
}

.section-heading p {
  margin: 10px 0 0;
}

.controls {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 10px 12px;
}

html.dark input,
html.dark select {
  background: rgba(15, 23, 42, 0.86);
}

input[type="file"] {
  padding: 9px;
}

input[type="range"] {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.22);
  outline-offset: 2px;
}

.adjustments,
.form-grid {
  display: grid;
  gap: 12px;
}

.adjustments-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.42);
  padding: 12px;
}

html.dark .adjustments-panel {
  background: rgba(15, 23, 42, 0.42);
}

.adjustments-panel summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 900;
}

.adjustments-panel .adjustments {
  margin-top: 12px;
}

.form-subtitle {
  margin: 4px 0 -4px;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.2;
}

.terms-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.terms-check input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

html.dark .terms-check {
  background: rgba(15, 23, 42, 0.5);
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.actions .button {
  width: 100%;
  padding-inline: 12px;
  white-space: nowrap;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.preview-panel {
  display: grid;
  order: 1;
  place-items: start center;
}

.preview-frame {
  width: min(100%, 420px);
  padding: 10px;
  border-radius: 24px;
  background: #242424;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  background: #ffffff;
}

.canvas-upload-button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 14px;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.canvas-upload-button.has-user-photo {
  cursor: default;
}

html.dark canvas {
  background: #0f172a;
}

.youtube-section {
  display: grid;
  gap: 18px;
  margin: 18px 0 38px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.youtube-subscribe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.youtube-subscribe-link {
  background: #ff0000;
  color: #ffffff;
}

.admin-page {
  padding-bottom: 56px;
}

.admin-hero {
  display: grid;
  gap: 14px;
  padding: 32px 0 24px;
}

.admin-hero p {
  max-width: 76ch;
  color: var(--muted);
  line-height: 1.6;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 18px;
}

.admin-group {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 18px;
}

.admin-group h2 {
  margin-bottom: 14px;
}

.admin-country-list {
  display: grid;
  gap: 12px;
}

.admin-country {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  padding: 14px;
}

html.dark .admin-country {
  background: rgba(15, 23, 42, 0.56);
}

.admin-country h3 {
  margin: 0;
  font-size: 1rem;
}

.admin-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.admin-check input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.video-embed {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  background: #242424;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.site-footer {
  display: grid;
  gap: 8px;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 38px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.site-footer p {
  margin: 0;
}

.legal-page {
  display: grid;
  gap: 16px;
  max-width: 820px;
  padding: 36px 0 56px;
}

.legal-page h1 {
  font-size: clamp(2.4rem, 8vw, 4rem);
}

.legal-page h2 {
  margin-top: 16px;
  font-size: 1.35rem;
}

.legal-page p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.back-link {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-solid);
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

@media (min-width: 720px) {
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-country-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .full-width {
    grid-column: 1 / -1;
  }

  .adjustments {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

}

@media (max-width: 520px) {
  .site-header {
    align-items: flex-start;
  }

  h1 {
    font-size: 3rem;
  }
}

@media (min-width: 980px) {
  .app-shell {
    grid-template-columns: minmax(500px, 1.08fr) minmax(360px, 0.92fr);
    align-items: start;
  }

  .controls-panel {
    order: 0;
    position: sticky;
    top: 24px;
  }

  .preview-panel {
    order: 0;
  }

  .preview-frame {
    width: min(100%, 470px);
  }

  .youtube-section {
    grid-template-columns: minmax(280px, 0.75fr) minmax(420px, 1fr);
    align-items: center;
  }

  .admin-country-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
