/**
 * front-auth.css
 * Dedicated stylesheet for Kairos Public Auth Pages (login.php & register.php)
 * Design Tokens matching Kairos User Dashboard ("Tata Spring Alive" Cream + Vivid Blue + Navy + Amber)
 * All selectors namespaced strictly under .kf-auth-* to prevent leakage into user/admin panels.
 */

:root {
    /* Cream Surface Tokens */
    --kf-auth-cream-50: #FFFBEA;
    --kf-auth-cream-100: #FBF4D4;
    --kf-auth-cream-200: #F3E9B8;
    --kf-auth-cream-border: #E6D9A0;
    --kf-auth-bg: linear-gradient(180deg, #FFFBEA 0%, #FBF4D4 100%);

    /* Blue Brand Gradients */
    --kf-auth-blue-400: #38BDF8;
    --kf-auth-blue-500: #1688E0;
    --kf-auth-blue-600: #0B4FA3;
    --kf-auth-blue-700: #083E82;
    --kf-auth-blue-gradient: linear-gradient(135deg, #1688E0 0%, #0B4FA3 100%);
    --kf-auth-blue-gradient-hover: linear-gradient(135deg, #1A94F5 0%, #0D5BC0 100%);

    /* Navy Typography & Accents */
    --kf-auth-navy-900: #082544;
    --kf-auth-text-main: #0E2A47;
    --kf-auth-text-muted: #5B6F86;

    /* Accents */
    --kf-auth-amber-500: #E8A33D;
    --kf-auth-amber-gradient: linear-gradient(135deg, #F2B84B 0%, #E8A33D 100%);
    --kf-auth-pink-500: #E0457F;

    /* Status Colors */
    --kf-auth-success-bg: #E4F6EC;
    --kf-auth-success-text: #1F7A4D;
    --kf-auth-success-border: #A3E0C0;
    --kf-auth-danger-bg: #FDE7EC;
    --kf-auth-danger-text: #B4233F;
    --kf-auth-danger-border: #F7B5C3;

    /* Glass Tokens */
    --kf-auth-glass-bg: rgba(255, 255, 255, 0.14);
    --kf-auth-glass-border: 1px solid rgba(255, 255, 255, 0.25);

    /* Radii & Shadows */
    --kf-auth-radius-hero: 28px;
    --kf-auth-radius-card: 24px;
    --kf-auth-radius-input: 14px;
    --kf-auth-radius-pill: 999px;
    --kf-auth-shadow-card: 0 2px 4px rgba(8, 37, 68, 0.04), 0 14px 34px rgba(8, 37, 68, 0.09);
    --kf-auth-shadow-btn: 0 6px 20px rgba(11, 79, 163, 0.25);
}

/* ==============================================================================
   PAGE WRAPPER & SCOPED BACKGROUND
   ============================================================================== */
.kf-auth-page-wrapper {
    background: var(--kf-auth-bg) !important;
    min-height: calc(100vh - 140px);
    padding: 48px 16px 64px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    width: 100%;
    overflow-x: hidden;
}

/* Soft wave transition to footer */
.kf-auth-page-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(230, 217, 160, 0.6);
}

/* Auth Container Grid */
.kf-auth-container {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.kf-auth-container-wide {
    max-width: 1220px;
}

/* Split Layout Grid */
.kf-auth-split {
    display: grid;
    grid-template-columns: 44% 56%;
    background: transparent;
    border-radius: var(--kf-auth-radius-hero);
    gap: 28px;
    align-items: stretch;
}

/* ==============================================================================
   LEFT BRAND PANEL (VIVID BLUE GLASS HERO)
   ============================================================================== */
.kf-auth-brand-panel {
    background: var(--kf-auth-blue-gradient);
    border-radius: var(--kf-auth-radius-hero);
    padding: 44px 36px;
    color: #ffffff;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 12px 36px rgba(11, 79, 163, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Top-right Organic Cream Blob */
.kf-auth-blob {
    position: absolute;
    top: -60px;
    right: -60px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(251, 244, 212, 0.22) 0%, rgba(251, 244, 212, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* 3 Floating Bubbles */
.kf-auth-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    pointer-events: none;
    z-index: 0;
}
.kf-auth-bubble-1 {
    width: 90px;
    height: 90px;
    top: 22%;
    left: 8%;
    animation: kfAuthFloat 6s ease-in-out infinite;
}
.kf-auth-bubble-2 {
    width: 60px;
    height: 60px;
    top: 55%;
    right: 12%;
    animation: kfAuthFloat 8s ease-in-out infinite 1s;
}
.kf-auth-bubble-3 {
    width: 40px;
    height: 40px;
    bottom: 25%;
    left: 18%;
    animation: kfAuthFloat 7s ease-in-out infinite 2s;
}

@keyframes kfAuthFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(4deg); }
}

/* Bottom Hills Wave Decoration */
.kf-auth-wave-wrap {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 110px;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.kf-auth-wave-svg {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Brand Panel Content Layer */
.kf-auth-brand-content {
    position: relative;
    z-index: 1;
}

/* Brand Logo Box */
.kf-auth-logo-box {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    text-decoration: none;
}
.kf-auth-logo-img {
    height: 40px;
    max-width: 180px;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.18));
}
.kf-auth-logo-text {
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
}

/* Back to Home Link */
.kf-auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 24px;
    padding: 6px 14px;
    border-radius: var(--kf-auth-radius-pill);
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.25s ease;
    width: fit-content;
}
.kf-auth-back-link:hover {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    transform: translateX(-3px);
}

/* Headline & Tagline */
.kf-auth-headline {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.25;
    color: #ffffff;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}
.kf-auth-tagline {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 28px;
    font-weight: 500;
}

/* 3 Highlight Glass Chips */
.kf-auth-highlights {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}
.kf-auth-highlight-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: var(--kf-auth-glass-bg);
    border: var(--kf-auth-glass-border);
    border-radius: 16px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.25s ease, background 0.25s ease;
}
.kf-auth-highlight-item:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.2);
}
.kf-auth-highlight-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kf-auth-amber-500);
    font-size: 15px;
    flex-shrink: 0;
}
.kf-auth-highlight-text {
    font-size: 13.5px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.35;
}
.kf-auth-highlight-sub {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.75);
    display: block;
    font-weight: 400;
}

