/* ============================================
   FACIL — Forgejo custom branding
   Estructura: reglas globales + reglas scoped a auth pages
   ============================================ */

/* === Color primario: #c2410c → #1d439a (GLOBAL) === */
:root,
html,
html[data-theme],
html[data-theme="forgejo-auto"],
html[data-theme="forgejo-light"],
html[data-theme="forgejo-dark"] {
  --color-primary: #1d439a !important;
  --color-primary-contrast: #ffffff !important;
  --color-primary-dark-1: #1a3c8a !important;
  --color-primary-dark-2: #17357a !important;
  --color-primary-dark-3: #142e6a !important;
  --color-primary-dark-4: #11275a !important;
  --color-primary-dark-5: #0e204a !important;
  --color-primary-dark-6: #0b193a !important;
  --color-primary-dark-7: #08122a !important;
  --color-primary-light-1: #2a52ab !important;
  --color-primary-light-2: #4068bc !important;
  --color-primary-light-3: #567ecd !important;
  --color-primary-light-4: #6c94de !important;
  --color-primary-light-5: #82aaef !important;
  --color-primary-light-6: #98c0ff !important;
  --color-primary-light-7: #aed6ff !important;
  --color-primary-alpha-10: rgba(29,67,154,.10) !important;
  --color-primary-alpha-20: rgba(29,67,154,.20) !important;
  --color-primary-alpha-30: rgba(29,67,154,.30) !important;
  --color-primary-alpha-40: rgba(29,67,154,.40) !important;
  --color-primary-alpha-50: rgba(29,67,154,.50) !important;
  --color-primary-alpha-60: rgba(29,67,154,.60) !important;
  --color-primary-alpha-70: rgba(29,67,154,.70) !important;
  --color-primary-alpha-80: rgba(29,67,154,.80) !important;
  --color-primary-alpha-90: rgba(29,67,154,.90) !important;
}

