/* ==========================================================================
   Rada Gestión — hoja de estilos de portada (login + selector de servicios)
   Solo estética. No altera lógica ni flujos de la aplicación.
   ========================================================================== */

:root {
  --rt-ink:        #0F423C;   /* Títulos */
  --rt-deep:       #12544D;   /* Botones y acentos sólidos */
  --rt-deep-hover: #0C3E39;
  --rt-brand:      #209996;   /* Verde agua institucional */
  --rt-soft:       #E2EFEA;   /* Fondo de los círculos de ícono */
  --rt-surface:    #FFFFFF;
  --rt-canvas:     #FAFBFB;
  --rt-muted:      #64766F;   /* Texto secundario */
  --rt-line:       #E5EBE9;   /* Bordes */
  --rt-focus:      rgba(32, 153, 150, .35);

  --rt-radius:     14px;
  --rt-shell:      1200px;
  --rt-shadow:     0 1px 2px rgba(15, 66, 60, .04), 0 8px 24px rgba(15, 66, 60, .06);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--rt-ink);
  background-color: var(--rt-surface);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--rt-focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.rt-shell {
  width: 100%;
  max-width: var(--rt-shell);
  margin-inline: auto;
  padding-inline: 28px;
}

/* --------------------------------------------------------------------------
   Marcas / logotipos
   Los archivos originales son blancos sobre transparente: se invierten cuando
   van sobre fondo claro y se usan tal cual sobre fondo oscuro.
   -------------------------------------------------------------------------- */
.rt-lockup {
  display: flex;
  align-items: center;
  gap: 20px;
}

.rt-lockup__sep {
  width: 1px;
  align-self: stretch;
  min-height: 34px;
  background: currentColor;
  opacity: .22;
}

.rt-logo-muni  { display: block; width: 158px; height: auto; }
.rt-logo-gestion { display: block; width: 128px; height: auto; }

/* Sobre fondo claro: el SVG del municipio ya es oscuro; el PNG de Rada Gestión
   es blanco y necesita invertirse. */
.rt-lockup--dark .rt-logo-gestion { filter: invert(1); }
/* Sobre fondo oscuro: al revés. */
.rt-lockup--light .rt-logo-muni   { filter: invert(1); }

/* Marca de olas recortada, usada como máscara para poder teñirla. */
.rt-olas {
  display: block;
  width: 30px;
  aspect-ratio: 320 / 281;
  background-color: var(--rt-deep);
  -webkit-mask: url("../assets/olas-rada.png") center / contain no-repeat;
          mask: url("../assets/olas-rada.png") center / contain no-repeat;
}

/* --------------------------------------------------------------------------
   Botones
   -------------------------------------------------------------------------- */
.rt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.rt-btn svg { flex: none; }

.rt-btn--primary {
  background-color: var(--rt-deep);
  color: #fff;
}
.rt-btn--primary:hover { background-color: var(--rt-deep-hover); }

.rt-btn--ghost {
  background-color: var(--rt-surface);
  border-color: var(--rt-line);
  color: var(--rt-ink);
}
.rt-btn--ghost:hover { border-color: #C9D6D2; background-color: var(--rt-canvas); }

.rt-btn--block { width: 100%; }

/* --------------------------------------------------------------------------
   Círculo de ícono
   -------------------------------------------------------------------------- */
.rt-icon {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background-color: var(--rt-soft);
  color: var(--rt-deep);
}

/* ==========================================================================
   1. Pantalla de acceso (login.php)
   ========================================================================== */
.rt-auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(430px, .95fr);
}

/* --- Panel izquierdo: imagen institucional ------------------------------- */
.rt-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 42px 56px 40px;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
  /* Degradado de marca. Si se coloca una foto en assets/hero.jpg,
     login.php la superpone mediante --rt-hero-photo. */
  background:
    radial-gradient(88% 62% at 22% 96%, rgba(216, 148, 84, .40), transparent 62%),
    radial-gradient(70% 55% at 88% 4%,  rgba(58, 176, 170, .38), transparent 60%),
    linear-gradient(168deg, #0B3A41 0%, #10545A 38%, #1B7A73 68%, #0A3438 100%);
}

.rt-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image: var(--rt-hero-photo, none);
  background-size: cover;
  background-position: center;
}

/* Velo para que el texto siempre tenga contraste sobre la foto. */
.rt-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(155deg, rgba(6, 42, 46, .62) 0%, rgba(6, 42, 46, .18) 46%, rgba(6, 42, 46, .78) 100%);
}

/* Filigrana de olas */
.rt-hero__watermark {
  position: absolute;
  z-index: -1;
  right: -6%;
  top: 8%;
  width: 46%;
  aspect-ratio: 320 / 281;
  background-color: #fff;
  opacity: .07;
  -webkit-mask: url("../assets/olas-rada.png") center / contain no-repeat;
          mask: url("../assets/olas-rada.png") center / contain no-repeat;
  pointer-events: none;
}

.rt-hero__copy { max-width: 30ch; }

