/* =============================================
   ANAFAE MIS — Modern Login Page Styles
   ============================================= */

:root {
    --primary:        #2563EB;
    --primary-dark:   #1E40AF;
    --primary-light:  #EFF6FF;
    --text-primary:   #111827;
    --text-secondary: #6B7280;
    --border:         #E5E7EB;
    --error:          #EF4444;
    --error-bg:       #FEF2F2;
    --error-border:   #FECACA;
    --white:          #FFFFFF;
    --radius:         12px;
    --transition:     0.2s ease;
}

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

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    min-height: 100vh;
    display: flex;
    background: #F3F4F6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== SPLIT LAYOUT ===== */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left brand panel */
.login-brand {
    flex: 0 0 52%;
    background: linear-gradient(-45deg, #0b1a2f, #163058, #0f2a4a, #1a3a6b);
    background-size: 400% 400%;
    animation: lbGradient 18s ease infinite;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 48px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

@keyframes lbGradient {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Floating ambient orbs */
.login-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: .18;
    pointer-events: none;
    animation: lbFloat 20s ease-in-out infinite;
}
.login-orb.orb-1 { width: 340px; height: 340px; background: #3b82f6; top: -80px; right: -90px; animation-delay: 0s; }
.login-orb.orb-2 { width: 260px; height: 260px; background: #60a5fa; bottom: -60px; left: -70px; animation-delay: -7s; }
.login-orb.orb-3 { width: 180px; height: 180px; background: #93c5fd; top: 45%; left: 30%; animation-delay: -12s; opacity: .12; }

@keyframes lbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(24px, -18px) scale(1.06); }
    66%      { transform: translate(-16px, 14px) scale(.96); }
}

/* Subtle geometric rings */
.login-brand::before {
    content: '';
    position: absolute;
    width: 520px; height: 520px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
    top: -160px; right: -160px;
    pointer-events: none;
    animation: lbPulseRing 8s ease-in-out infinite;
}
.login-brand::after {
    content: '';
    position: absolute;
    width: 380px; height: 380px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.06);
    bottom: -120px; left: -120px;
    pointer-events: none;
    animation: lbPulseRing 10s ease-in-out infinite reverse;
}

@keyframes lbPulseRing {
    0%, 100% { transform: scale(1); opacity: .5; }
    50%      { transform: scale(1.04); opacity: .9; }
}

/* Live system badge */
.login-live-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    padding: 6px 14px;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    backdrop-filter: blur(4px);
}
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,.45);
    animation: lbLivePulse 1.8s infinite;
}
@keyframes lbLivePulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
    70%  { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* Logo container */
.brand-logo-card {
    padding: 0 0 24px 0;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.brand-logo-card img {
    width: 120px;
    height: auto;
    display: block;
}

.login-brand h1 {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    letter-spacing: -0.01em;
}

.login-brand p {
    font-size: 14px;
    opacity: 0.7;
    max-width: 300px;
    line-height: 1.7;
    position: relative;
    z-index: 1;
}

.brand-divider {
    width: 40px;
    height: 3px;
    background: rgba(255,255,255,0.35);
    border-radius: 2px;
    margin: 18px auto;
    position: relative;
    z-index: 1;
}

.system-name {
    display: inline-block;
    margin-top: 6px !important;
    font-size: 12.5px !important;
    font-weight: 600 !important;
    opacity: 1 !important;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    padding: 7px 22px;
    border-radius: 24px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    position: relative;
    z-index: 1;
}

/* Right form panel */
.login-card-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 48px;
    background: #fff;
    position: relative;
}

/* Mobile logo — hidden on desktop, shown on mobile */
.mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 20px;
}
.mobile-logo img {
    width: 72px;
    height: auto;
}

.login-form {
    width: 100%;
    max-width: 380px;
    animation: panelFadeIn 0.3s ease;
}

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

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

.login-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Alert */
.alert-error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
    padding: 11px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 380px;
    animation: panelFadeIn 0.2s ease;
}

