/* =========================================================
   Sarao Portal — portal.css
   Sistema de diseño idéntico a saraocomunicacion.es
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Poppins:wght@600;700;800&display=swap');

:root {
    --green:       #4A9B7F;
    --green-dark:  #357a62;
    --green-soft:  #e8f4ef;
    --ink:         #242038;
    --ink-soft:    #322c4d;
    --accent:      #FC9F5B;
    --accent-dark: #f0863a;
    --muted:       #6b6b78;
    --text:        #2b2b33;
    --bg:          #ffffff;
    --surface:     #f6f8f7;
    --surface-2:   #eef3f1;
    --line:        #e4e8e6;

    --radius-sm: 10px;
    --radius:    18px;
    --radius-lg: 28px;
    --radius-xl: 40px;

    --shadow-sm: 0 2px 8px rgba(36,32,56,.06);
    --shadow:    0 14px 40px rgba(36,32,56,.10);
    --shadow-lg: 0 30px 70px rgba(36,32,56,.16);

    --font-head: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --ease: cubic-bezier(.22,1,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: var(--green-dark); text-decoration: none; transition: color .2s var(--ease); }
a:hover { color: var(--accent-dark); }
h1,h2,h3,h4 { font-family: var(--font-head); color: var(--ink); line-height: 1.12; margin: 0 0 .4em; font-weight: 700; }
p { margin: 0 0 1em; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---- FONDO AUTH ---- */
.auth-bg {
    min-height: 100vh;
    background: linear-gradient(160deg, var(--green-soft) 0%, #fff 55%, var(--surface) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    position: relative;
    overflow: hidden;
}
.auth-bg::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74,155,127,.18) 0%, transparent 70%);
    top: -180px; right: -160px;
    pointer-events: none;
}
.auth-bg::after {
    content: '';
    position: absolute;
    width: 380px; height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(252,159,91,.14) 0%, transparent 70%);
    bottom: -120px; left: -100px;
    pointer-events: none;
}

/* ---- TARJETA AUTH ---- */
.auth-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    padding: 2.8rem 2.4rem 2.4rem;
    animation: card-rise .7s var(--ease) both;
}
@keyframes card-rise {
    from { opacity: 0; transform: translateY(32px); }
    to   { opacity: 1; transform: none; }
}

.auth-logo {
    display: block;
    height: 52px;
    width: auto;
    margin: 0 auto 1.8rem;
}

.auth-card__eyebrow {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--green);
    text-align: center;
    margin: 0 0 .5rem;
}
.auth-card__title {
    font-size: 1.6rem;
    font-weight: 800;
    text-align: center;
    margin: 0 0 .35rem;
    color: var(--ink);
}
.auth-card__subtitle {
    color: var(--muted);
    font-size: .95rem;
    text-align: center;
    margin: 0 0 2rem;
}

/* ---- FORMULARIO ---- */
.form-row { margin-bottom: 1.1rem; }
.form-label {
    display: block;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .9rem;
    color: var(--ink);
    margin-bottom: .4rem;
}
.form-input {
    width: 100%;
    font: inherit;
    font-size: .97rem;
    color: var(--text);
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.form-input:focus {
    outline: none;
    border-color: var(--green);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(74,155,127,.14);
}
.form-input--otp {
    text-align: center;
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: .25em;
    padding: .9rem;
}

/* ---- INPUT CON ICONO ---- */
.input-wrap { position: relative; }
.input-wrap .input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    width: 18px;
    height: 18px;
    pointer-events: none;
}
.input-wrap .form-input { padding-left: 2.6rem; }

