/* ================================================
   AUTH PAGE - FreshMarket E-commerce
   Premium Login / Register / OTP Page
   ================================================ */

/* ===== Base & Reset ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00a049;
    --primary-dark: #008a3e;
    --primary-light: #e6f7ee;
    --secondary: #ef4056;
    --bg: #f0f4f3;
    --card-bg: #ffffff;
    --text: #1a1a2e;
    --text-light: #6b7280;
    --border: #e5e7eb;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.06);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Vazirmatn', system-ui, sans-serif;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font);
}

input {
    font-family: var(--font);
    outline: none;
    border: none;
}

/* ===== Auth Page Container ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

/* ===== Background Decoration ===== */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
}

.bg-circle-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -200px;
    right: -100px;
    animation: floatBg1 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    background: #34d399;
    bottom: -150px;
    left: -100px;
    animation: floatBg2 25s ease-in-out infinite;
}

.bg-circle-3 {
    width: 250px;
    height: 250px;
    background: var(--secondary);
    top: 50%;
    left: 50%;
    opacity: 0.15;
    animation: floatBg3 18s ease-in-out infinite;
}

@keyframes floatBg1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-40px, 30px) scale(1.05); }
    66% { transform: translate(20px, -20px) scale(0.95); }
}

@keyframes floatBg2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    40% { transform: translate(30px, -20px) scale(1.03); }
    70% { transform: translate(-20px, 10px) scale(0.97); }
}

@keyframes floatBg3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.2); }
}

/* ===== Back Home Button ===== */
.back-home {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    transition: var(--transition);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.back-home:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 160, 73, 0.3);
}

.back-home i {
    font-size: 0.85rem;
    transition: var(--transition);
}

.back-home:hover i {
    transform: translateX(4px);
}

/* ===== Auth Card ===== */
.auth-card {
    position: relative;
    z-index: 10;
    display: flex;
    width: 100%;
    max-width: 1000px;
    min-height: 620px;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
}

/* ===== Visual Side ===== */
.auth-visual {
    position: relative;
    width: 42%;
    min-width: 380px;
    background: linear-gradient(135deg, #00a049 0%, #007a36 50%, #005525 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.visual-overlay {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.06) 0%, transparent 50%);
}

.visual-overlay::before {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    top: -80px;
    right: -80px;
    animation: pulseCircle 8s ease-in-out infinite;
}

.visual-overlay::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    bottom: -60px;
    left: -60px;
    animation: pulseCircle 10s ease-in-out infinite reverse;
}

@keyframes pulseCircle {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.15); opacity: 1; }
}

.visual-content {
    position: relative;
    z-index: 2;
    padding: 48px 40px;
    color: #fff;
    text-align: center;
}

.visual-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
}

.logo-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.logo-name {
    font-size: 1.7rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.visual-text {
    margin-bottom: 36px;
}

.visual-text h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 12px;
    line-height: 1.3;
}

.visual-text p {
    font-size: 0.95rem;
    line-height: 1.8;
    opacity: 0.85;
    max-width: 280px;
    margin: 0 auto;
}

.visual-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 36px;
}

.v-feat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: var(--transition);
}

.v-feat:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-4px);
}

.v-feat i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.visual-trust {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    opacity: 0.8;
}

.trust-item i {
    font-size: 0.9rem;
}

/* ===== Form Side ===== */
.auth-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 36px 44px;
    overflow-y: auto;
    max-height: 90vh;
}

/* Custom scrollbar */
.auth-form-side::-webkit-scrollbar {
    width: 4px;
}
.auth-form-side::-webkit-scrollbar-track {
    background: transparent;
}
.auth-form-side::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ===== Mobile Logo ===== */
.mobile-logo {
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

.mobile-logo a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
}

.logo-icon-sm {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary);
}

/* ===== Auth Tabs ===== */
.auth-tabs {
    position: relative;
    display: flex;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 28px;
    flex-shrink: 0;
}

.auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-light);
    border-radius: 8px;
    z-index: 2;
    transition: var(--transition);
}

