/* ============================================
   LOGIN PAGE - Corporate Split-Panel Design
   Aesthetic: Enterprise CRM — Clean & Trustworthy
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --navy-900:   #0f1f3d;
    --navy-800:   #162848;
    --navy-700:   #1e3660;
    --navy-600:   #264573;
    --navy-500:   #2e5487;
    --blue-400:   #3d7cc9;
    --blue-300:   #5a96db;
    --accent:     #d4a853;
    --accent-lt:  #f0d090;
    --bg-page:    #f0f3f8;
    --bg-form:    #ffffff;
    --border:     #dde3ed;
    --text-900:   #0f1f3d;
    --text-600:   #4a5a78;
    --text-400:   #8595b0;
    --green:      #10b981;
    --red:        #ef4444;
    --shadow-sm:  0 1px 3px rgba(15,31,61,.08);
    --shadow-md:  0 4px 16px rgba(15,31,61,.10);
    --shadow-lg:  0 12px 40px rgba(15,31,61,.14);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    height: 100%;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
    background: var(--bg-page);
    overflow: hidden;
}

/* ─────────────────────────────────────
   WRAPPER — two-column split
───────────────────────────────────── */
.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    animation: pageReveal .6s ease-out;
}

@keyframes pageReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────────────
   LEFT — Brand Panel
───────────────────────────────────── */
.brand-panel {
    flex: 0 0 42%;
    background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--navy-600) 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 52px 48px;
    position: relative;
    overflow: hidden;
}

/* Geometric backdrop accents */
.brand-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 55% at 110% 10%, rgba(212,168,83,.18) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at -10% 90%, rgba(61,124,201,.25) 0%, transparent 55%);
    pointer-events: none;
}

/* Fine grid overlay */
.brand-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 44px 44px;
    pointer-events: none;
}

.brand-top {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.brand-logo-wrap {
    margin-bottom: 40px;
}

.brand-logo-wrap img {
    max-height: 44px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: .92;
}

.brand-headline {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.22;
    letter-spacing: -.02em;
    margin-bottom: 16px;
}

.brand-headline em {
    font-style: normal;
    color: var(--accent-lt);
}

.brand-desc {
    font-size: .95rem;
    color: rgba(255,255,255,.62);
    line-height: 1.65;
    max-width: 300px;
    margin: 0 auto;
}

/* Feature pills */
.brand-features {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 52px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.feature-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-lt);
}

.feature-icon svg { width: 18px; height: 18px; }

.feature-text {
    font-size: .875rem;
    color: rgba(255,255,255,.75);
    font-weight: 400;
    line-height: 1.4;
}

/* Bottom brand footer */
.brand-bottom {
    position: relative;
    z-index: 2;
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.brand-bottom-text {
    font-size: .75rem;
    color: rgba(255,255,255,.38);
    letter-spacing: .02em;
}

/* Accent bar separating panels */
.panel-accent {
    flex: 0 0 4px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--blue-400) 100%);
}

/* ─────────────────────────────────────
   RIGHT — Form Panel
───────────────────────────────────── */
.form-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-form);
    padding: 48px 32px;
    overflow-y: auto;
}

.login-card {
    width: 100%;
    max-width: 420px;
    min-width: 0;
    overflow: hidden;
}

/* Logo for mobile (hidden on desktop) */
.mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 32px;
}

.mobile-logo img {
    max-height: 40px;
}

/* Section header */
.welcome-text {
    margin-bottom: 36px;
}

.welcome-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-900);
    letter-spacing: -.025em;
    margin-bottom: 6px;
}

.welcome-subtitle {
    font-size: .9rem;
    color: var(--text-400);
    font-weight: 400;
}

/* ─── Alerts ─── */
.alert-container { margin-bottom: 24px; }

