/* ============================================================
   assets/css/auth.css
   Login, Register, Forgot Password pages
   Aesthetic: Split-screen luxury. Left panel dark/immersive,
   right panel clean white form. Polished and trustworthy.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,400;1,600&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* ── Inherit app vars, or define here as fallback ─────────── */
:root {
    --color-primary:      #1b5e35;
    --color-primary-dark: #0d3d1f;
    --color-primary-mid:  #2e7d32;
    --color-primary-soft: #e8f5e9;
    --color-secondary:    #c9a84c;
    --color-dark:         #0f1923;
    --color-body:         #2c3e50;
    --color-muted:        #6b7c93;
    --color-border:       #e0e7ef;
    --color-bg:           #fafcf8;
    --font-display:       'Cormorant Garamond', serif;
    --font-body:          'DM Sans', sans-serif;
    --radius-sm:  6px;
    --radius-md:  12px;
    --radius-lg:  20px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-body);
    min-height: 100vh;
}

/* ── Auth Wrapper ─────────────────────────────────────────── */
.auth-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Left Panel (Brand) ───────────────────────────────────── */
.auth-brand {
    background: linear-gradient(160deg, var(--color-primary-dark) 0%, var(--color-primary) 60%, #265c2b 100%);
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

/* Decorative pattern */
.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/svg%3E");
}

/* Decorative glow */
.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -100px; right: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201,168,76,0.18), transparent 65%);
    pointer-events: none;
}

.auth-brand-top {
    position: relative;
    z-index: 1;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 80px;
}

.auth-logo img { height: 48px; width: auto; }

.auth-logo-text .name {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
}

.auth-logo-text .tagline {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-top: 3px;
}

.auth-brand-headline {
    font-family: var(--font-display);
    font-size: clamp(2rem, 3.5vw, 3.2rem);
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 20px;
}

.auth-brand-headline em {
    color: var(--color-secondary);
    font-style: italic;
}

.auth-brand-desc {
    color: rgba(255,255,255,0.6);
    font-size: 0.95rem;
    line-height: 1.7;
    max-width: 380px;
}

/* Trust badges */
.auth-trust {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
    z-index: 1;
}

.auth-trust-item {
    display: flex;
    align-items: center;
    gap: 14px;
}

.auth-trust-icon {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.auth-trust-text .title {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.auth-trust-text .sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.45);
    margin-top: 1px;
}

/* ── Right Panel (Form) ───────────────────────────────────── */
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    background: #fff;
    overflow-y: auto;
}

.auth-form-inner {
    width: 100%;
    max-width: 420px;
}

.auth-form-header {
    margin-bottom: 36px;
}

.auth-form-header h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--color-dark);
    margin-bottom: 8px;
}

.auth-form-header p {
    color: var(--color-muted);
    font-size: 0.9rem;
}

/* ── Form Elements ────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--color-body);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.form-group label .required {
    color: #ef4444;
    margin-left: 2px;
}

.input-wrap {
    position: relative;
}

.input-wrap .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    font-size: 1rem;
    pointer-events: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-dark);
    background: #fff;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.input-wrap input { padding-left: 42px; }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27,94,53,0.1);
}

.form-group input.is-invalid { border-color: #ef4444; }
.form-group input.is-valid   { border-color: #10b981; }

.field-error {
    font-size: 0.78rem;
    color: #ef4444;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Password toggle */
.input-wrap .toggle-password {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-muted);
    font-size: 1rem;
    padding: 2px;
    transition: color var(--transition);
}

.input-wrap .toggle-password:hover { color: var(--color-primary); }

/* ── Submit Button ────────────────────────────────────────── */
.btn-auth {
    width: 100%;
    padding: 15px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.btn-auth:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(27,94,53,0.3);
}

.btn-auth:active { transform: translateY(0); }

.btn-auth:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-auth .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}

@keyframes spin { to { transform: rotate(360deg); } }
.btn-auth.loading .spinner { display: block; }
.btn-auth.loading .btn-text { display: none; }

/* ── Divider ──────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--color-muted);
    font-size: 0.82rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ── Footer Links ─────────────────────────────────────────── */
.auth-footer-text {
    text-align: center;
    font-size: 0.88rem;
    color: var(--color-muted);
    margin-top: 24px;
}

.auth-footer-text a {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-footer-text a:hover { text-decoration: underline; }

/* ── OTP Input ────────────────────────────────────────────── */
.otp-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin: 24px 0;
}

.otp-inputs input {
    width: 54px;
    height: 62px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-dark);
    background: #fff;
    transition: all var(--transition);
    outline: none;
    caret-color: var(--color-primary);
}

.otp-inputs input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27,94,53,0.1);
}

.otp-inputs input.filled {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

/* ── Password Strength ────────────────────────────────────── */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    height: 3px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s, background 0.4s;
    width: 0%;
}

.strength-fill.weak   { width: 25%; background: #ef4444; }
.strength-fill.fair   { width: 50%; background: #f59e0b; }
.strength-fill.good   { width: 75%; background: #3b82f6; }
.strength-fill.strong { width: 100%; background: #10b981; }

.strength-text {
    font-size: 0.75rem;
    color: var(--color-muted);
}

/* ── Terms Checkbox ───────────────────────────────────────── */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 0;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
}

.form-check label {
    font-size: 0.82rem;
    color: var(--color-muted);
    line-height: 1.5;
    margin: 0;
}

.form-check a {
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .auth-wrapper {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        padding: 40px 32px;
        min-height: 200px;
    }

    .auth-brand-headline { font-size: 1.8rem; }
    .auth-brand .auth-trust { display: none; }

    .auth-form-panel {
        padding: 40px 24px;
        min-height: calc(100vh - 200px);
    }
}

@media (max-width: 480px) {
    .otp-inputs input {
        width: 44px;
        height: 52px;
        font-size: 1.3rem;
    }
}
