/* ==========================================================================
   LOGIN PAGE - Two-Column Split Layout
   Left: dark brand panel | Right: light form panel
   Replaces: .login-card, .login-header, .login-body sections
   Keep everything above .login-card and below unchanged.
   ========================================================================== */

/* Page container with dark gradient background */
.login-container {
    background: linear-gradient(135deg, 
        #0a2540 0%,
        #0f3d5c 25%,
        #1a5a8e 50%,
        #2d7aaf 75%,
        #408fc4 100%);
    padding: 2rem 0; /* Reduced from 3rem */
    min-height: calc(100vh - 66px); /* Reduced from 76px to account for smaller navbar */
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Animated background particles - keep the same for visual appeal */
.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(45, 122, 175, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(64, 143, 196, 0.08) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

/* Glowing orbs - slightly reduced */
.login-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; /* Reduced from 600px */
    height: 500px; /* Reduced from 600px */
    background: radial-gradient(circle,
        rgba(45, 122, 175, 0.15) 0%,
        rgba(87, 169, 216, 0.08) 30%,
        transparent 70%);
    pointer-events: none;
    opacity: 0.7; /* Slightly reduced */
    z-index: 0;
    animation: pulse-glow 8s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); } /* Reduced from -20px */
}

@keyframes pulse-glow {
    0%, 100% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.7; /* Reduced from 0.8 */
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.08); /* Reduced from 1.1 */
        opacity: 0.5; /* Reduced from 0.6 */
    }
}

/* ── CARD — wider, shorter, two columns ── */
.login-card {
    background: transparent;
    backdrop-filter: none;
    border-radius: 20px;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.55),
        0 0 80px rgba(45, 122, 175, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    overflow: hidden;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 1;
    display: flex;          /* two columns */
    min-height: 540px;
}

/* Top accent line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        rgba(26, 90, 142, 0) 0%,
        rgba(45, 122, 175, 0.9) 50%,
        rgba(87, 169, 216, 0) 100%);
    box-shadow: 0 0 24px rgba(45, 122, 175, 0.7);
    z-index: 10;
}

/* ════════════════════════════════════════════
   LEFT PANEL — dark brand, 40% width
   ════════════════════════════════════════════ */
.login-panel-left {
    flex: 0 0 42%;
    background: linear-gradient(160deg,
        #071828 0%,
        #0a2540 35%,
        #0f3d5c 65%,
        #1a5a8e 100%);
    padding: 3rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Texture overlay */
.login-panel-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(45, 122, 175, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(87, 169, 216, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Subtle scan lines */
.login-panel-left::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(255, 255, 255, 0.012) 3px,
        rgba(255, 255, 255, 0.012) 4px
    );
    pointer-events: none;
    opacity: 0.6;
}

.login-brand {
    position: relative;
    z-index: 1;
}

.login-brand .logo {
    width: 62px;
    height: auto;
    margin-bottom: 1.5rem;
    display: block;
    filter: drop-shadow(0 0 12px rgba(87, 169, 216, 0.4));
    transition: filter 0.3s ease;
}

.login-brand .logo:hover {
    filter: drop-shadow(0 0 18px rgba(87, 169, 216, 0.7));
    transform: scale(1.04);
}

.login-brand-name {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #fff 0%, #a8d4ed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 0.2rem 0;
    line-height: 1;
}

.login-brand-tagline {
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(87, 169, 216, 0.8);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 1.5rem 0;
}

.login-brand-description {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.65;
    margin: 0;
    max-width: 240px;
}

/* Security badges at bottom of left panel */
.login-trust-badges {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.login-trust-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.login-trust-badge i {
    width: 28px;
    height: 28px;
    background: rgba(45, 122, 175, 0.2);
    border: 1px solid rgba(45, 122, 175, 0.3);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: rgba(87, 169, 216, 0.85);
    flex-shrink: 0;
}

/* ════════════════════════════════════════════
   RIGHT PANEL — light form, 60% width
   ════════════════════════════════════════════ */
.login-panel-right {
    flex: 1;
    background: #f8fafc;
    padding: 3rem 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

/* Subtle top-left corner accent connecting to left panel */
.login-panel-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        rgba(45, 122, 175, 0.4) 0%,
        rgba(45, 122, 175, 0.1) 50%,
        transparent 100%);
}

.login-form-header {
    margin-bottom: 2rem;
}

.login-form-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0a1929;
    margin: 0 0 0.3rem 0;
    letter-spacing: -0.01em;
}

.login-form-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
    font-weight: 400;
}