/* Brand Panel Footer Note */
.kf-auth-brand-footer {
    position: relative;
    z-index: 1;
    margin-top: 32px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==============================================================================
   RIGHT FORM CARD (CREAM LABEL + WHITE CARD)
   ============================================================================== */
.kf-auth-form-card {
    background: #ffffff;
    border-radius: var(--kf-auth-radius-card);
    border: 1px solid var(--kf-auth-cream-border);
    box-shadow: var(--kf-auth-shadow-card);
    padding: 40px 38px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Header Badge Pill */
.kf-auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: var(--kf-auth-radius-pill);
    background: rgba(22, 136, 224, 0.08);
    border: 1px solid rgba(22, 136, 224, 0.2);
    color: var(--kf-auth-blue-600);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    width: fit-content;
    margin-bottom: 12px;
}

.kf-auth-title {
    font-size: 26px;
    font-weight: 800;
    color: var(--kf-auth-navy-900);
    letter-spacing: -0.4px;
    margin-bottom: 6px;
}

.kf-auth-subtitle {
    font-size: 14px;
    color: var(--kf-auth-text-muted);
    margin-bottom: 24px;
    line-height: 1.45;
}

/* ==============================================================================
   ALERTS & VALIDATION NOTICES
   ============================================================================== */
.kf-auth-alert {
    padding: 12px 16px;
    border-radius: var(--kf-auth-radius-input);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
    text-align: left;
}
.kf-auth-alert-success {
    background: var(--kf-auth-success-bg);
    color: var(--kf-auth-success-text);
    border: 1px solid var(--kf-auth-success-border);
}
.kf-auth-alert-danger {
    background: var(--kf-auth-danger-bg);
    color: var(--kf-auth-danger-text);
    border: 1px solid var(--kf-auth-danger-border);
}

/* ==============================================================================
   FORM CONTROLS (WHITE BG, 1PX CREAM BORDER, RADIUS 14PX, 48PX HEIGHT)
   ============================================================================== */
.kf-auth-form-group {
    margin-bottom: 18px;
    text-align: left;
    position: relative;
}

.kf-auth-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--kf-auth-navy-900);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 7px;
    letter-spacing: 0.1px;
}
.kf-auth-label span.req {
    color: var(--kf-auth-danger-text);
    margin-left: 2px;
}