.rt-hero__copy h1 {
  margin: 0 0 18px;
  font-size: clamp(1.9rem, 2.6vw, 2.6rem);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.015em;
  text-wrap: balance;
}

.rt-hero__copy p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, .88);
  max-width: 34ch;
}

.rt-hero__features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 26px;
  margin: 0;
  padding: 26px 0 0;
  list-style: none;
  border-top: 1px solid rgba(255, 255, 255, .22);
}

.rt-hero__features h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font-size: .98rem;
  font-weight: 700;
}

.rt-hero__features p {
  margin: 0;
  font-size: .85rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, .82);
}

/* --- Panel derecho: formulario ------------------------------------------ */
.rt-auth__panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 48px 40px;
  background-color: var(--rt-canvas);
}

.rt-card {
  width: 100%;
  max-width: 380px;
  padding: 34px 34px 30px;
  background-color: var(--rt-surface);
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  box-shadow: var(--rt-shadow);
  text-align: center;
}

.rt-card .rt-icon { margin: 0 auto 18px; }

.rt-card h1 {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
}

.rt-card__lead {
  margin: 0 0 24px;
  font-size: .9rem;
  color: var(--rt-muted);
}

.rt-form { text-align: left; }

.rt-field { margin-bottom: 16px; }

.rt-field label {
  display: block;
  margin-bottom: 6px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--rt-ink);
}

.rt-field input {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: .95rem;
  color: var(--rt-ink);
  background-color: var(--rt-surface);
  border: 1px solid var(--rt-line);
  border-radius: 10px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.rt-field input:hover { border-color: #C9D6D2; }

.rt-field input:focus {
  outline: none;
  border-color: var(--rt-brand);
  box-shadow: 0 0 0 3px var(--rt-focus);
}

.rt-form .rt-btn { margin-top: 6px; }

.rt-alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  text-align: left;
  font-size: .85rem;
  color: #8A2A24;
  background-color: #FDF2F1;
  border: 1px solid #F3D6D3;
  border-radius: 10px;
}

.rt-alert ul { margin: 0; padding: 0; list-style: none; }
.rt-alert li + li { margin-top: 4px; }

/* --------------------------------------------------------------------------
   Pie
   -------------------------------------------------------------------------- */
.rt-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  font-size: .78rem;
  color: var(--rt-muted);
}

.rt-foot span { display: flex; align-items: center; gap: 14px; }
.rt-foot span::before {
  content: "";
  width: 1px;
  height: 12px;
  background-color: #CBD6D2;
}

/* ==========================================================================
   2. Selector de servicios (index.php)
   ========================================================================== */
.rt-app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--rt-surface);
}

.rt-topbar { padding: 22px 0 0; }

.rt-topbar .rt-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.rt-topbar__user {
  display: flex;
  align-items: center;
  gap: 14px;
}

.rt-topbar__name {
  font-size: .88rem;
  color: var(--rt-muted);
}

.rt-main { flex: 1; padding: 54px 0 60px; }

.rt-main h1 {
  margin: 0 0 6px;
  font-size: clamp(1.5rem, 2.4vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -.015em;
}

.rt-main__lead {
  margin: 0 0 36px;
  font-size: .98rem;
  color: var(--rt-muted);
}

.rt-services {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
}

.rt-service {
  flex: 1 1 0;
  min-width: 190px;
  max-width: 252px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 30px 22px 24px;
  text-align: center;
  background-color: var(--rt-surface);
  border: 1px solid var(--rt-line);
  border-radius: var(--rt-radius);
  box-shadow: var(--rt-shadow);
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.rt-service:hover {
  border-color: #CFDEDA;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(15, 66, 60, .05), 0 14px 32px rgba(15, 66, 60, .09);
}

.rt-service h2 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.3;
}

.rt-service p {
  margin: 0;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--rt-muted);
}

.rt-service .rt-btn {
  margin-top: auto;
  width: 100%;
  padding-block: 11px;
  font-size: .88rem;
}

.rt-app .rt-foot { padding: 26px 0 30px; }

/* ==========================================================================
   Adaptación a pantallas chicas
   ========================================================================== */
@media (max-width: 1150px) {
  .rt-services { justify-content: center; }
}

@media (max-width: 1080px) {
  .rt-hero { padding: 34px 38px; }
  .rt-hero__features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .rt-auth { grid-template-columns: minmax(0, 1fr); }

  .rt-hero {
    min-height: 300px;
    gap: 30px;
    padding: 30px 26px 34px;
  }

  .rt-hero__features { display: none; }

  .rt-auth__panel { padding: 36px 22px 44px; }

  .rt-shell { padding-inline: 20px; }
}

@media (max-width: 640px) {
  .rt-topbar__name { display: none; }
  .rt-main { padding: 34px 0 44px; }
  .rt-service { max-width: none; min-width: 100%; }
  .rt-logo-muni { width: 128px; }
  .rt-logo-gestion { width: 104px; }
  .rt-lockup { gap: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