/* ---- BOTÓN ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    padding: .85rem 1.6rem;
    border-radius: 999px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
    line-height: 1;
    position: relative;
    overflow: hidden;
    width: 100%;
    margin-top: .6rem;
}
.btn::before {
    content: '';
    position: absolute;
    top: 0; left: -120%;
    width: 70%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
    transform: skewX(-18deg);
    transition: left .6s var(--ease);
    pointer-events: none;
}
.btn:hover::before { left: 130%; }
.btn:hover { transform: translateY(-2px); }

.btn--primary {
    background: var(--green);
    color: #fff;
    box-shadow: 0 8px 22px rgba(74,155,127,.32);
}
.btn--primary:hover { background: var(--green-dark); color: #fff; }

/* ---- ALERTAS ---- */
.alert {
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    font-size: .9rem;
    font-weight: 500;
    margin: 0 0 1.2rem;
    display: flex;
    align-items: flex-start;
    gap: .6rem;
}
.alert svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 1px; }
.alert--error { background: #fdece4; color: #b4471c; border: 1px solid #f6c9b1; }
.alert--success { background: var(--green-soft); color: var(--green-dark); border: 1px solid #bfe3d6; }
.alert--info { background: #eff4fe; color: #2952b3; border: 1px solid #c5d7fc; }

/* ---- SEPARADOR ---- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--muted);
    font-size: .85rem;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* ---- SEGURIDAD BADGE ---- */
.security-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    color: var(--muted);
    font-size: .78rem;
    margin-top: 1.6rem;
}
.security-badge svg { width: 14px; height: 14px; color: var(--green); }

/* ---- OTP RESEND ---- */
.otp-resend {
    text-align: center;
    margin-top: 1.4rem;
    font-size: .88rem;
    color: var(--muted);
}
.otp-resend a { color: var(--green-dark); font-weight: 600; }
.otp-resend a:hover { color: var(--accent-dark); }

.otp-timer {
    display: block;
    text-align: center;
    font-size: .82rem;
    color: var(--muted);
    margin-top: .5rem;
}

/* =========================================================
   PORTAL — DASHBOARD
   ========================================================= */

/* ---- CABECERA PORTAL ---- */
.portal-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255,255,255,.88);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}
.portal-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    min-height: 70px;
}
.portal-header__brand {
    display: flex;
    align-items: center;
    gap: .9rem;
    text-decoration: none;
}
.portal-header__logo { height: 40px; width: auto; }
.portal-header__label {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .85rem;
    color: var(--muted);
    padding: .25rem .65rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.portal-header__user {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.portal-header__username {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .9rem;
    color: var(--muted);
}
.portal-header__logout {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .85rem;
    color: var(--ink);
    padding: .45rem .9rem;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.portal-header__logout:hover {
    border-color: var(--green);
    color: var(--green-dark);
    background: var(--green-soft);
}
.portal-header__logout svg { width: 15px; height: 15px; }

/* ---- LAYOUT PRINCIPAL ---- */
.portal-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

/* ---- HERO DASHBOARD ---- */
.portal-hero {
    margin-bottom: 3rem;
}
.portal-hero__eyebrow {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--green);
    margin: 0 0 .5rem;
}
.portal-hero__title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    margin: 0 0 .5rem;
    color: var(--ink);
}
.portal-hero__title span {
    background: linear-gradient(100deg, var(--green) 0%, #6fc6a4 50%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.portal-hero__lead {
    color: var(--muted);
    font-size: 1.05rem;
    margin: 0;
}

/* ---- SECCIÓN HERRAMIENTAS ---- */
.tools-section { margin-bottom: 3.5rem; }
.tools-section__header {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-bottom: 1.4rem;
    padding-bottom: .9rem;
    border-bottom: 1px solid var(--line);
}
.tools-section__icon {
    width: 38px; height: 38px;
    background: var(--green-soft);
    color: var(--green-dark);
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.tools-section__icon svg { width: 20px; height: 20px; }
.tools-section__title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0;
}

/* ---- GRID HERRAMIENTAS ---- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.2rem;
}

/* ---- TARJETA HERRAMIENTA ---- */
.tool-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.6rem 1.4rem;
    transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}
.tool-card::after {
    content: '';
    position: absolute;
    left: 0; top: 0;
    height: 4px; width: 0;
    background: linear-gradient(90deg, var(--green), var(--accent));
    transition: width .4s var(--ease);
}
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: transparent; }
.tool-card:hover::after { width: 100%; }
.tool-card:hover { color: inherit; }

.tool-card--soon { opacity: .65; cursor: default; pointer-events: none; }

.tool-card__icon {
    width: 46px; height: 46px;
    border-radius: 14px;
    background: var(--green-soft);
    color: var(--green-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform .35s var(--ease), background .35s var(--ease), color .35s var(--ease);
}
.tool-card__icon svg { width: 24px; height: 24px; }
.tool-card:hover .tool-card__icon {
    transform: translateY(-3px) rotate(-5deg);
    background: var(--green);
    color: #fff;
}

.tool-card__badge {
    position: absolute;
    top: 1rem; right: 1rem;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: .68rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    padding: .2rem .55rem;
    border-radius: 999px;
    background: var(--accent);
    color: #3a2410;
}
.tool-card__badge--soon {
    background: var(--surface-2);
    color: var(--muted);
}

.tool-card__title {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 .4rem;
}
.tool-card__desc {
    color: var(--muted);
    font-size: .9rem;
    margin: 0;
    line-height: 1.5;
}

/* ---- ESTADÍSTICAS RÁPIDAS ---- */
.portal-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}
.portal-stat {
    background: linear-gradient(135deg, var(--ink) 0%, var(--ink-soft) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 1.4rem 1.6rem;
    box-shadow: var(--shadow);
}
.portal-stat__num {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 2rem;
    color: var(--accent);
    line-height: 1;
    margin-bottom: .25rem;
}
.portal-stat__label {
    color: rgba(255,255,255,.75);
    font-size: .88rem;
}

/* ---- PIE ---- */
.portal-footer {
    background: var(--ink);
    color: rgba(255,255,255,.6);
    text-align: center;
    padding: 1.2rem;
    font-size: .82rem;
}
.portal-footer a { color: var(--accent); }

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
    .auth-card { padding: 2rem 1.4rem 1.6rem; }
    .portal-main { padding: 2rem 1rem 4rem; }
    .portal-header__inner { padding: 0 1rem; }
    .portal-header__username { display: none; }
    .tools-grid { grid-template-columns: 1fr; }
}