.kf-auth-input-wrap {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.kf-auth-input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--kf-auth-blue-500);
    font-size: 15px;
    pointer-events: none;
    z-index: 3;
}

.kf-auth-input {
    width: 100%;
    height: 48px;
    padding: 10px 16px 10px 46px;
    background: #ffffff !important;
    border: 1.5px solid var(--kf-auth-cream-border) !important;
    border-radius: var(--kf-auth-radius-input) !important;
    color: var(--kf-auth-text-main) !important;
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    font-weight: 500;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 2px rgba(8, 37, 68, 0.03);
}

.kf-auth-input::placeholder {
    color: #94A3B8 !important;
    font-size: 14px;
    font-weight: 400;
}

.kf-auth-input:focus {
    background: #ffffff !important;
    border-color: var(--kf-auth-blue-500) !important;
    box-shadow: 0 0 0 3px rgba(22, 136, 224, 0.25) !important;
}

/* Readonly-locked state (Referral Sponsor) */
.kf-auth-input-readonly {
    background: var(--kf-auth-cream-200) !important;
    border-color: var(--kf-auth-cream-border) !important;
    color: var(--kf-auth-navy-900) !important;
    font-weight: 700;
    cursor: not-allowed !important;
}

.kf-auth-badge-locked {
    background: #FFF1D6;
    color: #9A6200;
    border: 1px solid #F5D399;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--kf-auth-radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Select Dropdown */
select.kf-auth-input {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%231688E0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    padding-right: 40px !important;
}

/* Phone Input Combo */
.kf-auth-phone-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}
.kf-auth-phone-addon {
    background: var(--kf-auth-cream-100);
    border: 1.5px solid var(--kf-auth-cream-border);
    border-right: none;
    border-radius: var(--kf-auth-radius-input) 0 0 var(--kf-auth-radius-input);
    color: var(--kf-auth-blue-600);
    font-weight: 700;
    font-size: 14px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}
.kf-auth-phone-input {
    border-radius: 0 var(--kf-auth-radius-input) var(--kf-auth-radius-input) 0 !important;
    padding-left: 14px !important;
}

/* Password Toggle Icon */
.kf-auth-pwd-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #94A3B8;
    cursor: pointer;
    font-size: 15px;
    padding: 6px;
    transition: color 0.2s ease;
    z-index: 4;
}
.kf-auth-pwd-toggle:hover {
    color: var(--kf-auth-blue-500);
}

/* ==============================================================================
   BINARY POSITION TOGGLE (LEFT / RIGHT LEG)
   ============================================================================== */
.kf-auth-binary-wrap {
    background: var(--kf-auth-cream-50);
    border: 1.5px solid var(--kf-auth-cream-border);
    border-radius: var(--kf-auth-radius-input);
    padding: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.kf-auth-binary-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
    color: var(--kf-auth-text-muted);
    background: transparent;
    margin: 0;
}
.kf-auth-binary-tab input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.kf-auth-binary-tab.active-leg {
    background: var(--kf-auth-blue-gradient);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(11, 79, 163, 0.22);
}
.kf-auth-binary-tab:not(.active-leg):hover {
    background: rgba(22, 136, 224, 0.08);
    color: var(--kf-auth-blue-600);
}

/* ==============================================================================
   CHECKBOX & HELPER LINKS
   ============================================================================== */
.kf-auth-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--kf-auth-blue-500);
    cursor: pointer;
    border-radius: 4px;
    flex-shrink: 0;
}

.kf-auth-link {
    color: var(--kf-auth-blue-600);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}
.kf-auth-link:hover {
    color: var(--kf-auth-blue-700);
    text-decoration: underline;
}

/* ==============================================================================
   PRIMARY SUBMIT BUTTON (BLUE GRADIENT + HOVER LIFT)
   ============================================================================== */