/* ── MAGI FIELDS — light theme variant ── */
.login-magi-field {
    position: relative;
    margin-bottom: 1.25rem;
}

.login-magi-field > .login-magi-input {
    display: block;
    width: 100%;
    height: 50px;
    padding: 16px 3rem 5px 2.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.25;
    color: #111827;
    background: #fff;
    background-image: none;
    border: 1.5px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    outline: none;
}

.login-magi-field > .login-magi-input:-webkit-autofill,
.login-magi-field > .login-magi-input:-webkit-autofill:hover,
.login-magi-field > .login-magi-input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 1000px #fff inset, 0 1px 2px rgba(0,0,0,0.04);
    -webkit-text-fill-color: #111827;
    transition: background-color 99999s ease 0s;
}

.login-magi-field > .login-magi-input:hover {
    border-color: #9ca3af;
}

.login-magi-field > .login-magi-input:focus {
    border-color: #1a5a8e;
    box-shadow: 0 0 0 3px rgba(26, 90, 142, 0.12), 0 1px 2px rgba(0,0,0,0.04);
}

/* Text centered when field has value and label is floated */
.login-magi-field > .login-magi-input:not(:placeholder-shown) {
    padding-top: 0;
    padding-bottom: 0;
    line-height: 52px;
}

/* Keep offset only while focused AND empty */
.login-magi-field > .login-magi-input:focus:placeholder-shown {
    padding-top: 18px;
    padding-bottom: 6px;
    line-height: 1.25;
}

/* Label */
.login-magi-field > .login-magi-label {
    position: absolute;
    top: 0;
    left: 2.5rem;
    right: 3rem;
    height: 50px;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    font-weight: 400;
    color: #9ca3af;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transform-origin: left center;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), color 0.16s ease;
    z-index: 2;
}

.login-magi-field > .login-magi-input:focus ~ .login-magi-label,
.login-magi-field > .login-magi-input:not(:placeholder-shown) ~ .login-magi-label {
    transform: scale(0.8) translateY(-1.9rem);
    color: #1a5a8e;
    font-weight: 600;
    right: auto;
    width: max-content;
    max-width: calc(100% - 2.5rem);
    padding: 0 0.35rem;
}

