/* =========================
       1. ESTILOS GLOBALES Y BASE
       ========================= */
:root {
  --venkel: #005EC4;
  --text: #0B1220;
  --border: rgba(15, 23, 42, .12);
  --bg: #f6f8fc;
  --radius: 3px;
  --shadow-header: 0 10px 22px rgba(0, 0, 0, .10);
  --card-gray: #ebebeb;
  --font: "Work Sans", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  --maxW: 1320px;
  --toolW: 220px;
  --gap: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
}

.page {
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
}

/* =========================
       2. COMPONENTE: HEADER
       ========================= */
.header {
  position: relative;
  color: #fff;
  overflow: hidden;
  min-height: clamp(300px, 40vh, 460px);
  border-bottom: 1px solid rgba(255, 255, 255, .18);
  box-shadow: var(--shadow-header);
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("https://images.unsplash.com/photo-1529070538774-1843cb3265df?auto=format&fit=crop&w=2400&q=70");
  background-size: cover;
  background-position: center;
  filter: blur(7px) saturate(1.05);
  transform: scale(1.10);
  opacity: .60;
  z-index: 0;
}

.header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 94, 196, .92);
  z-index: 0;
}

.header-inner {
  position: relative;
  z-index: 1;
  max-width: var(--maxW);
  margin: 0 auto;
  padding: clamp(12px, 1.8vw, 18px) clamp(14px, 2.4vw, 28px) clamp(22px, 3vw, 34px);
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 2px;
}

.venkel-logo {
  height: clamp(78px, 6.2vw, 112px);
  width: auto;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .22));
  transform-origin: left center;
}

.header-center {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 18px;
  align-content: center;
  padding-bottom: 4px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s ease;
}

.page.ready .header-center {
  opacity: 1;
  transform: translateY(0);
}

#loadingState,
#userInfo,
#signInContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  width: 100%;
}

.avatar {
  width: clamp(82px, 7.2vw, 106px);
  height: clamp(82px, 7.2vw, 106px);
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  display: grid;
  place-items: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .60);
  will-change: transform;
}

.avatar img {
  width: 52%;
  height: 52%;
  object-fit: contain;
}

.page.ready .avatar {
  animation: popIn .38s ease both;
}

@keyframes popIn {
  from { transform: scale(.96); }
  to { transform: scale(1); }
}

.hello {
  margin: 0;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: clamp(1rem, 2vw, 1.625rem);
  text-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.email {
  margin: 0;
  opacity: .95;
  text-decoration: underline;
  text-underline-offset: 5px;
  text-decoration-thickness: 2px;
  cursor: pointer;
  display: inline-block;
  transition: transform .16s ease, opacity .16s ease;
  user-select: auto;
}

.email:hover {
  transform: translateY(-1px);
  opacity: 1;
}

.email:active {
  transform: translateY(0);
}

/* Botón genérico (usado en header) */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, .34);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  text-decoration: none;
  font-size: 0.8125rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
  transition: transform .18s ease, background .18s ease, border-color .18s ease;
  outline: none;
  white-space: nowrap;
  will-change: transform;
}

.btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, .20);
  border-color: rgba(255, 255, 255, .46);
}

.btn:active {
  transform: translateY(0) scale(.99);
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .22), 0 10px 22px rgba(0, 0, 0, .12);
}

.btn .fa-up-right-from-square {
  font-size: 1rem;
  line-height: 1;
  opacity: .95;
  margin-left: 2px;
}

/* =========================
       3. COMPONENTE: CONTENIDO PRINCIPAL
       ========================= */
.content {
  background: #fff;
  padding: clamp(18px, 2.6vw, 30px) clamp(14px, 2.4vw, 28px) clamp(18px, 3vw, 34px);
  display: grid;
  place-items: start center;
}

.content-inner {
  width: 100%;
  max-width: var(--maxW);
  display: grid;
  grid-template-rows: auto auto auto auto;
  row-gap: 22px;
}

.question {
  text-align: center;
  margin: 0;
  font-size: 0.9375rem;
  color: rgba(11, 18, 32, .78);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .30s ease, transform .30s ease;
  transition-delay: .06s;
}

.page.ready .question {
  opacity: 1;
  transform: translateY(0);
}

/* Fila de Apps de Google */
.apps-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .30s ease, transform .30s ease;
  transition-delay: .12s;
}

.page.ready .apps-row {
  opacity: 1;
  transform: translateY(0);
}

.app {
  width: 62px;
  height: 62px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: none;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
  outline: none;
  will-change: transform;
}

.app:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 94, 196, .30);
  background: rgba(0, 94, 196, .02);
}

.app:active {
  transform: translateY(0) scale(.99);
}

.app:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 94, 196, .18);
}

.app img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

