/* resources/css/auth.css */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ============================================================
   أضف هذا الكود في نهاية ملف css/auth.css
   ============================================================ */

/* ===== متغيرات الثيمات ===== */

:root,
[data-theme="light"] {
    --panel-from: #4f46e5;
    --panel-to: #2563eb;
    --panel-mid: #7c3aed;
    --form-bg: #f8fafc;
    --form-card-bg: #ffffff;
    --form-text: #1e293b;
    --form-subtle: #64748b;
    --form-border: #e2e8f0;
    --input-bg: #f8fafc;
    --input-focus-bg: #ffffff;
    --label-color: #374151;
    --primary: #6366f1;
    --divider-color: #e2e8f0;
    --outline-hover: #f5f3ff;
}

[data-theme="dark"] {
    --panel-from: #1a1a3e;
    --panel-to: #0d0d2a;
    --panel-mid: #1e1b4b;
    --form-bg: #13131f;
    --form-card-bg: #1e1e2e;
    --form-text: #e2e8f0;
    --form-subtle: #94a3b8;
    --form-border: #2d2d45;
    --input-bg: #252538;
    --input-focus-bg: #2d2d45;
    --label-color: #94a3b8;
    --primary: #818cf8;
    --divider-color: #2d2d45;
    --outline-hover: #1e1e2e;
}

[data-theme="youth"] {
    --panel-from: #0ea5e9;
    --panel-to: #6366f1;
    --panel-mid: #38bdf8;
    --form-bg: #f0f9ff;
    --form-card-bg: #ffffff;
    --form-text: #0c4a6e;
    --form-subtle: #0369a1;
    --form-border: #bae6fd;
    --input-bg: #e0f2fe;
    --input-focus-bg: #ffffff;
    --label-color: #075985;
    --primary: #0ea5e9;
    --divider-color: #bae6fd;
    --outline-hover: #e0f2fe;
}

[data-theme="pink"] {
    --panel-from: #c026d3;
    --panel-to: #7c3aed;
    --panel-mid: #e879f9;
    --form-bg: #fdf2f8;
    --form-card-bg: #fff0f9;
    --form-text: #701a75;
    --form-subtle: #9d174d;
    --form-border: #fbcfe8;
    --input-bg: #fce7f3;
    --input-focus-bg: #ffffff;
    --label-color: #831843;
    --primary: #ec4899;
    --divider-color: #fbcfe8;
    --outline-hover: #fce7f3;
}

/* ===== تطبيق الثيمات على المكونات ===== */

.auth-panel--visual {
    background: linear-gradient(145deg,
            var(--panel-from) 0%,
            var(--panel-mid) 50%,
            var(--panel-to) 100%) !important;
}

.auth-panel--form {
    background: var(--form-bg) !important;
}

.form-card {
    background: var(--form-card-bg) !important;
    color: var(--form-text) !important;
}

.form-header h2 {
    color: var(--form-text) !important;
}

.form-header p {
    color: var(--form-subtle) !important;
}

.field__label {
    color: var(--label-color) !important;
}

.field__input {
    background: var(--input-bg) !important;
    border-color: var(--form-border) !important;
    color: var(--form-text) !important;
}

.field__input::placeholder {
    color: var(--form-subtle) !important;
    opacity: 0.6;
}

.field__input:focus {
    background: var(--input-focus-bg) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent) !important;
}

.field__icon,
.field__toggle {
    color: var(--form-subtle) !important;
}

.field__toggle:hover {
    color: var(--primary) !important;
}

.btn-auth--primary {
    background: linear-gradient(135deg,
            var(--panel-from),
            var(--panel-to)) !important;
    color: #fff !important;
}

.btn-auth--primary:hover:not(:disabled) {
    box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 40%, transparent) !important;
}

.btn-auth--outline {
    border-color: var(--form-border) !important;
    color: var(--primary) !important;
    background: transparent !important;
}

.btn-auth--outline:hover {
    background: var(--outline-hover) !important;
    border-color: var(--primary) !important;
}

.auth-divider {
    color: var(--form-subtle) !important;
}

.auth-divider::before,
.auth-divider::after {
    background: var(--divider-color) !important;
}

.checkbox-wrap {
    color: var(--form-subtle) !important;
}

.forgot-link {
    color: var(--primary) !important;
}

/* ===== مبدّل الثيم ===== */

.theme-switcher {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.28);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 6px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.theme-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
    outline: none;
}

.theme-btn[data-t="light"] {
    background: #f1f5f9;
    color: #5b21b6;
}

.theme-btn[data-t="dark"] {
    background: #1e1b4b;
    color: #c4b5fd;
}

.theme-btn[data-t="youth"] {
    background: #0ea5e9;
    color: #ffffff;
}

.theme-btn[data-t="pink"] {
    background: #c026d3;
    color: #ffffff;
}

.theme-btn.active,
.theme-btn[aria-pressed="true"] {
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    transform: scale(1.15);
}

.theme-btn:not(.active):hover {
    transform: scale(1.1);
}

/* ===== Responsive ===== */

@media (max-width: 480px) {
    .theme-switcher {
        bottom: 12px;
        padding: 5px;
        gap: 4px;
    }

    .theme-btn {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
}

body.auth-body {
    font-family: 'Segoe UI', 'Tahoma', 'Noto Naskh Arabic', sans-serif;
    background: #f0f4f8;
    min-height: 100vh;
}

/* ======= Layout ======= */
.auth-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .auth-split {
        grid-template-columns: 1fr;
    }

    .auth-panel--visual {
        display: none;
    }
}