.login-magi-field > .login-magi-label::after {
    content: '';
    position: absolute;
    top: 30%;
    bottom: 30%;
    left: 0;
    right: 0;
    z-index: -1;
    background: #f8fafc;   /* matches right panel bg */
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.login-magi-field > .login-magi-input:focus ~ .login-magi-label::after,
.login-magi-field > .login-magi-input:not(:placeholder-shown) ~ .login-magi-label::after {
    opacity: 1;
}

/* Left icon */
.login-magi-icon {
    position: absolute;
    top: 25px;
    left: 0.875rem;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: #9ca3af;
    pointer-events: none;
    z-index: 3;
    transition: color 0.18s ease;
}

.login-magi-field:focus-within > .login-magi-icon {
    color: #1a5a8e;
}

/* Password toggle */
.login-password-toggle {
    position: absolute;
    top: 25px;
    right: 0.75rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem;
    z-index: 3;
    transition: color 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-password-toggle:hover { color: #1a5a8e; }

/* Validation states */
.login-magi-field > .login-magi-input.is-valid {
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
}
.login-magi-field > .login-magi-input.is-valid ~ .login-magi-label { color: #16a34a; }

.login-magi-field > .login-magi-input.is-invalid {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
.login-magi-field > .login-magi-input.is-invalid ~ .login-magi-label { color: #dc2626; }

/* Feedback */
.login-magi-feedback {
    display: none;
    align-items: flex-start;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.3rem;
    padding: 0.35rem 0.55rem;
    border-radius: 5px;
    line-height: 1.4;
}
.login-magi-feedback.show { display: flex; }
.login-magi-feedback.error {
    color: #dc2626;
    background: #fff;
    border: 1px solid #fecaca;
    border-left: 3px solid #dc2626;
}
.login-magi-feedback.error::before {
    content: '\f057';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.68rem;
    flex-shrink: 0;
    margin-top: 0.08rem;
}

/* ── REMEMBER / FORGOT ── */
.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.form-check { margin-bottom: 0; }

.form-check-input {
    background-color: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    accent-color: #1a5a8e;
}

.form-check-input:checked {
    background-color: #1a5a8e;
    border-color: #1a5a8e;
}

.form-check-label {
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
}

.remember-forgot .form-check {
    display: flex;
    align-items: center;
    padding-left: 0;
}

.remember-forgot .form-check .form-check-input {
    float: none;
    margin: 0 0.4rem 0 0;
    position: static;
}

.forgot-password {
    color: #1a5a8e;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s ease;
}
.forgot-password:hover { color: #0f3d5c; text-decoration: underline; }

/* ── SIGN IN BUTTON ── */
.login-panel-right .btn-primary {
    background: linear-gradient(135deg, #1a5a8e 0%, #2d7aaf 100%);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 4px 14px rgba(26, 90, 142, 0.3);
    cursor: pointer;
}

.login-panel-right .btn-primary:hover {
    background: linear-gradient(135deg, #0f3d5c 0%, #1a5a8e 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26, 90, 142, 0.4);
}

.login-panel-right .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(26, 90, 142, 0.3);
}

/* ── SOCIAL LOGIN ── */
.social-login {
    margin-top: 1.25rem;
    text-align: center;
}

.social-divider {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

.social-divider span {
    padding: 0 0.75rem;
    color: #9ca3af;
    font-size: 0.78rem;
    font-weight: 500;
}

.social-login .btn-secondary {
    background: #fff;
    border: 1.5px solid #d1d5db;
    color: #374151;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-weight: 500;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 0.5rem;
    cursor: pointer;
}

.social-login .btn-secondary:hover {
    border-color: #1a5a8e;
    color: #1a5a8e;
    background: rgba(26, 90, 142, 0.04);
    transform: translateY(-1px);
}

/* ── SIGNUP LINK ── */
.signup-link {
    text-align: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid #e5e7eb;
}

.signup-link p { color: #6b7280; font-size: 0.875rem; }
.signup-link a { color: #1a5a8e; text-decoration: none; font-weight: 600; }
.signup-link a:hover { color: #0f3d5c; text-decoration: underline; }

/* ── BACK LINK (inside right panel) ── */
.login-panel-right .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.8rem;
    margin-top: 0.875rem;
    transition: color 0.15s ease;
    font-weight: 500;
}
.login-panel-right .back-link:hover { color: #1a5a8e; }

/* ── ALERTS (inside right panel) ── */
.login-panel-right .alert {
    border-radius: 8px;
    border: 1px solid;
    padding: 0.7rem 0.875rem;
    margin-bottom: 1.25rem;
    border-left-width: 3px;
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.login-panel-right .alert-danger {
    background: #fff;
    border-color: #fecaca;
    border-left-color: #dc2626;
    color: #dc2626;
}

.login-panel-right .alert-success {
    background: #fff;
    border-color: #bbf7d0;
    border-left-color: #16a34a;
    color: #16a34a;
}

/* ── LOADING OVERLAY ── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    z-index: 10;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #1a5a8e;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 16px rgba(26, 90, 142, 0.2);
}

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

/* ════════════════════════════════════════════
   RESPONSIVE — stack vertically on mobile
   ════════════════════════════════════════════ */
@media (max-width: 768px) {
    .login-container { padding: 1rem 0; padding-right: 1rem; }

    .login-card {
        flex-direction: column;
        max-width: 440px;
        min-height: auto;
        border-radius: 16px;
        margin: 0.75rem;
    }

    .login-panel-left {
        flex: none;
        padding: 2rem 1.75rem 1.75rem;
        flex-direction: row;
        align-items: center;
        gap: 1.25rem;
        min-height: auto;
    }

    .login-trust-badges { display: none; }  /* hide on mobile */

    .login-brand-description { display: none; }

    /* CSS grid: [40px logo] | [Magi name]        */
    /*                        [SAF-T Solutions]     */
    .login-brand {
        display: grid;
        grid-template-columns: 40px 1fr;
        grid-template-rows: auto auto;
        column-gap: 0.875rem;
        align-items: center;
    }

    .login-brand .logo {
        grid-column: 1;
        grid-row: 1 / 3;   /* spans both text rows */
        width: 40px;
        margin-bottom: 0;
        align-self: center;
    }

    .login-brand-name {
        grid-column: 2;
        grid-row: 1;
        font-size: 1.35rem;
        margin: 0;
        line-height: 1.2;
        align-self: end;
    }

    .login-brand-tagline {
        grid-column: 2;
        grid-row: 2;
        margin: 0;
        align-self: start;
    }

    .login-panel-right {
        padding: 1.75rem 1.5rem 2rem;
    }

    .remember-forgot {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
}

/* ── Extra-small phones (< 480px) ── */
@media (max-width: 480px) {
    .login-card {
        margin: 0.5rem;
        border-radius: 12px;
    }

    .login-panel-left {
        padding: 1.5rem 1.125rem;
    }

    .login-panel-right {
        padding: 1.5rem 1.125rem 1.75rem;
    }
}