/* =========================
       4. COMPONENTE: HERRAMIENTAS Y CARRUSEL
       ========================= */
.tools {
  padding-top: 22px;
  padding-bottom: 22px;
  margin-bottom: 18px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .34s ease, transform .34s ease;
  transition-delay: .18s;
}

.page.ready .tools {
  opacity: 1;
  transform: translateY(0);
}

/* Estilos de las tarjetas (ahora son enlaces) */
.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  border-radius: var(--radius);
  background: transparent;
  overflow: visible;
  transition: transform .16s ease;
  will-change: transform;
}

.tool-card:hover {
  transform: translateY(-3px);
}

.tool-card:active {
  transform: translateY(-1px) scale(.995);
}

.tool-shell {
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: none;
  transition: border-color .16s ease, background .16s ease;
}

.tool-card:hover .tool-shell {
  border-color: rgba(0, 94, 196, .25);
  background: rgba(0, 94, 196, .01);
}

.tool-icon {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 88px;
  height: 88px;
  border-radius: var(--radius);
  background: var(--venkel);
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 10px 22px rgba(0, 94, 196, .22);
  z-index: 5;
  overflow: hidden;
}

.tool-icon img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .18));
}

.tool-top-spacer {
  height: 66px;
}

.tool-bottom {
  background: var(--card-gray);
  padding: 16px 14px 18px;
  border-top: 1px solid rgba(15, 23, 42, .10);
  display: flex;
  justify-content: center;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 94, 196, .28);
  background: rgba(255, 255, 255, .66);
  color: var(--venkel);
  text-decoration: none;
  font-size: 0.8125rem;
  transition: background .16s ease, border-color .16s ease;
  outline: none;
  max-width: 100%;
  white-space: nowrap;
  text-align: center;
}

.tool-card:hover .tool-link {
  background: rgba(255, 255, 255, .82);
  border-color: rgba(0, 94, 196, .40);
}

.tool-card:focus-visible {
  outline: 2px solid var(--venkel);
  outline-offset: 2px;
}

/* Estilos del layout del carrusel */
.tools.tools--carousel {
  display: block;
}

.tools-carousel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.tools-viewport {
  overflow: hidden;
  outline: none;
  padding-top: 32px;
  width: calc((var(--toolW) * 4) + (var(--gap) * 3));
  max-width: 100%;
}

.tools-track {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
  transform: translate3d(0, 0, 0);
  will-change: transform;
}

.tools-nav {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: rgba(11, 18, 32, .55);
  cursor: pointer;
  border-radius: 999px;
  display: grid;
  place-items: center;
  transition: transform .14s ease, color .14s ease, opacity .14s ease;
}

.tools-nav:hover {
  color: var(--venkel);
  transform: scale(1.06);
}

.tools-nav:active {
  transform: scale(1.02);
}

.tools-nav:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 94, 196, .18);
  outline: none;
}

.tools-nav span {
  font-size: 1.625rem;
  line-height: 1;
  transform: translateY(-1px);
}

/* =========================
       5. COMPONENTE: FOOTER
       ========================= */
.help {
  text-align: center;
  padding-top: 10px;
  padding-bottom: 6px;
  background: #fff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .30s ease, transform .30s ease;
  transition-delay: .24s;
}

.page.ready .help {
  opacity: 1;
  transform: translateY(0);
}

.help h4 {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  color: rgba(11, 18, 32, .88);
}

.help p {
  margin: 0;
  font-size: 0.78125rem;
  line-height: 1.35;
  color: rgba(11, 18, 32, .70);
}

.help a {
  color: var(--venkel);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================
       6. COMPONENTE: TOAST
       ========================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .84);
  border: 1px solid rgba(255, 255, 255, .18);
  color: #fff;
  padding: 10px 12px;
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .22);
  font-size: 0.8125rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
  z-index: 999;
  max-width: min(92vw, 520px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* =========================
       7. MEDIA QUERIES Y ACCESIBILIDAD
       ========================= */
@media (max-width: 1100px) {
  .tools-viewport { width: calc((var(--toolW) * 3) + (var(--gap) * 2)); }
}

@media (max-width: 900px) {
  :root {
    --toolW: 230px;
  }
  .btn {
    font-size: 0.75rem;
    padding: 9px 12px;
  }
}

@media (max-width: 860px) {
  .tools-viewport { width: calc((var(--toolW) * 2) + (var(--gap) * 1)); }
}

@media (max-width: 560px) {
  .tools-viewport { width: calc((var(--toolW) * 1) + (var(--gap) * 0)); }
}

@media (max-width: 520px) {
  :root {
    --toolW: 270px;
  }
  .app {
    width: 58px;
    height: 58px;
  }
  .app img {
    width: 38px;
    height: 38px;
  }
  .tool-link {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  .header::before {
    filter: none;
    transform: none;
  }
}