.auth-tab.active {
    color: var(--primary);
}

.auth-tab i {
    font-size: 0.85rem;
}

.tab-slider {
    position: absolute;
    top: 4px;
    right: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

/* ===== Forms ===== */
.auth-form {
    display: none;
    flex-direction: column;
    flex: 1;
}

.auth-form.active {
    display: flex;
}

.auth-form.slide-in {
    animation: slideIn 0.35s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Form Head ===== */
.form-head {
    margin-bottom: 24px;
    position: relative;
}

.form-head h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.form-head p {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ===== Field Group ===== */
.field-group {
    margin-bottom: 18px;
    flex: 1;
}

.field-row {
    display: flex;
    gap: 14px;
}

.field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.field-wrap.focused {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 160, 73, 0.08);
}

.field-wrap.filled {
    background: #fff;
    border-color: var(--border);
}

.field-icon {
    position: absolute;
    right: 14px;
    font-size: 0.9rem;
    color: var(--text-light);
    transition: var(--transition);
    pointer-events: none;
}

.field-wrap.focused .field-icon {
    color: var(--primary);
}

.field-wrap input {
    width: 100%;
    padding: 16px 14px 8px 44px;
    padding-right: 42px;
    font-size: 0.92rem;
    color: var(--text);
    background: transparent;
}

.field-wrap input[dir="ltr"] {
    text-align: left;
    direction: ltr;
}

.field-wrap label {
    position: absolute;
    right: 42px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.88rem;
    color: var(--text-light);
    pointer-events: none;
    transition: var(--transition);
    background: transparent;
}

.field-wrap input:focus ~ label,
.field-wrap input:not(:placeholder-shown) ~ label {
    top: 10px;
    transform: translateY(0);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary);
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-light);
    padding-right: 4px;
}

/* ===== Password Toggle ===== */
.pass-toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    padding: 6px;
    color: var(--text-light);
    font-size: 0.9rem;
    transition: var(--transition);
    z-index: 3;
}

.pass-toggle:hover {
    color: var(--primary);
}

/* ===== Form Row ===== */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

/* ===== Custom Checkbox ===== */
.check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
    cursor: pointer;
    user-select: none;
}

.check-label input[type="checkbox"] {
    display: none;
}

.check-box {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}

.check-box i {
    font-size: 0.6rem;
    color: #fff;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition);
}

.check-label input:checked ~ .check-box {
    background: var(--primary);
    border-color: var(--primary);
}

.check-label input:checked ~ .check-box i {
    opacity: 1;
    transform: scale(1);
}

.terms-link {
    color: var(--primary);
    font-weight: 600;
    border-bottom: 1px dashed var(--primary);
}

.terms-link:hover {
    color: var(--primary-dark);
}

.forgot-link {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

.forgot-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== Submit Button ===== */
.btn-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.btn-auth::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: var(--transition);
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 160, 73, 0.35);
}

.btn-auth:hover::before {
    opacity: 1;
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-auth i {
    transition: var(--transition);
    font-size: 0.85rem;
}

.btn-auth:hover i {
    transform: translateX(-4px);
}

.btn-auth.loading {
    pointer-events: none;
    opacity: 0.85;
}

.btn-register {
    background: linear-gradient(135deg, var(--primary) 0%, #34d399 100%);
}

/* ===== Button Spinner ===== */
.btn-spinner {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== OTP Section ===== */
.otp-section {
    margin-top: 14px;
}

.otp-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--primary);
    transition: var(--transition);
}

.otp-btn:hover {
    background: var(--primary);
    color: #fff;
    border-style: solid;
}

.otp-btn i {
    font-size: 0.95rem;
}

/* ===== Divider ===== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

/* ===== Social Buttons ===== */
.social-btns {
    display: flex;
    gap: 12px;
}

.social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    transition: var(--transition);
}

.social-btn:hover {
    border-color: var(--text-light);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transform: translateY(-2px);
}

.social-btn i {
    font-size: 1.2rem;
}

.social-btn .fa-apple {
    font-size: 1.4rem;
}

