/* =========================================================
   Sistema Dental M · Login
   ========================================================= */
:root {
    --brand: #0B7FB3;
    --brand-600: #086A96;
    --brand-700: #07516F;
    --brand-050: #F1FAFD;
    --brand-100: #DFF3FB;
    --ink: #13272F;
    --ink-soft: #596B75;
    --muted: #84949D;
    --line: #E1EAEF;
    --surface: #F3F7F9;
    --white: #fff;
    --danger: #C62F3E;
    --shadow-lg: 0 32px 70px -32px rgba(7, 58, 82, .5);
    --font: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

/* Evita que estilos con display propio muestren elementos ocultos al cargar. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body.login-page {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--surface);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

.login-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    min-height: 100vh;
}

/* ---------- Panel de marca ---------- */
.login-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    padding: clamp(28px, 4.4vw, 64px) clamp(32px, 5vw, 76px);
    color: #fff;
    background:
        radial-gradient(1000px 620px at 82% -8%, rgba(76, 190, 229, .42), transparent 60%),
        radial-gradient(760px 520px at -8% 100%, rgba(10, 42, 60, .72), transparent 62%),
        linear-gradient(152deg, #052B3D 0%, #07506E 42%, #0A7BA9 78%, #1393C2 100%);
}

.login-brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 76px 76px;
    mask-image: radial-gradient(80% 70% at 55% 40%, #000 30%, transparent 100%);
    pointer-events: none;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -170px;
    bottom: -230px;
    width: 560px;
    height: 560px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, .16);
    box-shadow: 0 0 0 70px rgba(255, 255, 255, .035), 0 0 0 150px rgba(255, 255, 255, .022);
    pointer-events: none;
}

.brand-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
}

.brand-orb--one {
    width: 260px;
    height: 260px;
    right: 8%;
    top: 22%;
    background: radial-gradient(circle at 35% 35%, rgba(176, 232, 250, .3), transparent 68%);
}

.brand-orb--two {
    width: 160px;
    height: 160px;
    left: 10%;
    bottom: 14%;
    background: radial-gradient(circle at 50% 50%, rgba(144, 220, 245, .18), transparent 70%);
}

.brand-top, .brand-copy, .brand-footer { position: relative; z-index: 2; }

.brand-logo {
    width: clamp(228px, 23vw, 310px);
    height: auto;
    filter: drop-shadow(0 16px 30px rgba(0, 22, 34, .3));
}

.brand-copy { max-width: 560px; }

.brand-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(6px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: #C8EDFA;
}

.brand-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #5FD3F5;
    box-shadow: 0 0 0 4px rgba(95, 211, 245, .18);
}

.brand-copy h1 {
    margin: 24px 0 18px;
    font-size: clamp(36px, 4.2vw, 58px);
    line-height: 1.04;
    letter-spacing: -.035em;
    font-weight: 800;
}

.brand-copy h1 em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    letter-spacing: -.01em;
    color: #9FE2F8;
}

.brand-lead {
    margin: 0;
    max-width: 470px;
    font-size: 15.5px;
    line-height: 1.75;
    color: rgba(231, 247, 252, .78);
}

.brand-features {
    list-style: none;
    margin: 40px 0 0;
    padding: 0;
    display: grid;
    gap: 18px;
    max-width: 500px;
}

.brand-features li {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, .1);
    border-radius: 16px;
    background: linear-gradient(120deg, rgba(255, 255, 255, .085), rgba(255, 255, 255, .025));
    backdrop-filter: blur(8px);
}

.feature-icon {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(108, 212, 243, .16);
    border: 1px solid rgba(151, 227, 249, .24);
    color: #A9E7FA;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
}

.brand-features strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 3px;
    color: #F4FBFE;
}

.brand-features span:not(.feature-icon) {
    display: block;
    font-size: 12.5px;
    line-height: 1.55;
    color: rgba(220, 242, 249, .68);
}

.brand-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding-top: 22px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    font-size: 11.5px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(210, 238, 247, .55);
    font-weight: 600;
}

/* ---------- Panel de acceso ---------- */
.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(24px, 4vw, 56px);
    background:
        radial-gradient(800px 420px at 100% 0%, #EAF6FB 0%, transparent 55%),
        var(--surface);
}

.login-card {
    width: min(100%, 440px);
    animation: cardIn .5s cubic-bezier(.2, .8, .25, 1) both;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

.login-mobile-brand { display: none; margin-bottom: 28px; }
.login-mobile-brand img { width: 250px; }

.login-kicker {
    display: block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--brand);
    margin-bottom: 10px;
}

.login-heading h2 {
    margin: 0 0 10px;
    font-size: clamp(27px, 3vw, 33px);
    letter-spacing: -.03em;
    font-weight: 800;
    color: #10242D;
}

.login-heading p {
    margin: 0 0 26px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.65;
}

.alert {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 12px 14px;
    margin-bottom: 18px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex: 0 0 18px; margin-top: 1px; }

.alert--error {
    background: #FDF2F3;
    border-color: #F6D5D9;
    color: #9F2230;
}

.alert--info {
    background: #EFF8FC;
    border-color: #D3EBF5;
    color: #075E80;
}

.login-form { display: grid; gap: 16px; }

.field { display: grid; gap: 7px; }

.field-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #3B4D57;
}

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

.input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: #8FA1AB;
    pointer-events: none;
}

.input-wrap input {
    width: 100%;
    height: 50px;
    border: 1.5px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0 46px 0 43px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
}