.kf-auth-btn-primary {
    width: 100%;
    height: 50px;
    background: var(--kf-auth-blue-gradient);
    border: none;
    border-radius: var(--kf-auth-radius-input);
    color: #ffffff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), var(--kf-auth-shadow-btn);
    position: relative;
}
.kf-auth-btn-primary:hover:not(:disabled) {
    background: var(--kf-auth-blue-gradient-hover);
    transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 10px 28px rgba(11, 79, 163, 0.35);
}
.kf-auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}
.kf-auth-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Switch link chip at bottom */
.kf-auth-switch-chip {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--kf-auth-cream-border);
    font-size: 13.5px;
    color: var(--kf-auth-text-muted);
    text-align: center;
}
.kf-auth-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--kf-auth-radius-pill);
    background: var(--kf-auth-cream-100);
    color: var(--kf-auth-blue-600);
    font-weight: 700;
    text-decoration: none;
    margin-left: 6px;
    border: 1px solid var(--kf-auth-cream-border);
    transition: all 0.2s ease;
}
.kf-auth-switch-btn:hover {
    background: var(--kf-auth-cream-200);
    color: var(--kf-auth-blue-700);
}

/* ==============================================================================
   SUCCESS CREDENTIALS CARD (POST REGISTRATION)
   ============================================================================== */
.kf-auth-success-card {
    background: #ffffff;
    border: 1.5px solid var(--kf-auth-cream-border);
    border-radius: var(--kf-auth-radius-card);
    padding: 32px 28px;
    text-align: center;
    box-shadow: var(--kf-auth-shadow-card);
}
.kf-auth-success-icon-wrap {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: var(--kf-auth-success-bg);
    color: var(--kf-auth-success-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 18px;
}
.kf-auth-cred-box {
    background: var(--kf-auth-cream-50);
    border: 1.5px solid var(--kf-auth-cream-border);
    border-radius: var(--kf-auth-radius-input);
    padding: 16px 20px;
    margin: 20px 0;
    text-align: left;
}
.kf-auth-cred-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}
.kf-auth-cred-row:not(:last-child) {
    border-bottom: 1px dashed var(--kf-auth-cream-border);
}
.kf-auth-cred-label {
    font-size: 13px;
    color: var(--kf-auth-text-muted);
    font-weight: 600;
}
.kf-auth-cred-val {
    font-family: monospace;
    font-size: 17px;
    font-weight: 700;
    color: var(--kf-auth-navy-900);
    letter-spacing: 0.5px;
}

/* ==============================================================================
   RESPONSIVE DESIGN (<=991px TABLET, <=767px MOBILE, <=480px SMALL MOBILE)
   ============================================================================== */
@media (max-width: 991px) {
    .kf-auth-split {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .kf-auth-brand-panel {
        padding: 32px 24px 44px 24px;
        border-radius: var(--kf-auth-radius-card);
    }
    .kf-auth-form-card {
        padding: 32px 24px;
    }
}

@media (max-width: 767px) {
    .kf-auth-page-wrapper {
        padding: 16px 12px 40px 12px;
    }
    .kf-auth-brand-panel {
        padding: 24px 18px;
        border-radius: 20px;
        min-height: auto;
    }
    /* Compact Banner on Mobile */
    .kf-auth-headline {
        font-size: 20px;
    }
    .kf-auth-tagline {
        font-size: 13px;
        margin-bottom: 14px;
    }
    .kf-auth-highlights {
        display: none; /* Collapsed on mobile for compact hero banner */
    }
    .kf-auth-brand-footer {
        display: none;
    }
    .kf-auth-wave-wrap {
        height: 60px;
    }
    .kf-auth-form-card {
        padding: 24px 16px;
        border-radius: 20px;
    }
    .kf-auth-title {
        font-size: 22px;
    }
    .kf-auth-subtitle {
        font-size: 13px;
        margin-bottom: 18px;
    }
}

@media (max-width: 480px) {
    .kf-auth-page-wrapper {
        padding: 12px 8px 32px 8px;
    }
    .kf-auth-btn-primary {
        min-height: 48px;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .kf-auth-bubble,
    .kf-auth-btn-primary,
    .kf-auth-highlight-item {
        animation: none !important;
        transition: none !important;
    }
}