/* Form fields */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text-primary);
    background: #fff;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-shadow: none;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
    background: #fff;
}

.form-group input::placeholder {
    color: #9ca3af;
    font-size: 13.5px;
}

/* Password field with toggle */
.input-with-toggle {
    position: relative;
}

.input-with-toggle input {
    padding-right: 42px;
}

.pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}

.pw-toggle:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.pw-toggle svg {
    width: 18px;
    height: 18px;
}

/* OTP input */
.form-group input#rp_otp {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 6px;
    font-family: 'Courier New', monospace;
}

/* Submit button */
.btn-login {
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #2563EB, #1D4ED8);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    font-family: inherit;
    letter-spacing: 0.01em;
    transition: opacity 0.18s, transform 0.12s, box-shadow 0.18s;
    box-shadow: 0 4px 14px rgba(37,99,235,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-login:hover {
    opacity: 0.93;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(37,99,235,0.4);
}
.btn-login:active { transform: translateY(0); }
.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* ===== FORGOT PASSWORD ===== */
.login-forgot-link {
    text-align: center;
    margin-top: 18px;
}
.login-forgot-link a {
    color: #2563eb;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}
.login-forgot-link a:hover { color: #1d4ed8; text-decoration: underline; }

.login-back-link {
    text-align: center;
    margin-top: 18px;
}
.login-back-link a {
    color: #6b7280;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.login-back-link a:hover { color: #2563eb; }

.fp-alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
    animation: fpFadeIn .2s ease;
}
.fp-alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}
.fp-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}
@keyframes fpFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fp-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fpSpin .6s linear infinite;
    vertical-align: middle;
    margin-left: 8px;
}
@keyframes fpSpin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */

/* Tablet — condense brand panel */
@media (max-width: 1024px) {
    .login-brand { flex: 0 0 42%; padding: 48px 32px; }
    .login-card-wrap { padding: 40px 32px; }
}

/* Mobile — hide brand panel, show form only */
@media (max-width: 860px) {
    .login-wrapper { flex-direction: column; }
    .login-brand { display: none; }

    .mobile-logo {
        display: block;
    }

    .login-card-wrap {
        flex: 1;
        padding: 36px 24px;
        justify-content: flex-start;
        padding-top: 10vh;
    }
    .login-form { max-width: 100%; }
    .alert-error { max-width: 100%; }
}

/* Phone — larger touch targets */
@media (max-width: 480px) {
    .login-card-wrap { padding: 24px 20px; padding-top: 8vh; }
    .mobile-logo img { width: 60px; }
    .login-header h2 { font-size: 20px; }
    .login-header p { font-size: 13px; }
    .login-header { margin-bottom: 22px; }
    .form-group { margin-bottom: 16px; }
    .form-group input { height: 44px; font-size: 13px; }
    .form-group input::placeholder { font-size: 13px; }
    .form-group input#rp_otp { font-size: 16px; letter-spacing: 4px; }
    .btn-login { height: 46px; font-size: 14px; }
    .login-footer { margin-top: 22px; font-size: 11px; }
    .alert-error { font-size: 12.5px; padding: 10px 12px; }
}

/* Very small phone */
@media (max-width: 380px) {
    .login-card-wrap { padding: 20px 16px; padding-top: 6vh; }
    .mobile-logo img { width: 52px; }
    .login-header h2 { font-size: 18px; }
    .form-group input { height: 42px; }
    .btn-login { height: 44px; }
}

/* Landscape phone — compact form */
@media (max-width: 860px) and (orientation: landscape) and (max-height: 500px) {
    .login-card-wrap { padding: 16px 24px; padding-top: 6vh; }
    .mobile-logo { margin-bottom: 16px; }
    .mobile-logo img { width: 48px; }
    .login-header { margin-bottom: 18px; }
    .login-header h2 { font-size: 18px; }
    .form-group { margin-bottom: 14px; }
    .login-footer { margin-top: 16px; }
}