
/* ------------------------------
   Variables de Color y Tema
------------------------------ */
:root {
  color-scheme: light dark;

  /* Paleta LIGHT */
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;

  --accent: #F7AB08;      /* Amarillo corporativo oficial */
  --accent-dark: #cf9007; /* Versión ligeramente más oscura para hover */

  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-pattern: rgba(255, 255, 255, 0.04);
    --fg: #f3f4f6;
    --card-bg: rgba(17, 17, 17, 0.85);
    --card-border: #2a2a2a;
  }
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
}

html[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-pattern: rgba(255, 255, 255, 0.04);
  --fg: #f3f4f6;
  --card-bg: rgba(17, 17, 17, 0.85);
  --card-border: #2a2a2a;
}

/* ---------- Variables de Color y Tema ---------- */
:root {
  color-scheme: light dark;

  /* Paleta LIGHT */
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;
  --text: #1e1e1e;

  --accent: #F7AB08;
  --accent-dark: #cf9007;

  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-pattern: rgba(255, 255, 255, 0.04);
    --fg: #f3f4f6;
    --text: #f3f4f6;

    --card-bg: rgba(17, 17, 17, 0.85);
    --card-border: #2a2a2a;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  }
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;
  --text: #1e1e1e;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
}

html[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-pattern: rgba(255, 255, 255, 0.04);
  --fg: #f3f4f6;
  --text: #f3f4f6;
  --card-bg: rgba(17, 17, 17, 0.85);
  --card-border: #2a2a2a;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* ---------- Variables de Color y Tema ---------- */
:root {
  color-scheme: light dark;

  /* Paleta LIGHT */
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;
  --text: #1e1e1e;

  --accent: #F7AB08;
  --accent-dark: #cf9007;

  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-pattern: rgba(255, 255, 255, 0.04);
    --fg: #f3f4f6;
    --text: #f3f4f6;

    --card-bg: rgba(17, 17, 17, 0.85);
    --card-border: #2a2a2a;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  }
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-pattern: rgba(0, 0, 0, 0.025);
  --fg: #1e1e1e;
  --text: #1e1e1e;
  --card-bg: rgba(255, 255, 255, 0.92);
  --card-border: #e0e0e0;
}

html[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-pattern: rgba(255, 255, 255, 0.04);
  --fg: #f3f4f6;
  --text: #f3f4f6;
  --card-bg: rgba(17, 17, 17, 0.85);
  --card-border: #2a2a2a;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* ---------- Reset & Layout ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  /* Fondo cubre toda la ventana */
  min-height: 100dvh;

  /* Centrado horizontal, alineado arriba */
  display: flex;
  justify-content: center;
  align-items: flex-start;

  /* padding-block: 0.5 rem arriba · 2 rem abajo
     padding-inline: 0.5 rem (móvil) → 1.25 rem (desktop)          */
  padding-block: 0.5rem 2rem;
  padding-inline: clamp(0.5rem, 4vw, 1.25rem);

  overflow-y: auto;          /* desplaza si hace falta */

  font-family: "Inter", system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--fg);
  background-image: repeating-linear-gradient(
    135deg,
    transparent 0 12px,
    var(--bg-pattern) 12px 24px
  );
}

/* ---------- Tarjeta ---------- */
.card {
  margin-top: 1lh;
  position: relative;
  backdrop-filter: blur(10px);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  max-width: 600px;     /* más ancha */
  width: 100%;
  padding: 2.5rem 3rem;
}

@media (max-width: 480px) {
  .card {
    max-width: 92vw;
    padding: 1.75rem 1.25rem;
  }
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: var(--accent);
  border-radius: 1.25rem 1.25rem 0 0;
}

/* ---------- Cabecera (logo encima del título) ---------- */
.logo-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

/* Logo más grande y flexible */
.card .logo {
  max-height: clamp(100px, 18vw, 160px); /* 100–160 px según ancho viewport */
  width: auto;
  object-fit: contain;
}

/* Filtro para modo oscuro */
html[data-theme='dark'] .card .logo {
  filter: brightness(0) invert(1);
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme='light']) .card .logo {
    filter: brightness(0) invert(1);
  }
}

/* Título */
.logo-title h1 {
  font-size: clamp(1.3rem, 4vw + 0.4rem, 1.8rem);
  line-height: 1.15;
  margin: 0;
  color: var(--accent);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4); /* por defecto (modo claro) */
}

/* En modo oscuro */
html[data-theme='dark'] .logo-title h1 {
  text-shadow: 1px 1px 4px rgba(255, 255, 255, 0.4);
}


/* ---------- Formularios ---------- */
label { 
  display: block; 
  font-weight: 600; 
  margin-bottom: 0.35rem; 
  transition: all 0.3s ease-in-out;
}

input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--card-border);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  transition: border-color 0.2s;
}

input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 50%, transparent);
}

/* ---------- Botón principal ---------- */
#calcular {
  width: 100%;
  padding: 0.85rem 1rem;
  background: var(--accent);
  border: none;
  border-radius: 0.5rem;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

#calcular:hover   { background: var(--accent-dark); }
#calcular:active { transform: scale(0.97); }

/* ---------- Información del ángulo calculado ---------- */
.angle-info {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(247, 171, 8, 0.05) 100%);
  border: 1px solid rgba(247, 171, 8, 0.2);
  border-radius: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.angle-info.hidden {
  display: none;
}

.angle-label {
  color: var(--fg);
  font-weight: 600;
  opacity: 0.8;
}

.angle-value {
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
}

