﻿/* ============================================================
   LABURAPP — Login Page
   Fonts: Sora (headings) · Inter (body)
   ============================================================ */

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

:root {
    --lb-blue:       #0047A1;
    --lb-orange:     #FF5A00;
    --lb-dark:       #0D0D0D;
    --lb-gray-dark:  #333333;
    --lb-gray-mid:   #757575;
    --lb-gray-light: #E5E5E5;
    --lb-white:      #FFFFFF;
    --lb-surface:    #F7F8FA;
    --lb-border:     #DDE1E9;
    --lb-radius:     10px;
    --lb-radius-sm:  8px;
    --lb-radius-xs:  6px;
}

html, body {
    height: 100%;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--lb-white);
    color: var(--lb-dark);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   OFFLINE BAR (api.js lo inyecta en todas las páginas)
   ============================================================ */
.offline-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #dc2626;
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    text-align: center;
    padding: 7px 16px;
    transform: translateY(-100%);
    transition: transform .3s ease;
}
.offline-bar.show { transform: translateY(0); }

/* ============================================================
   LAYOUT PRINCIPAL — fondo completo, card centrada (desktop)
   ============================================================ */
.lb-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    overflow: hidden;
    background: url('/img/bg-login-desktop.png') no-repeat center center / cover;
    background-color: #eef1f7;
}

/* ============================================================
   HERO — oculto en desktop (la imagen es el fondo completo)
   ============================================================ */
.lb-hero {
    display: none;
}

.lb-hero-img { display: none; }

/* ============================================================
   FORM PANEL — card centrada
   ============================================================ */
.lb-form-panel {
    flex: 0 0 auto;
    width: 480px;
    max-width: calc(100vw - 48px);
    margin: 0;
    display: flex;
    flex-direction: column;
    background: transparent;
    overflow: visible;
    height: auto;
    max-height: 95vh;
    border-left: none;
}

/* Mobile logo — oculto en desktop */
.lb-mobile-logo {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 44px 24px 16px;
}

.lb-logo-mobile-img {
    height: 140px;
    width: auto;
    display: block;
}

/* ---- Form content ---- */
.lb-form-content {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow-y: visible;
    outline: none;
}

.lb-form-inner {
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 8px 40px rgba(0,47,161,.12), 0 2px 12px rgba(0,0,0,.08);
    overflow: visible;
    padding: 32px 36px 28px;
}

.lb-form-head {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
}
.lb-form-head h1 {
    font-family: 'Sora', sans-serif;
    font-size: 26px;
    font-weight: 800;
    color: var(--lb-dark);
    margin-bottom: 6px;
    letter-spacing: -.4px;
}
.lb-form-head p {
    font-size: 13.5px;
    color: var(--lb-gray-mid);
}

/* Logo visible en desktop */
.lb-form-logo {
    display: block;
    width: 200px;
    max-width: 100%;
    height: auto;
    margin: 0 auto 20px;
}

/* ---- Alert ---- */
.alert { display: none; }
.alert.show {
    display: block;
    padding: 12px 15px;
    border-radius: var(--lb-radius-sm);
    font-size: 13px;
    margin-bottom: 20px;
}
.alert-danger {
    background: #FEE2E2;
    border: 1px solid #FCA5A5;
    color: #B91C1C;
}

/* ---- Fields ---- */
.lb-field {
    margin-bottom: 18px;
}
.lb-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--lb-gray-dark);
    margin-bottom: 6px;
}

.lb-inp-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.lb-inp-icon {
    position: absolute;
    left: 13px;
    color: var(--lb-gray-mid);
    pointer-events: none;
    flex-shrink: 0;
    display: flex;
}
.lb-inp-icon i[data-lucide],
.lb-inp-icon svg { width: 17px; height: 17px; stroke-width: 2px; display: block; }

.lb-inp {
    width: 100%;
    height: 44px;
    border: 1.5px solid var(--lb-border);
    border-radius: var(--lb-radius-sm);
    padding: 0 14px 0 42px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: var(--lb-dark);
    background: var(--lb-surface);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.lb-inp::placeholder { color: #BBBFC9; }
.lb-inp:focus {
    border-color: var(--lb-blue);
    background: #fff;
    box-shadow: 0 0 0 3.5px rgba(0,71,161,.10);
}
.lb-inp--pass { padding-right: 46px; }

.lb-pass-btn {
    position: absolute;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lb-gray-mid);
    border-radius: var(--lb-radius-xs);
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
.lb-pass-btn:hover { color: var(--lb-blue); background: rgba(0,71,161,.07); }
.lb-pass-btn i[data-lucide],
.lb-pass-btn svg { width: 17px; height: 17px; }

/* ---- Forgot ---- */
.lb-forgot {
    text-align: right;
    margin: -4px 0 20px;
}
.lb-forgot a {
    font-size: 13px;
    color: var(--lb-blue);
    text-decoration: none;
    font-weight: 500;
}
.lb-forgot a:hover { text-decoration: underline; }

/* ---- Registro ---- */
.lb-register {
    text-align: center;
    margin-top: 18px;
    font-size: 13px;
    color: var(--lb-text-muted, #6b7280);
}
.lb-register a {
    color: var(--lb-blue);
    text-decoration: none;
    font-weight: 600;
}
.lb-register a:hover { text-decoration: underline; }

/* ---- Primary button ---- */
.lb-btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 44px;
    background: var(--lb-orange);
    color: #fff;
    border: none;
    border-radius: var(--lb-radius-sm);
    font-family: 'Sora', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .2px;
    box-shadow: 0 4px 18px rgba(255,90,0,.28);
    transition: background .18s, box-shadow .18s, transform .12s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.lb-btn-login:hover {
    background: #e04e00;
    box-shadow: 0 6px 22px rgba(255,90,0,.40);
}
.lb-btn-login:active  { transform: scale(.98); }
.lb-btn-login:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* ---- Divider ---- */
.lb-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    font-size: 12px;
    color: var(--lb-gray-mid);
    font-weight: 500;
}
.lb-divider::before,
.lb-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--lb-border);
}

