/* SUBPADI AUTH — V6 Brand System */

/* ── Design tokens (shared with landing) ── */
:root {
    --brand-coral: #e45e10;
    --brand-pink: #c2185b;
    --brand-purple: #313054;
    --brand-deep: #0f0e1f;
    --bg-soft: #f8f7ff;
    --gradient-brand: linear-gradient(135deg, #e45e10 0%, #c2185b 50%, #313054 100%);
    --gradient-brand-h: linear-gradient(90deg, #e45e10 0%, #c2185b 50%, #313054 100%);
}

/* ── Brand panel (left side) ── */
.auth-brand-panel {
    background: linear-gradient(160deg, var(--brand-purple) 0%, var(--brand-deep) 60%, #1a0e2e 100%);
}

.auth-mesh {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.auth-mesh::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -15%;
    width: 60%;
    height: 70%;
    background: radial-gradient(ellipse at center, rgba(228,94,16,0.12) 0%, transparent 65%);
    animation: auth-drift 14s ease-in-out infinite alternate;
}
.auth-mesh::after {
    content: '';
    position: absolute;
    bottom: -15%;
    left: -10%;
    width: 50%;
    height: 60%;
    background: radial-gradient(ellipse at center, rgba(194,24,91,0.08) 0%, transparent 65%);
    animation: auth-drift 11s ease-in-out 3s infinite alternate-reverse;
}
@keyframes auth-drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, -25px) scale(1.08); }
}

/* ── Form inputs ── */
.auth-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1f2937;
    background: white;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.auth-input:focus {
    border-color: var(--brand-coral);
    box-shadow: 0 0 0 4px rgba(228, 94, 16, 0.08);
}
.auth-input::placeholder {
    color: #9ca3af;
}
.auth-input.is-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.06);
}
.auth-input.is-valid {
    border-color: #10b981;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.06);
}

/* ── Input with icon ── */
.input-icon-wrap {
    position: relative;
}
.input-icon-wrap .auth-input {
    padding-left: 46px;
}
.input-icon-wrap .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #9ca3af;
    pointer-events: none;
    transition: color 0.25s ease;
}
.input-icon-wrap:focus-within .input-icon {
    color: var(--brand-coral);
}

/* ── Country select ── */
.auth-select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px; cursor: pointer;
}
.auth-select:focus {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e45e10' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
.country-flag-icon {
    font-size: 18px; width: auto; height: auto;
    line-height: 1; pointer-events: none;
}

/* ── Password toggle ── */
.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    transition: color 0.2s ease;
}
.password-toggle:hover {
    color: var(--brand-purple);
}

