/* ════════════════════════════════════════════════════════════
   Variables — tema claro / oscuro
   ════════════════════════════════════════════════════════════ */
:root,
[data-theme="light"] {
    --left-bg-from:    #c4d4e8;
    --left-bg-to:      #b8cce0;
    --left-text:       #0a1220;
    --left-secondary:  #3a5070;
    --left-feature:    rgba(0, 0, 0, 0.16);
    --left-divider:    rgba(0, 0, 0, 0.12);
    --accent:          #1565C0;
    --platform-color:  #1565C0;

    --right-bg:        #f0f4f8;
    --form-title:      #0a1220;
    --form-subtitle:   #546478;
    --note-color:      #7a8a9a;
    --forgot-color:    #1565C0;
    --btn-bg:          #1565C0;
    --btn-hover:       #0d47a1;
    --brand-name:      #0a1220;
    --brand-tagline:   #546478;

    --field-bg:           #ffffff;
    --field-border:       #cdd8e3;
    --field-border-focus: #1565C0;
    --field-text:         #0a1220;
    --field-placeholder:  #9aa8b6;
    --field-icon:         #7a8a9a;

    /* Material Design tokens */
    --md-sys-color-primary:               #1565C0;
    --md-sys-color-on-primary:            #ffffff;
    --md-sys-color-surface-container-high: #e8eef4;
    --md-sys-color-on-surface:            #0a1220;
    --md-outlined-text-field-container-shape: 8px;
    --md-filled-button-container-shape:   50px;
    --md-filled-button-container-color:   #1565C0;
    --md-filled-button-label-text-color:  #ffffff;
    --md-filled-button-hover-container-elevation: 2;
}

[data-theme="dark"] {
    --left-bg-from:    #08111f;
    --left-bg-to:      #0d1a2e;
    --left-text:       #e0eaf6;
    --left-secondary:  #8aaac8;
    --left-feature:    rgba(255, 255, 255, 0.12);
    --left-divider:    rgba(255, 255, 255, 0.09);
    --accent:          #5b9cf6;
    --platform-color:  #5b9cf6;

    --right-bg:        #111820;
    --form-title:      #e0eaf6;
    --form-subtitle:   #7a90a8;
    --note-color:      #5a6878;
    --forgot-color:    #5b9cf6;
    --btn-bg:          #1976d2;
    --btn-hover:       #1565C0;
    --brand-name:      #e0eaf6;
    --brand-tagline:   #7a90a8;

    --field-bg:           #1a232f;
    --field-border:       #2b3a4d;
    --field-border-focus: #5b9cf6;
    --field-text:         #e0eaf6;
    --field-placeholder:  #5a6878;
    --field-icon:         #6a7d90;

    /* Material Design tokens dark */
    --md-sys-color-primary:               #5b9cf6;
    --md-sys-color-on-primary:            #002171;
    --md-sys-color-surface-container-high: #1e2a38;
    --md-sys-color-on-surface:            #e0eaf6;
    --md-outlined-text-field-container-shape: 8px;
    --md-filled-button-container-shape:   50px;
    --md-filled-button-container-color:   #1976d2;
    --md-filled-button-label-text-color:  #ffffff;
}

/* ════════════════════════════════════════════════════════════
   Reset & base
   ════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    background: var(--right-bg);
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
}

/* ════════════════════════════════════════════════════════════
   Layout principal
   ════════════════════════════════════════════════════════════ */
.login-page {
    display: flex;
    min-height: 100vh;
}

/* ── Panel izquierdo ──────────────────────────────────────── */
.left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 56px 48px;
    background: linear-gradient(155deg, var(--left-bg-from) 0%, var(--left-bg-to) 100%);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.left-panel::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(91, 156, 246, 0.14) 0%, transparent 70%);
    pointer-events: none;
}

/* Brand */
.left-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.30);
    padding: 4px;
}

[data-theme="dark"] .brand-logo {
    filter: brightness(0) invert(1);
    background: rgba(255, 255, 255, 0.08);
}

.brand-info {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.brand-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--brand-name);
    letter-spacing: -0.2px;
}

.brand-tagline {
    font-size: 12px;
    color: var(--brand-tagline);
    font-weight: 400;
}

/* Hero */
.left-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 0 24px;
}

.platform-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--platform-color);
    margin-bottom: 20px;
}