/* ---- Social buttons ---- */
.lb-social {
    display: flex;
    gap: 10px;
}

.lb-social-btn {
    flex: 1;
    height: 40px;
    border: 1.5px solid var(--lb-border);
    border-radius: var(--lb-radius-sm);
    background: var(--lb-white);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--lb-gray-dark);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: border-color .15s, background .15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.lb-social-btn:hover { border-color: #aaa; background: #F9FAFB; }
.lb-social-btn:disabled { opacity: .45; cursor: default; }

/* ---- Shake ---- */
@keyframes lb-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-7px); }
    40%       { transform: translateX(7px); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}
.lb-shake { animation: lb-shake .42s ease; }

/* ============================================================
   DARK BAR — registro (solo mobile)
   ============================================================ */
.lb-reg-bar {
    display: none;
    background: var(--lb-dark);
    padding: 16px 52px;
    flex-shrink: 0;
}

/* ============================================================
   REGISTER SECTION — dentro de la card (desktop)
   ============================================================ */
.lb-reg-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--lb-border);
    text-align: center;
    padding-bottom: 4px;
}

.lb-reg-section__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--lb-gray-mid);
    margin-bottom: 12px;
}

.lb-reg-section__btns {
    display: flex;
    gap: 10px;
}

.lb-reg-bar__title {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,.55);
    margin-bottom: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.lb-reg-bar__btns {
    display: flex;
    gap: 10px;
}