/* Estilos para tema oscuro */
html[data-theme="dark"] .angle-info {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(247, 171, 8, 0.08) 100%);
  border: 1px solid rgba(247, 171, 8, 0.3);
}

@media (prefers-color-scheme: dark) {
  .angle-info {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(247, 171, 8, 0.08) 100%);
    border: 1px solid rgba(247, 171, 8, 0.3);
  }
}

/* ---------- Resultado ---------- */
.result-section {
  margin-top: 1.75rem;
}

.result-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.5rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

#result {
  padding: 1.2rem 2rem;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  border: none;
  border-radius: 1rem;
  box-shadow: 
    0 8px 25px rgba(0,0,0,.15),
    0 4px 12px rgba(247, 171, 8, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  letter-spacing: 0.02em;
  line-height: 1.2;
  min-height: 4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#result::before {
  content: "⚖️";
  position: absolute;
  top: 50%;
  left: 1.2rem;
  transform: translateY(-50%);
  font-size: 1.6rem;
  opacity: 0.9;
  line-height: 1;
}

#result::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

#result:not(:empty) {
  cursor: pointer;
  user-select: none;
}

#result:not(:empty):hover {
  /* transform: translateY(-3px); */
  box-shadow: 
    0 12px 35px rgba(0,0,0,.2),
    0 8px 20px rgba(247, 171, 8, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Estilos para tema oscuro */
html[data-theme="dark"] #result {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  box-shadow: 
    0 8px 25px rgba(0,0,0,.4),
    0 4px 12px rgba(247, 171, 8, 0.3),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

html[data-theme="dark"] #result:not(:empty):hover {
  box-shadow: 
    0 12px 35px rgba(0,0,0,.5),
    0 8px 20px rgba(247, 171, 8, 0.4),
    inset 0 1px 0 rgba(255,255,255,0.2);
}

@media (prefers-color-scheme: dark) {
  #result {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
    box-shadow: 
      0 8px 25px rgba(0,0,0,.4),
      0 4px 12px rgba(247, 171, 8, 0.3),
      inset 0 1px 0 rgba(255,255,255,0.15);
  }
  
  #result:not(:empty):hover {
    box-shadow: 
      0 12px 35px rgba(0,0,0,.5),
      0 8px 20px rgba(247, 171, 8, 0.4),
      inset 0 1px 0 rgba(255,255,255,0.2);
  }
}

/* ---------- Mensajes de Error/Advertencia ---------- */
.message-container {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: all 0.3s ease;
}

.message-container.hidden {
  display: none;
}

.message-container.error {
  color: #9c0006;
  background: #ffc7ce;
  border: 2px solid rgba(156, 0, 6, 0.4);
}

.message-container.warning {
  color: #9c5700;
  background: #ffeb9c;
  border: 2px solid #ffca28;
}

/* Estilos para tema oscuro */
html[data-theme="dark"] .message-container.error {
  color: #9c0006;
  background: #ffc7ce;
  border: 2px solid rgba(156, 0, 6, 0.4);
}

html[data-theme="dark"] .message-container.warning {
  color: #9c5700;
  background: #ffeb9c;
  border: 2px solid #ffa000;
}

@media (prefers-color-scheme: dark) {
  .message-container.error {
    color: #9c0006;
    background: #ffc7ce;
    border: 2px solid rgba(156, 0, 6, 0.4);
  }
  
  .message-container.warning {
    color: #9c5700;
    background: #ffeb9c;
    border: 2px solid #ffa000;
  }
}


/* ---------- Botón flotante tema ---------- */
#theme-toggle {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: background 0.15s;
}

#theme-toggle:hover { background: var(--accent-dark); }

/* ---------- Pestañas pill ---------- */
.tabs {
  display: flex;
  margin-bottom: 1rem;
  border: 1px solid #ccc;
  border-radius: 999px;
  overflow: hidden;
  list-style: none;   /* elimina viñeta/punto */
  padding: 0;         /* evita sangrado izquierdo */
}

.tabs li {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0.2rem;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}

.tabs li:not(.active) { background: transparent; color: var(--text); }
.tabs li.active       { background: var(--accent); color: #fff; }

/* ---------- Ocultar grupos según método ---------- */
.method-group[hidden] { display: none; }

/* Diagrama: máximo 260 px de alto, adapta ancho y mantiene proporción */
.diagram {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.diagram img {
  max-height: 260px;
  width: auto;
}

@media (max-width: 480px) {
  .diagram img {
    max-height: 180px;   /* antes 260 px → cabe mejor en móvil */
  }
}

/* ---------- Notificación Toast ---------- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 25px rgba(0,0,0,.2), 0 4px 12px rgba(247, 171, 8, 0.4);
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.2);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast::before {
  content: "📋";
  margin-right: 0.5rem;
}

/* Estilos para tema oscuro */
html[data-theme="dark"] .toast {
  background: var(--accent);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 8px 25px rgba(0,0,0,.4), 0 4px 12px rgba(247, 171, 8, 0.3);
}

@media (prefers-color-scheme: dark) {
  .toast {
    background: var(--accent);
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 8px 25px rgba(0,0,0,.4), 0 4px 12px rgba(247, 171, 8, 0.3);
  }
}

/* Responsivo móvil */
@media (max-width: 480px) {
  .toast {
    top: 10px;
    left: 10px;
    right: 10px;
    transform: translateY(-100px);
    max-width: calc(100vw - 20px);
  }
  
  .toast.show {
    transform: translateY(0);
  }
}