.hero-heading {
    font-size: clamp(34px, 4vw, 54px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -1.5px;
    color: var(--left-text);
    margin-bottom: 20px;
}

.hero-heading .accent {
    color: var(--accent);
}

.hero-desc {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.65;
    color: var(--left-secondary);
    max-width: 420px;
}

/* Features */
.left-features {
    display: flex;
    border-top: 1px solid var(--left-divider);
    padding-top: 24px;
}

.feature-item {
    flex: 1;
    padding-right: 24px;
    border-right: 1px solid var(--left-feature);
    margin-right: 24px;
}

.feature-item:last-child {
    border-right: none;
    margin-right: 0;
    padding-right: 0;
}

.feature-item strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--left-text);
    margin-bottom: 3px;
    letter-spacing: -0.2px;
}

.feature-item span {
    font-size: 12.5px;
    color: var(--left-secondary);
    line-height: 1.4;
}

/* ── Panel derecho ────────────────────────────────────────── */
.right-panel {
    width: 440px;
    min-width: 360px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--right-bg);
    position: relative;
    padding: 48px 44px;
    transition: background 0.3s;
}

/* Botón toggle de tema */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.06);
    color: var(--form-subtitle);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}

[data-theme="dark"] .theme-toggle {
    background: rgba(255, 255, 255, 0.08);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* ════════════════════════════════════════════════════════════
   Formulario
   ════════════════════════════════════════════════════════════ */
.form-card {
    width: 100%;
    max-width: 320px;
    animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.form-header {
    margin-bottom: 28px;
}

.form-title {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: var(--form-title);
    margin-bottom: 6px;
}

.form-subtitle {
    font-size: 13.5px;
    color: var(--form-subtitle);
    line-height: 1.5;
}

/* Campos Material Design */
.login-field {
    display: block;
    margin-bottom: 16px;
}

.login-field.w-100 {
    width: 100%;
}

/* ── Campos nativos (sin dependencia de Material Web / CDN) ──── */
.field {
    margin-bottom: 16px;
}

.field-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--form-subtitle);
    margin-bottom: 6px;
}

.field-control {
    position: relative;
    display: flex;
    align-items: center;
}

.field-icon {
    position: absolute;
    left: 12px;
    display: flex;
    color: var(--field-icon);
    pointer-events: none;
}

.field-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 40px;
    border: 1.5px solid var(--field-border);
    border-radius: 8px;
    background: var(--field-bg);
    color: var(--field-text);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.2;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input.has-trailing {
    padding-right: 44px;
}

.field-input::placeholder {
    color: var(--field-placeholder);
}

.field-input:focus {
    border-color: var(--field-border-focus);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

[data-theme="dark"] .field-input:focus {
    box-shadow: 0 0 0 3px rgba(91, 156, 246, 0.18);
}

.field-toggle {
    position: absolute;
    right: 6px;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--field-icon);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 0;
    transition: background 0.15s, color 0.15s;
}

.field-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--form-title);
}

[data-theme="dark"] .field-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Botón primario nativo */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    border-radius: 50px;
    background: var(--btn-bg);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s, opacity 0.2s;
}

.btn-primary:hover {
    background: var(--btn-hover);
}

.btn-primary:active {
    transform: scale(0.99);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: default;
}

.btn-spin {
    animation: btnspin 0.8s linear infinite;
}

@keyframes btnspin {
    to { transform: rotate(360deg); }
}

/* Nota de seguridad */
.security-note {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--note-color);
    margin: 0 0 18px;
}

/* Botón submit */
.login-submit-btn {
    width: 100%;
    height: 46px;
    margin-bottom: 18px;
    font-size: 15px;
    font-weight: 600;
}

/* Olvidé contraseña */
.forgot-link {
    display: block;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--forgot-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

.forgot-link:hover {
    opacity: 0.7;
    text-decoration: underline;
}

/* ════════════════════════════════════════════════════════════
   Responsive
   ════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
    .left-panel { padding: 32px 36px 40px; }
    .hero-heading { font-size: 34px; }
}

@media (max-width: 640px) {
    .login-page { flex-direction: column; }

    .left-panel {
        flex: none;
        padding: 28px 24px 32px;
    }

    .left-hero { padding: 24px 0 16px; }

    .right-panel {
        width: 100%;
        min-width: 0;
        padding: 44px 24px 48px;
        align-items: flex-start;
    }

    .form-card { max-width: 100%; }

    .theme-toggle { top: 14px; right: 14px; }
}