.lb-btn-reg {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    border: 1.5px solid rgba(255,90,0,.6);
    border-radius: var(--lb-radius-sm);
    color: var(--lb-orange);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    background: rgba(255,90,0,.06);
    font-family: 'Inter', sans-serif;
    transition: background .18s, color .18s, border-color .18s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.lb-btn-reg:hover { background: var(--lb-orange); color: #fff; border-color: var(--lb-orange); }
.lb-btn-reg i[data-lucide],
.lb-btn-reg svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ============================================================
   RESPONSIVE — Desktop pantalla corta (laptops, bajo 860px alto)
   ============================================================ */
@media (min-width: 901px) and (max-height: 860px) {
    .lb-form-panel    { max-height: 98vh; overflow-y: auto; }
    .lb-form-logo     { width: 180px; margin-bottom: 8px; }
    .lb-form-head     { margin-bottom: 14px; }
    .lb-form-head h1  { font-size: 20px; }
    .lb-field         { margin-bottom: 12px; }
    .lb-forgot        { margin: -4px 0 10px; }
    .lb-divider       { margin: 10px 0; }
    .lb-reg-section   { margin-top: 14px; padding-top: 14px; }
    .lb-btn-reg       { height: 36px; }
}

/* ============================================================
   RESPONSIVE — Mobile ≤ 900px
   ============================================================ */
@media (max-width: 900px) {
    html { background: #0D0D0D; overflow: hidden; }
    body {
        background: #0D0D0D;
        position: fixed;      /* iOS Safari: previene scroll de página */
        width: 100%;
        height: 100%;
        overflow: hidden;
        overscroll-behavior: none;
    }

    .lb-wrap {
        background: url('/img/fondomobile.png') no-repeat center top / cover;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        height: 100vh;
        height: 100dvh;
        height: var(--app-height, 100dvh);
        min-height: -webkit-fill-available;
        overflow: hidden;
    }

    .lb-hero { display: none; }

    .lb-form-panel {
        width: 100%;
        max-width: 100%;
        flex: 1;
        min-height: 0;
        max-height: none;
        background: transparent;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .lb-mobile-logo { display: none; }

    .lb-form-content {
        padding: 0;
        background: transparent;
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        overflow: hidden;
    }

    .lb-form-inner {
        flex: 0 0 auto;
        width: 100%;
        margin: 0;
        background: rgba(255,255,255,0.97);
        border-radius: 22px 22px 0 0;
        box-shadow: 0 -4px 20px rgba(0,0,0,.12);
        overflow: hidden;          /* sin scroll interno — el contenido debe caber */
        padding: 14px 20px 10px;
    }

    /* Logo compacto en mobile */
    .lb-form-logo {
        display: block;
        height: 38px;
        width: auto;
        max-width: 60%;
        margin: 0 auto 8px;
    }

    /* Registro: ocultar sección dentro de la card, mostrar dark bar */
    .lb-reg-section { display: none; }
    .lb-reg-bar { display: block; }

    .lb-form-head {
        text-align: center;
        margin-top: 0;
        margin-bottom: 12px;
    }
    .lb-form-head h1 {
        font-size: 20px;
        font-weight: 800;
        color: var(--lb-dark);
        margin-bottom: 2px;
    }
    .lb-form-head p {
        font-size: 12px;
        color: var(--lb-gray-mid);
    }

    .lb-field { margin-bottom: 8px; }
    .lb-field label {
        font-size: 11.5px;
        margin-bottom: 4px;
        color: var(--lb-gray-dark);
    }

    /* font-size:16px evita zoom automático en iOS */
    .lb-inp {
        height: 44px;
        font-size: 16px;
        background: var(--lb-surface);
        border-color: var(--lb-border);
        -webkit-appearance: none;
    }
    .lb-inp:focus {
        background: #fff;
        border-color: var(--lb-blue);
        box-shadow: 0 0 0 3px rgba(0,71,161,.10);
    }

    .lb-forgot { margin: -3px 0 8px; }
    .lb-forgot a { font-size: 12px; color: var(--lb-blue); }

    .lb-btn-login {
        height: 46px;
        font-size: 15px;
        touch-action: manipulation;
    }

    .lb-divider { margin: 8px 0 8px; font-size: 11px; color: var(--lb-gray-mid); }
    .lb-divider::before,
    .lb-divider::after { background: var(--lb-border); }

    .lb-social { gap: 8px; }
    .lb-social-btn {
        background: var(--lb-white);
        border-color: var(--lb-border);
        height: 44px;
        font-size: 13px;
        font-weight: 600;
        gap: 8px;
        touch-action: manipulation;
        -webkit-appearance: none;
        color: var(--lb-gray-dark);
    }
    .lb-social-btn:active { transform: scale(.97); }

    /* Dark bar: footer compacto */
    .lb-reg-bar {
        flex-shrink: 0;
        margin: 0;
        border-radius: 0;
        padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    }

    .lb-reg-bar__title {
        text-align: center;
        color: rgba(255,255,255,.70);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: .4px;
        margin-bottom: 8px;
    }
    .lb-reg-bar__btns { flex-direction: row; gap: 8px; }
    .lb-btn-reg {
        height: 44px;
        padding: 0 12px;
        font-size: 13px;
        border-radius: 8px;
        border-width: 1.5px;
        gap: 6px;
        touch-action: manipulation;
    }
    .lb-btn-reg:active { transform: scale(.98); }
}

@media (max-width: 390px) {
    /* iPhone SE y pantallas muy estrechas: aún más compacto */
    .lb-form-inner { padding: 14px 18px 10px; }
    .lb-form-logo { height: 32px; margin-bottom: 6px; }
    .lb-form-head { margin-bottom: 10px; }
    .lb-form-head h1 { font-size: 18px; }
    .lb-field { margin-bottom: 7px; }
    .lb-inp { height: 44px; }
    .lb-forgot { margin: -2px 0 8px; }
    .lb-btn-login { height: 46px; font-size: 14px; }
    .lb-divider { margin: 8px 0 8px; }
    .lb-social-btn { height: 44px; }
    .lb-reg-bar { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
    .lb-btn-reg { height: 40px; font-size: 12px; }
}

/* ============================================================
   MODAL — Selección de rol para nuevos usuarios de Google
   ============================================================ */
.lb-gmodal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lb-gmodal-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 28px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.lb-gmodal-avatar img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    margin-bottom: 12px;
    border: 3px solid var(--lb-blue);
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.lb-gmodal-title {
    font-family: 'Sora', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--lb-dark);
    margin-bottom: 4px;
}

.lb-gmodal-sub {
    font-size: 14px;
    color: var(--lb-gray-mid);
    margin-bottom: 6px;
}

.lb-gmodal-desc {
    font-size: 14px;
    font-weight: 600;
    color: var(--lb-gray-dark);
    margin: 16px 0 20px;
}

.lb-gmodal-btns {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lb-btn-reg--gmodal {
    height: 50px;
    font-size: 15px;
    border-radius: 10px;
    border-width: 2px;
    touch-action: manipulation;
}

@media (max-width: 480px) {
    .lb-gmodal-overlay { padding: 16px; align-items: flex-end; }
    .lb-gmodal-box {
        border-radius: 20px 20px 16px 16px;
        padding: 24px 20px calc(20px + env(safe-area-inset-bottom));
    }
    .lb-gmodal-avatar img { width: 60px; height: 60px; }
    .lb-gmodal-title { font-size: 20px; }
    .lb-gmodal-desc { margin: 12px 0 16px; }
    .lb-btn-reg--gmodal { height: 50px; }
}