/* ======= Visual Panel ======= */
.auth-panel--visual {
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 50%, #2563eb 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 50px;
}

.panel-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
}

.panel-logo svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 28px;
}

.panel-content h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 14px;
}

.panel-content>p {
    font-size: 15px;
    opacity: 0.8;
    margin-bottom: 40px;
    line-height: 1.7;
}

.panel-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 40px;
}

.panel-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 18px 22px;
    min-width: 90px;
}

.panel-stat__num {
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.panel-stat__lbl {
    font-size: 12px;
    opacity: 0.75;
    margin-top: 4px;
}

.panel-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transition: all 0.3s;
}

.dot--active {
    width: 24px;
    border-radius: 4px;
    background: white;
}

/* الدوائر الزخرفية */
.panel-circles {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.circle--1 {
    width: 400px;
    height: 400px;
    top: -150px;
    right: -150px;
}

.circle--2 {
    width: 280px;
    height: 280px;
    bottom: -80px;
    left: -80px;
}

.circle--3 {
    width: 180px;
    height: 180px;
    bottom: 100px;
    right: 20px;
    background: rgba(255, 255, 255, 0.04);
}

/* ======= Form Panel ======= */
.auth-panel--form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: #f8fafc;
}

.form-card {
    width: 100%;
    max-width: 420px;
    background: white;
    border-radius: 24px;
    padding: 44px 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
}

.form-header {
    margin-bottom: 32px;
    text-align: center;
}

.form-header h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.form-header p {
    font-size: 14px;
    color: #64748b;
}


/* ======= Alerts ======= */
.auth-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 20px;
}

.auth-alert[hidden] {
    display: none !important;
}

.auth-alert--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.auth-alert--success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ======= Fields ======= */
.field {
    margin-bottom: 20px;
}

.field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.field__wrap {
    position: relative;
}

.field__icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #94a3b8;
    pointer-events: none;
}

.field__input {
    width: 100%;
    padding: 13px 44px 13px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    font-family: inherit;
    direction: ltr;
    text-align: right;
}

.field__input:focus {
    outline: none;
    border-color: #6366f1;
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.08);
}

.field__input::placeholder {
    color: #cbd5e1;
}

.field__toggle {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.field__toggle:hover {
    color: #6366f1;
}

/* ======= Checkbox & Forgot ======= */
.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #64748b;
}

.checkbox-wrap input {
    width: 15px;
    height: 15px;
    accent-color: #6366f1;
}

.forgot-link {
    font-size: 13px;
    color: #6366f1;
    text-decoration: none;
    font-weight: 500;
}

.forgot-link:hover {
    text-decoration: underline;
}

/* ======= Buttons ======= */
.btn-auth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    text-decoration: none;
    border: none;
}

.btn-auth--primary {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-auth--primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.btn-auth--primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-auth--outline {
    background: transparent;
    color: #6366f1;
    border: 1.5px solid #e2e8f0;
    margin-top: 0;
}

.btn-auth--outline:hover {
    background: #f5f3ff;
    border-color: #6366f1;
}

.btn-auth__arrow {
    margin-right: auto;
    font-size: 18px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spin {
    display: inline-block;
    animation: spin 0.7s linear infinite;
}

/* ======= Divider ======= */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #cbd5e1;
    font-size: 13px;
    margin: 20px 0;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.auth-divider span {
    padding: 0 4px;
    color: #94a3b8;
}

/* ======= Register extras ======= */
.register-steps {
    display: flex;
    gap: 0;
    margin-bottom: 32px;
    position: relative;
}

.register-steps::before {
    content: '';
    position: absolute;
    top: 18px;
    right: 18px;
    left: 18px;
    height: 2px;
    background: #e2e8f0;
    z-index: 0;
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.step__circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #94a3b8;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, color 0.3s;
}

.step--active .step__circle {
    background: #6366f1;
    color: white;
}

.step--done .step__circle {
    background: #10b981;
    color: white;
}

.step__label {
    font-size: 11px;
    color: #94a3b8;
}

.step--active .step__label,
.step--done .step__label {
    color: #374151;
    font-weight: 600;
}

/* Password strength */
.strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e2e8f0;
    margin-top: 8px;
    overflow: hidden;
}

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

.strength-bar__fill[data-level="1"] {
    width: 33%;
    background: #ef4444;
}

.strength-bar__fill[data-level="2"] {
    width: 66%;
    background: #f59e0b;
}

.strength-bar__fill[data-level="3"] {
    width: 100%;
    background: #10b981;
}

.strength-text {
    font-size: 11px;
    margin-top: 4px;
    color: #94a3b8;
}

/* ============================================================
   إضافات على css/auth.css الموجود — ضعها في نهاية الملف
   ============================================================ */

/* SPA view switching */
.auth-view {
    display: none;
    animation: fadeIn .35s ease;
}

.auth-view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field error styling */
.field__input--error {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

.field__error {
    display: block;
    color: #ef4444;
    font-size: 12px;
    margin-top: 5px;
    min-height: 16px;
}

/* تنسيق select */
select.field__input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394a3b8'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 18px;
    padding-left: 36px;
    direction: rtl;
    text-align: right;
}

/* Spinner داخل الزر */
.btn-auth__spinner {
    display: inline-flex;
    align-items: center;
}
.btn-auth__spinner[hidden] {
    display: none;
}

/* تخفي الـ outline link المتنكر كزر */
a.btn-auth--outline {
    text-decoration: none;
}