.ui.primary.labels .label,
.ui.ui.ui.primary.label,
.ui.primary.button,
.ui.primary.buttons .button {
  background: #1d439a !important;
  background-color: #1d439a !important;
  color: #ffffff !important;
}
.ui.primary.button:hover,
.ui.primary.buttons .button:hover,
.ui.primary.button:focus,
.ui.primary.buttons .button:focus { background: #1a3c8a !important; }
.ui.primary.button:active,
.ui.primary.buttons .button:active { background: #142e6a !important; }
.ui.basic.primary.button,
.ui.basic.primary.buttons .button {
  box-shadow: 0 0 0 1px #1d439a inset !important;
  color: #1d439a !important;
}

/* Logo navbar (GLOBAL — aplica también logueado) */
#navbar-logo img.logo,
#navbar-logo > img,
.logo img,
img.logo {
  object-fit: contain;
  background: transparent !important;
  filter: none;
  max-height: 36px !important;
  width: auto !important;
  height: 36px !important;
}

/* Footer FACIL flotante (GLOBAL) */
.footer .container { font-size: 12px; }
body { padding-bottom: 70px; padding-top: 0; }

/* ============================================
   ▼▼▼ TODO LO SIGUIENTE: solo en PÁGINAS DE AUTH ▼▼▼
   Scope vía body:has(.page-content.user.signin|signup|...)
   ============================================ */

/* === Header del form: logo FACIL en lugar de "Sign In" === */
.user.signin .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  font-size: 0 !important;
  line-height: 0 !important;
  padding: 1.2rem 1rem !important;
  min-height: 90px;
  background-image: url('/assets/img/logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center center;
  background-color: transparent;
  color: transparent !important;
}

/* === Ocultar navbar-left y navbar-right SOLO en auth === */
body:has(.page-content.user.signin) .navbar-left.ui.secondary.menu,
body:has(.page-content.user.signin) .navbar-right.ui.secondary.menu,
body:has(.page-content.user.signup) .navbar-left.ui.secondary.menu,
body:has(.page-content.user.signup) .navbar-right.ui.secondary.menu,
body:has(.page-content.user.activate) .navbar-left.ui.secondary.menu,
body:has(.page-content.user.activate) .navbar-right.ui.secondary.menu,
body:has(.page-content.user.forgot_password) .navbar-left.ui.secondary.menu,
body:has(.page-content.user.forgot_password) .navbar-right.ui.secondary.menu,
body:has(.page-content.user.reset_password) .navbar-left.ui.secondary.menu,
body:has(.page-content.user.reset_password) .navbar-right.ui.secondary.menu {
  display: none !important;
}

/* === Ocultar .page-footer .left-links SOLO en auth === */
body:has(.page-content.user.signin) .page-footer,
body:has(.page-content.user.signup) .page-footer,
body:has(.page-content.user.activate) .page-footer,
body:has(.page-content.user.forgot_password) .page-footer,
body:has(.page-content.user.reset_password) .page-footer {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  box-shadow: none !important;
}
body:has(.page-content.user.signin) .page-footer .left-links,
body:has(.page-content.user.signup) .page-footer .left-links,
body:has(.page-content.user.activate) .page-footer .left-links,
body:has(.page-content.user.forgot_password) .page-footer .left-links,
body:has(.page-content.user.reset_password) .page-footer .left-links {
  display: none !important;
}

/* === Reposicionar .right-links al top SOLO en auth === */
body:has(.page-content.user.signin) .page-footer .right-links,
body:has(.page-content.user.signup) .page-footer .right-links,
body:has(.page-content.user.activate) .page-footer .right-links,
body:has(.page-content.user.forgot_password) .page-footer .right-links,
body:has(.page-content.user.reset_password) .page-footer .right-links {
  position: fixed !important;
  top: 0;
  right: 0;
  z-index: 950;
  display: flex !important;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  margin: 0 !important;
  background: transparent;
  font-size: 13px;
}

body:has(.page-content.user.signin) .page-footer .right-links a,
body:has(.page-content.user.signup) .page-footer .right-links a,
body:has(.page-content.user.activate) .page-footer .right-links a,
body:has(.page-content.user.forgot_password) .page-footer .right-links a,
body:has(.page-content.user.reset_password) .page-footer .right-links a {
  color: var(--color-text);
  text-decoration: none;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
}
body:has(.page-content.user.signin) .page-footer .right-links a:hover,
body:has(.page-content.user.signup) .page-footer .right-links a:hover,
body:has(.page-content.user.activate) .page-footer .right-links a:hover,
body:has(.page-content.user.forgot_password) .page-footer .right-links a:hover,
body:has(.page-content.user.reset_password) .page-footer .right-links a:hover {
  color: var(--color-primary);
  background: var(--color-primary-alpha-10);
}

body:has(.page-content.user.signin) .page-footer .right-links .dropdown.language .menu,
body:has(.page-content.user.signup) .page-footer .right-links .dropdown.language .menu,
body:has(.page-content.user.activate) .page-footer .right-links .dropdown.language .menu,
body:has(.page-content.user.forgot_password) .page-footer .right-links .dropdown.language .menu,
body:has(.page-content.user.reset_password) .page-footer .right-links .dropdown.language .menu {
  top: 100% !important;
  bottom: auto !important;
  margin-top: 4px !important;
}

/* === Centrar form vertical y horizontalmente === */
.page-content.user.signin,
.page-content.user.activate,
.page-content.user.signup,
.page-content.user.forgot_password,
.page-content.user.reset_password {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 70px) !important;
  padding: 1rem !important;
}

.page-content.user.signin > .ui.container.column.fluid,
.page-content.user.signup > .ui.container.column.fluid,
.page-content.user.activate > .ui.container.column.fluid,
.page-content.user.forgot_password > .ui.container.column.fluid,
.page-content.user.reset_password > .ui.container.column.fluid {
  width: 100% !important;
  max-width: 480px !important;
  margin: 0 auto !important;
  padding: 0 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15),
              0 4px 12px rgba(29, 67, 154, 0.08),
              0 0 0 1px rgba(29, 67, 154, 0.06) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
  background: var(--color-box-body, #ffffff);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.page-content.user.signin > .ui.container.column.fluid:hover,
.page-content.user.signup > .ui.container.column.fluid:hover,
.page-content.user.activate > .ui.container.column.fluid:hover,
.page-content.user.forgot_password > .ui.container.column.fluid:hover,
.page-content.user.reset_password > .ui.container.column.fluid:hover {
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.18),
              0 6px 16px rgba(29, 67, 154, 0.12),
              0 0 0 1px rgba(29, 67, 154, 0.10) !important;
}

.page-content.user.signin .ui.top.attached.header.center,
.page-content.user.signup .ui.top.attached.header.center,
.page-content.user.activate .ui.top.attached.header.center,
.page-content.user.forgot_password .ui.top.attached.header.center,
.page-content.user.reset_password .ui.top.attached.header.center {
  border-radius: 8px 8px 0 0 !important;
  border-bottom: 1px solid var(--color-secondary-light-2, #e5e7eb) !important;
}
.page-content.user.signin .ui.attached.segment,
.page-content.user.signup .ui.attached.segment,
.page-content.user.activate .ui.attached.segment,
.page-content.user.forgot_password .ui.attached.segment,
.page-content.user.reset_password .ui.attached.segment {
  border-radius: 0 0 8px 8px !important;
  border-top: none !important;
}

/* Logo grande en form login */
.signin-form img.logo,
form.signin img.logo {
  display: block;
  margin: 0 auto 1rem auto;
  height: 80px !important;
  max-height: 80px !important;
  width: auto !important;
}

/* ============================================
   GLOBAL — Ocultar "Powered by Forgejo / Version / Page / Template"
   en el footer en TODAS las páginas (login + logueado)
   ============================================ */
.page-footer .left-links {
  display: none !important;
}

/* ============================================
   AUTH PAGES — Ocultar el <nav id="navbar"> completo
   ============================================ */
body:has(.page-content.user.signin) #navbar,
body:has(.page-content.user.signup) #navbar,
body:has(.page-content.user.activate) #navbar,
body:has(.page-content.user.forgot_password) #navbar,
body:has(.page-content.user.reset_password) #navbar {
  display: none !important;
}

/* ============================================
   AUTH PAGES — Ocultar el .right-links completo
   (idiomas / Help / API) en páginas de login
   ============================================ */
body:has(.page-content.user.signin) .page-footer .right-links,
body:has(.page-content.user.signup) .page-footer .right-links,
body:has(.page-content.user.activate) .page-footer .right-links,
body:has(.page-content.user.forgot_password) .page-footer .right-links,
body:has(.page-content.user.reset_password) .page-footer .right-links {
  display: none !important;
}

/* ============================================
   AUTH PAGES — Padding generoso arriba/abajo del logo FACIL
   ============================================ */
.user.signin .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  padding-top: 2.5rem !important;
  padding-bottom: 2.5rem !important;
  min-height: 140px !important;
}