.input-wrap input::placeholder { color: #A9B7BF; }

.input-wrap input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(11, 127, 179, .12);
}

.input-wrap input.is-invalid {
    border-color: #D95463;
    box-shadow: 0 0 0 4px rgba(198, 47, 62, .1);
}

.input-wrap input:disabled {
    background: #F2F6F8;
    color: #6E828C;
    border-color: #E3EBEF;
    cursor: not-allowed;
}

.input-action {
    position: absolute;
    right: 8px;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #7B8D97;
    cursor: pointer;
    transition: background .16s, color .16s;
}

.input-action:hover { background: #EEF6FA; color: var(--brand-600); }
.input-action svg { width: 19px; height: 19px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    height: 50px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .2s, background .2s;
}

.btn--primary {
    color: #fff;
    background: linear-gradient(135deg, #0E8FC6, #075B80);
    box-shadow: 0 14px 28px -14px rgba(8, 96, 134, .65);
}

.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 18px 32px -14px rgba(8, 96, 134, .75); }
.btn--primary:active { transform: translateY(0); }
.btn--block { width: 100%; margin-top: 6px; }
.btn[disabled] { opacity: .72; cursor: progress; }
.btn svg { width: 18px; height: 18px; }

.btn-spinner { display: none; animation: spin 1s linear infinite; }
.btn.is-loading .btn-spinner { display: block; }
.btn.is-loading .btn-label { opacity: .85; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Cuentas demo ---------- */
.demo-box {
    margin-top: 26px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .72);
    overflow: hidden;
}

.demo-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 15px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #445862;
    cursor: pointer;
}

.demo-toggle span { display: inline-flex; align-items: center; gap: 8px; }
.demo-toggle svg { width: 16px; height: 16px; color: var(--brand); }
.demo-toggle .chev { transition: transform .2s; }
.demo-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

.demo-list { display: none; padding: 0 8px 8px; }
.demo-list.is-open { display: grid; gap: 4px; }

.demo-list button {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 9px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background .15s;
}

.demo-list button:hover { background: #EFF8FC; }

.demo-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-size: 10.5px;
    font-weight: 800;
    color: #fff;
    background: var(--tone, #0B7FB3);
}

.demo-list strong { display: block; font-size: 12px; color: #22353E; }
.demo-list small { display: block; font-size: 10.5px; color: #80939D; margin-top: 1px; }
.demo-list em {
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    color: #4D6570;
    background: #EDF3F6;
    padding: 4px 7px;
    border-radius: 6px;
    letter-spacing: .02em;
}

.login-legal {
    margin: 24px 0 0;
    font-size: 10.5px;
    line-height: 1.65;
    color: #93A2AA;
}

.login-legal span { display: block; margin-top: 3px; color: #A9B6BD; }

/* ---------- Responsivo ---------- */
@media (max-width: 980px) {
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel {
        min-height: 100vh;
        padding: 40px 22px;
        background:
            radial-gradient(600px 320px at 50% -10%, #DDF1FA 0%, transparent 65%),
            var(--surface);
    }
    .login-mobile-brand { display: block; }
    .login-card { width: min(100%, 430px); }
}

@media (max-width: 460px) {
    .login-panel { padding: 26px 18px; }
    .input-wrap input { font-size: 16px; }
    .login-mobile-brand img { width: 215px; }
    .login-heading h2 { font-size: 26px; }
    .login-legal { font-size: 10px; }
}

/* ---------- Cuenta recordada ---------- */
.field[hidden] { display: none; }

.remembered-user {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 22px -18px rgba(7, 58, 82, .4);
}

.remembered-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: linear-gradient(135deg, #0E8FC6, #075B80);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: .02em;
}

.remembered-info { flex: 1; min-width: 0; }
.remembered-info span { display: block; font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
.remembered-info strong { display: block; margin-top: 1px; font-size: 13px; color: #1B333E; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.remembered-info small { display: block; font-size: 10.5px; color: #80939D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.remembered-change {
    flex: 0 0 auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #F8FBFC;
    padding: 7px 10px;
    font: inherit;
    font-size: 10.5px;
    font-weight: 700;
    color: #38606F;
    cursor: pointer;
    transition: background .16s, border-color .16s, color .16s;
}
.remembered-change:hover { background: #EAF6FB; border-color: #CBE8F3; color: var(--brand-700); }

@media (max-width: 460px) {
    .remembered-user { flex-wrap: wrap; }
    .remembered-change { width: 100%; }
}

.btn--outline {
    color: var(--brand-700);
    background: #fff;
    border: 1.5px solid #CFE3ED;
    box-shadow: none;
}

.btn--outline:hover {
    transform: none;
    background: #F2FAFD;
    border-color: #9DD3E8;
    box-shadow: 0 10px 22px -18px rgba(8, 96, 134, .55);
}

.login-change-btn { margin-top: 10px; }

.remembered-lock {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: #F1F6F8;
    color: #8AA0AB;
}

.remembered-lock svg { width: 16px; height: 16px; }

@media (max-width: 460px) {
    .remembered-lock { margin-left: auto; }
}

/* Enlace al portal del paciente */
.login-patient-link {
    margin: 20px 0 0;
    font-size: 11px;
    color: #70848E;
    text-align: center;
}
.login-patient-link a {
    color: var(--brand-700);
    font-weight: 800;
    text-decoration: none;
}
.login-patient-link a:hover { text-decoration: underline; }

.login-patient-link span { color: #B3C1C8; margin: 0 3px; }