/* ── Primary button (gradient) ── */
.btn-auth {
    width: 100%;
    padding: 15px 24px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    color: white;
    background: var(--gradient-brand);
    background-size: 150% 100%;
    cursor: pointer;
    transition: all 0.35s ease;
    position: relative;
    overflow: hidden;
}
.btn-auth:hover {
    background-position: 100% 0;
    box-shadow: 0 8px 30px rgba(228, 94, 16, 0.3);
    transform: translateY(-2px);
}
.btn-auth:active {
    transform: translateY(0);
}
.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Secondary button (outline) ── */
.btn-auth-outline {
    width: 100%;
    padding: 14px 24px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: #374151;
    background: white;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.btn-auth-outline:hover {
    border-color: #d1d5db;
    background: #f9fafb;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 500;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e7eb;
}

/* ── Password strength bar ── */
.strength-bar {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}
.strength-segment {
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: #e5e7eb;
    transition: background 0.3s ease;
}
.strength-weak .strength-segment:nth-child(1) { background: #ef4444; }
.strength-okay .strength-segment:nth-child(1),
.strength-okay .strength-segment:nth-child(2) { background: #f59e0b; }
.strength-strong .strength-segment:nth-child(1),
.strength-strong .strength-segment:nth-child(2),
.strength-strong .strength-segment:nth-child(3) { background: #10b981; }

/* ── OTP input boxes ── */
.otp-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}
.otp-box {
    width: 52px;
    height: 60px;
    border: 2px solid #e5e7eb;
    border-radius: 14px;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    font-family: inherit;
    color: var(--brand-purple);
    background: white;
    outline: none;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    caret-color: var(--brand-coral);
}
.otp-box:focus {
    border-color: var(--brand-coral);
    box-shadow: 0 0 0 4px rgba(228, 94, 16, 0.08);
}
.otp-box.filled {
    border-color: var(--brand-purple);
    background: var(--bg-soft);
}

/* ── Error alert ── */
.auth-error {
    padding: 12px 16px;
    border-radius: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.auth-error svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Success alert ── */
.auth-success {
    padding: 12px 16px;
    border-radius: 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

/* ── Checkbox ── */
.auth-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #d1d5db;
    border-radius: 5px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-top: 2px;
}
.auth-checkbox:checked {
    background: var(--brand-coral);
    border-color: var(--brand-coral);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
    background-size: 14px;
    background-position: center;
    background-repeat: no-repeat;
}

/* ── Form entrance animation ── */
.auth-form-enter {
    animation: authSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Brand panel image ── */
.auth-panel-image {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-panel-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* ── Floating label style (optional) ── */
.field-group {
    position: relative;
    margin-bottom: 4px;
}
.field-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}
.field-helper {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}
.field-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
}

/* ── App store buttons (compact for auth) ── */
.auth-store-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    gap: 8px;
}
.auth-store-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.auth-store-google {
    background: linear-gradient(135deg, #34A853 0%, #0F9D58 100%);
}
.auth-store-apple {
    background: linear-gradient(135deg, #000 0%, #2c2c2c 100%);
}

/* ── Loading spinner ── */
.auth-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}
@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .auth-form-enter { animation: none; opacity: 1; }
    .auth-mesh::before, .auth-mesh::after { animation: none; }
    .auth-spinner { animation-duration: 1.5s; }
}

/* ── Mobile brand banner ── */
.mobile-auth-banner {
    background: linear-gradient(145deg, var(--brand-purple) 0%, var(--brand-deep) 55%, #1a0e2e 100%);
    box-shadow: 0 8px 32px rgba(49, 48, 84, 0.2);
    min-height: 180px;
}
.mobile-auth-banner .auth-mesh::before {
    width: 50%;
    height: 60%;
    top: -25%;
    right: -10%;
    background: radial-gradient(ellipse at center, rgba(228,94,16,0.15) 0%, transparent 60%);
}
.mobile-auth-banner .auth-mesh::after {
    width: 40%;
    height: 50%;
    bottom: -15%;
    left: -5%;
    background: radial-gradient(ellipse at center, rgba(194,24,91,0.10) 0%, transparent 60%);
}

/* Banner image: positioned right, faded into gradient */
.mobile-banner-img-wrap {
    position: absolute;
    right: -10px;
    top: 0;
    bottom: 0;
    width: 55%;
    z-index: 1;
    overflow: hidden;
    border-radius: 0 1rem 1rem 0;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.25) 30%, rgba(0,0,0,0.5) 100%);
    mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.25) 30%, rgba(0,0,0,0.5) 100%);
}
.mobile-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    opacity: 0.7;
}

/* Ensure text sits above the image */
.mobile-banner-text {
    position: relative;
    z-index: 5;
    max-width: 70%;
}
@media (min-width: 500px) {
    .mobile-banner-text {
        max-width: 65%;
    }
    .mobile-banner-img-wrap {
        width: 50%;
        -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.3) 25%, rgba(0,0,0,0.6) 100%);
        mask-image: linear-gradient(to right, transparent 0%, rgba(0,0,0,0.3) 25%, rgba(0,0,0,0.6) 100%);
    }
}

/* ── Responsive tweaks ── */
@media (max-width: 640px) {
    .otp-box {
        width: 46px;
        height: 54px;
        font-size: 20px;
    }
    .otp-group {
        gap: 8px;
    }
    .auth-input {
        padding: 13px 14px;
        font-size: 16px; /* prevents iOS zoom on focus */
    }
    .input-icon-wrap .auth-input {
        padding-left: 42px;
    }
    .btn-auth {
        padding: 14px 20px;
        font-size: 15px;
    }
    .btn-auth-outline {
        padding: 13px 20px;
        font-size: 14px;
    }
}