/* ============================================
   AUTH PAGES — Override: logo a tamaño fijo + padding real
   El "contain" anterior hacía que el logo se estirara al
   crecer el padding. Fijo el alto del logo en 60px para
   que el padding sí cree espacio.
   ============================================ */
.user.signin .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  background-size: auto 60px !important;  /* logo siempre 60px de alto */
  padding-top: 2.5rem !important;          /* espacio real arriba */
  padding-bottom: 2.5rem !important;       /* espacio real abajo */
  min-height: 0 !important;                /* el alto lo define padding + logo */
}

/* ============================================
   AUTH PAGES — Logo 80px + padding 7rem + texto "Facil Git" debajo
   Uso ::before para el logo y ::after para el texto, así el h4 se
   vuelve un flex column y ambos hijos respetan el padding real.
   ============================================ */
.user.signin .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  background-image: none !important;     /* quitamos el background — pasa a ::before */
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1.25rem !important;
  font-size: 0 !important;               /* oculta el texto "Sign In" original */
  line-height: 0 !important;
  padding: 7rem 1rem !important;         /* espacio real arriba y abajo */
  min-height: 0 !important;
}

/* Logo (80px de alto, ratio mantenido) */
.user.signin .ui.top.attached.header.center::before,
.user.signup .ui.top.attached.header.center::before,
.user.activate .ui.top.attached.header.center::before,
.user.forgot_password .ui.top.attached.header.center::before,
.user.reset_password .ui.top.attached.header.center::before {
  content: "" !important;
  display: block !important;
  width: 100% !important;
  height: 80px !important;
  background-image: url("/assets/img/logo.png") !important;
  background-size: auto 80px !important;
  background-repeat: no-repeat !important;
  background-position: center center !important;
}

/* Texto "Facil Git" debajo del logo, centrado y en negrita */
.user.signin .ui.top.attached.header.center::after,
.user.signup .ui.top.attached.header.center::after,
.user.activate .ui.top.attached.header.center::after,
.user.forgot_password .ui.top.attached.header.center::after,
.user.reset_password .ui.top.attached.header.center::after {
  content: "Facil Git" !important;
  display: block !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  color: var(--color-text) !important;
  text-align: center !important;
  letter-spacing: 0.5px;
}

/* === AUTH PAGES — Ajuste fino: padding 1.5rem + gap 1.1rem === */
.user.signin .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  padding: 1.5rem 1rem !important;
  gap: 1.1rem !important;
}

/* === AUTH PAGES — Texto "Facil Git": font-size 2.5rem, sin weight/line-height === */
.user.signin .ui.top.attached.header.center::after,
.user.signup .ui.top.attached.header.center::after,
.user.activate .ui.top.attached.header.center::after,
.user.forgot_password .ui.top.attached.header.center::after,
.user.reset_password .ui.top.attached.header.center::after {
  font-size: 2.5rem !important;
  font-weight: initial !important;
  line-height: initial !important;
}

/* === AUTH PAGES — Gap logo↔texto: 0.5rem === */
.user.signin .ui.top.attached.header.center,
.user.signup .ui.top.attached.header.center,
.user.activate .ui.top.attached.header.center,
.user.forgot_password .ui.top.attached.header.center,
.user.reset_password .ui.top.attached.header.center {
  gap: 0.5rem !important;
}

/* === AUTH PAGES — Logo a 85px === */
.user.signin .ui.top.attached.header.center::before,
.user.signup .ui.top.attached.header.center::before,
.user.activate .ui.top.attached.header.center::before,
.user.forgot_password .ui.top.attached.header.center::before,
.user.reset_password .ui.top.attached.header.center::before {
  height: 85px !important;
  background-size: auto 85px !important;
}

/* ============================================

/* === AUTH PAGES — Quitar texto "Facil Git" del header === */
.user.signin .ui.top.attached.header.center::after,
.user.signup .ui.top.attached.header.center::after,
.user.activate .ui.top.attached.header.center::after,
.user.forgot_password .ui.top.attached.header.center::after,
.user.reset_password .ui.top.attached.header.center::after {
  content: none !important;
  display: none !important;
}