/* ===== Switch Text ===== */
.switch-text {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--text-light);
}

.switch-link {
    color: var(--primary);
    font-weight: 700;
    font-size: 0.88rem;
    transition: var(--transition);
    margin-right: 4px;
}

.switch-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ===== OTP Form ===== */
.otp-back {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 0.9rem;
    transition: var(--transition);
}

.otp-back:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.otp-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 32px 0;
    direction: ltr;
}

.otp-input {
    width: 56px;
    height: 60px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg);
    caret-color: var(--primary);
    transition: var(--transition);
}

.otp-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 160, 73, 0.08);
}

.otp-timer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.otp-timer strong {
    color: var(--primary);
    font-weight: 700;
    direction: ltr;
    display: inline-block;
}

.otp-resend {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary);
    padding: 8px 20px;
    border-radius: 8px;
    background: var(--primary-light);
    transition: var(--transition);
}

.otp-resend:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
}

.otp-resend:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Password Strength ===== */
.pass-strength {
    margin-bottom: 18px;
    margin-top: -8px;
}

.strength-track {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.4s ease;
}

.strength-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    transition: color 0.3s ease;
}

/* ===== Toast ===== */
.auth-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: var(--text);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.auth-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.auth-toast i {
    color: var(--primary);
    font-size: 1.1rem;
}

/* ===== Footer ===== */
.auth-footer {
    position: relative;
    z-index: 10;
    margin-top: 24px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-light);
    opacity: 0.7;
}

/* ================================================
   RESPONSIVE
   ================================================ */

/* Large tablets & small desktops */
@media (max-width: 1100px) {
    .auth-card {
        max-width: 900px;
    }

    .auth-visual {
        width: 38%;
        min-width: 320px;
    }
}

/* Tablet */
@media (max-width: 900px) {
    .auth-page {
        padding: 20px 16px;
        justify-content: flex-start;
        padding-top: 80px;
    }

    .auth-card {
        flex-direction: column;
        max-width: 520px;
        min-height: auto;
    }

    .auth-visual {
        width: 100%;
        min-width: unset;
        min-height: 220px;
        border-radius: var(--radius) var(--radius) 0 0;
    }

    .visual-content {
        padding: 32px 28px;
    }

    .visual-text h2 {
        font-size: 1.4rem;
    }

    .visual-features {
        display: none;
    }

    .visual-trust {
        display: none;
    }

    .auth-form-side {
        padding: 28px 28px;
        max-height: none;
    }

    .mobile-logo {
        display: none;
    }

    .back-home {
        top: 16px;
        right: 16px;
        padding: 8px 16px;
        font-size: 0.82rem;
    }
}

/* Mobile */
@media (max-width: 600px) {
    .auth-page {
        padding: 12px;
        padding-top: 70px;
    }

    .auth-card {
        border-radius: var(--radius-sm);
    }

    .auth-visual {
        display: none;
    }

    .mobile-logo {
        display: block;
    }

    .auth-form-side {
        padding: 24px 20px;
    }

    .auth-tabs {
        margin-bottom: 20px;
    }

    .auth-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .form-head h3 {
        font-size: 1.15rem;
    }

    .field-row {
        flex-direction: column;
        gap: 0;
    }

    .otp-inputs {
        gap: 8px;
    }

    .otp-input {
        width: 48px;
        height: 52px;
        font-size: 1.2rem;
    }

    .social-btns {
        flex-direction: column;
        gap: 10px;
    }

    .back-home {
        top: 12px;
        right: 12px;
        padding: 8px 14px;
        font-size: 0.78rem;
    }
}

/* Small mobile */
@media (max-width: 400px) {
    .auth-form-side {
        padding: 20px 16px;
    }

    .btn-auth {
        padding: 12px 20px;
        font-size: 0.92rem;
    }

    .otp-input {
        width: 42px;
        height: 48px;
        font-size: 1.1rem;
    }
}

/* Ultra-wide */
@media (min-width: 1600px) {
    html {
        font-size: 15px;
    }

    .auth-card {
        max-width: 1080px;
    }
}
