/* ==========================================================================
   1. RESET & CSS VARIABLES
   ========================================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    /* Brand & State Colors */
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-glow: rgba(79, 70, 229, 0.14);
    
    --wa-color: #25d366;
    --wa-hover: #1aab52;
    --wa-bg: #e8faf0;
    --wa-glow: rgba(37, 211, 102, 0.15);

    --danger: #ef4444;
    --success: #10b981;
    --warning-border: #ffcc00;

    /* Base Colors */
    --text-dark: #0f172a;
    --text-body: #1f2937;
    --text-muted: #64748b;
    
    --bg-main: #f6f7fb;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    --bg-white: #ffffff;
    --border-color: #e2e8f0;

    /* Typography & Spacing */
    --font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* Effects & Transitions */
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --btn-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html,
body {
    height: 100%;
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-dark);
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   2. DISCLAIMER BANNER & TOPBAR
   ========================================================================== */
.disc-bar {
    background: #1e293b;
    color: #cbd5e1;
    text-align: center;
    padding: 10px 16px;
    font-size: 0.825rem;
    line-height: 1.4;
    border-bottom: 2px solid var(--warning-border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.disc-bar p {
    margin: 0;
    font-size: 12px;
    color: #cbd5e1;
    line-height: 1.5;
}

.disc-bar strong {
    color: #ffffff;
    font-weight: 700;
}

.topbar {
    height: 56px;
    background: var(--bg-white);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.topbar .inner {
    width: 100%;
    max-width: 480px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.03em;
}

.brand span {
    color: #f97316;
}

.brand img {
    transition: transform 0.2s ease;
}

.brand img:hover {
    transform: scale(1.03);
}

.close-btn {
    color: var(--text-muted);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    text-decoration: none;
    transition: var(--transition);
}

.close-btn:hover {
    background: #e2e8f0;
    color: var(--text-dark);
}

/* ==========================================================================
   3. LAYOUT & CARD CONTAINER
   ========================================================================== */
main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 48px;
}

.card {
    width: 100%;
    max-width: 440px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 32px 28px;
    box-shadow: var(--card-shadow);
    position: relative;
    animation: fadeInSlide 0.5s ease-out forwards;
}

/* Card Progress Steps */
.steps {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
}

.step {
    height: 4px;
    border-radius: 4px;
    background: var(--border-color);
    flex: 1;
    transition: var(--transition);
}

.step.done {
    background: var(--success);
}

.step.active {
    background: var(--primary);
}

/* Typography Inside Card */
.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-dark);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.card-sub {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ==========================================================================
   4. FORM ELEMENTS & SMART INPUTS
   ========================================================================== */
.field-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.smart-wrap {
    display: flex;
    align-items: center;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 2px 14px;
    transition: var(--transition);
    overflow: hidden;
}

.smart-wrap:focus-within {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.smart-wrap.wa {
    border-color: var(--wa-color);
}

.smart-wrap.wa:focus-within {
    border-color: var(--wa-color);
    box-shadow: 0 0 0 4px var(--wa-glow);
}

.s-icon {
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-muted);
    flex-shrink: 0;
    align-self: stretch;
    transition: var(--transition);
}

.smart-wrap:focus-within .s-icon {
    color: var(--primary);
}

.smart-wrap.wa .s-icon,
.smart-wrap.wa:focus-within .s-icon {
    color: var(--wa-color);
}

.s-prefix {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    padding-left: 8px;
    display: none;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
}

.smart-wrap.wa .s-prefix {
    display: inline-flex;
}

.smart-wrap input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px 10px;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: var(--font-family);
    color: var(--text-dark);
}

.smart-wrap input::placeholder {
    color: #9ca3af;
}

.field-hint {
    font-size: 0.775rem;
    color: var(--text-muted);
    margin-top: 6px;
    margin-bottom: 18px;
    min-height: 15px;
    line-height: 1.5;
}

.field-hint b {
    color: var(--primary);
    font-weight: 600;
}

.field-hint.wa {
    color: #166534;
}

.field-hint.wa b {
    color: var(--wa-hover);
}

/* Checkbox & Terms */
.terms-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.825rem;
    color: var(--text-muted);
}

.terms-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.terms-row label {
    line-height: 1.5;
}

.terms-row a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.terms-row a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   5. OTP & INTERACTIVE STATES
   ========================================================================== */
.otp-wrap {
    display: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(10px);
    transition: var(--transition);
}

.otp-wrap.open {
    display: block;
    opacity: 1;
    max-height: 500px;
    transform: translateY(0);
}

.sent-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: 18px 0 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.sent-note.em {
    background: var(--primary-light);
    color: var(--primary);
}

.sent-note.wa {
    background: var(--wa-bg);
    color: #15803d;
}

#otpMaster {
    position: absolute;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.otp-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
    width: 100%;
}

.ob {
    width: 48px;
    height: 54px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-family);
    color: var(--text-dark);
    outline: none;
    transition: var(--transition);
}

.ob:focus {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.ob.filled {
    border-color: var(--primary);
    background: var(--bg-white);
}

.back-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 0;
    font-family: var(--font-family);
}

.back-link:hover {
    color: var(--text-body);
}

/* ==========================================================================
   6. BUTTONS & FEEDBACK
   ========================================================================== */
.btn-main,
.btn-verify {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #ffffff;
    font-family: var(--font-family);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
    box-shadow: var(--btn-shadow);
}

.btn-main:hover:not(:disabled),
.btn-verify:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-main:active:not(:disabled),
.btn-verify:active:not(:disabled) {
    transform: none;
}

.btn-main:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

.timer-row {
    text-align: center;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 10px;
    min-height: 18px;
}

.msg {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 16px;
    min-height: 20px;
    color: var(--danger);
}

.msg.ok {
    color: var(--success);
}

/* ==========================================================================
   7. TRUST & FOOTER
   ========================================================================== */
.trust {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.trust span {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.725rem;
    color: var(--text-muted);
}

.auth-foot {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 18px;
}

.auth-foot a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-foot a:hover {
    text-decoration: underline;
}

/* Overlay Loader */
#ldr {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.spin {
    width: 48px;
    height: 48px;
    border: 4px solid #ffffff;
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    animation: rotation 1s linear infinite;
}

/* ==========================================================================
   8. KEYFRAMES & ANIMATIONS
   ========================================================================== */
@keyframes rotation {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* ==========================================================================
   9. MEDIA QUERIES
   ========================================================================== */
@media (max-width: 500px) {
    main {
        padding: 20px 12px 40px;
    }

    .card {
        padding: 24px 18px;
        border-radius: var(--radius-md);
    }

    .card-title {
        font-size: 1.3rem;
    }

    .disc-bar {
        padding: 8px 14px;
    }

    .disc-bar p {
        font-size: 11px;
    }

    .otp-row {
        gap: 5px;
    }

    .ob {
        width: 40px;
        height: 48px;
        font-size: 1.1rem;
    }
}