.alert-custom {
    background: #fef9c3;
    border: 1px solid #fbbf24;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-900);
    animation: slideIn .3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.alert-close {
    background: none;
    border: none;
    color: var(--text-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .2s;
}
.alert-close:hover { color: var(--text-900); }

/* ─── Form ─── */
.form-signin {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
    width: 100%;
    min-width: 0;
}

.input-label {
    display: block;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-600);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 7px;
}

.input-field {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: 13px 16px;
    font-size: .95rem;
    font-family: inherit;
    color: var(--text-900);
    background: var(--bg-page);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.input-field::placeholder { color: var(--text-400); }

.input-field:hover {
    border-color: #b0bdd4;
    background: #fff;
}

.input-field:focus {
    border-color: var(--navy-500);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(46,84,135,.12);
}

/* Password toggle */
.password-wrapper {
    position: relative;
    display: block;
    width: 100%;
}
.password-wrapper .input-field { padding-right: 46px; }

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-400);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    transition: color .2s;
}
.password-toggle:hover { color: var(--text-600); }

/* Options row */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    appearance: none;
    cursor: pointer;
    transition: all .2s;
    position: relative;
    flex-shrink: 0;
}
.checkbox-custom:checked {
    background: var(--navy-600);
    border-color: var(--navy-600);
}
.checkbox-custom:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    font-size: .875rem;
    color: var(--text-600);
    user-select: none;
}

.forgot-link {
    font-size: .875rem;
    color: var(--navy-500);
    text-decoration: none;
    font-weight: 500;
    transition: color .2s;
}
.forgot-link:hover { color: var(--navy-700); text-decoration: underline; }

/* Submit button */
.btn-submit {
    width: 100%;
    padding: 14px 24px;
    font-size: .975rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--navy-600) 0%, var(--navy-800) 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform .2s, box-shadow .2s, background .2s;
    box-shadow: 0 4px 14px rgba(15,31,61,.22);
    position: relative;
    overflow: hidden;
    letter-spacing: .01em;
}

.btn-submit::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: background .2s;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15,31,61,.28);
}
.btn-submit:hover::after { background: rgba(255,255,255,.06); }
.btn-submit:active { transform: translateY(0); }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 28px 0;
    gap: 12px;
}
.divider-line { flex: 1; height: 1px; background: var(--border); }
.divider-text {
    font-size: .75rem;
    color: var(--text-400);
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 500;
}

/* Social buttons */
.social-buttons { display: flex; flex-direction: column; gap: 10px; }

.btn-social {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: .9rem;
    font-weight: 500;
    font-family: inherit;
    text-decoration: none;
    border-radius: 10px;
    transition: all .2s;
}

.btn-google {
    background: #fff;
    color: var(--text-900);
    border: 1.5px solid var(--border);
}
.btn-google:hover {
    background: var(--bg-page);
    border-color: #b0bdd4;
    box-shadow: var(--shadow-sm);
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .75rem;
    color: var(--text-400);
}
.security-badge svg { width: 14px; height: 14px; color: var(--green); }

/* Button loading state */
.btn-submit.loading { pointer-events: none; opacity: .75; }
.btn-submit.loading::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────
   Decorative elements (unused on new layout)
───────────────────────────────────── */
.decoration { display: none; }

/* ─────────────────────────────────────
   CENTERED variant — for 2FA, recordar, etc.
───────────────────────────────────── */
.login-container.centered {
    justify-content: center;
    align-items: center;
    background: var(--bg-page);
    padding: 32px 20px;
    min-height: 100vh;
}

.login-container.centered .login-card {
    background: var(--bg-form);
    border-radius: 16px;
    padding: 44px 40px;
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    overflow: hidden;
}

.logo-section {
    text-align: center;
    margin-bottom: 28px;
}

.logo-main {
    max-height: 42px;
    width: auto;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.1));
}

/* ─────────────────────────────────────
   RESPONSIVE
───────────────────────────────────── */
@media (max-width: 820px) {
    .brand-panel, .panel-accent { display: none; }

    .form-panel {
        padding: 48px 24px;
        background: var(--bg-page);
    }

    .login-card {
        background: #fff;
        border-radius: 16px;
        padding: 40px 28px;
        box-shadow: var(--shadow-lg);
        max-width: 440px;
    }

    .mobile-logo { display: block; }
}

@media (max-width: 420px) {
    .login-card { padding: 32px 20px; }
    .welcome-title { font-size: 1.4rem; }
    .form-options { flex-direction: column; align-items: flex-start; }
}

/* Recovery / other auth pages */
.page-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}
.page-icon svg { color: var(--navy-500); }

.back-link {
    text-align: center;
    margin-top: 24px;
}
.back-link .forgot-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}