:root {
    --primary: #6C63FF;
    --primary-dark: #5A52D5;
    --primary-light: #8B83FF;
    --accent: #FF6584;
    --bg-dark: #0F0C29;
    --bg-mid: #302B63;
    --bg-light: #24243E;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --text-white: #FFFFFF;
    --text-light: rgba(255, 255, 255, 0.8);
    --text-muted: rgba(255, 255, 255, 0.5);
    --input-bg: rgba(255, 255, 255, 0.08);
    --input-border: rgba(255, 255, 255, 0.15);
    --input-focus: rgba(108, 99, 255, 0.5);
    --success-bg: rgba(46, 213, 115, 0.15);
    --success-border: rgba(46, 213, 115, 0.4);
    --success-text: #2ED573;
    --danger-bg: rgba(255, 71, 87, 0.15);
    --danger-border: rgba(255, 71, 87, 0.4);
    --danger-text: #FF6B81;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    direction: rtl;
    background: var(--bg-dark);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* ─── پس‌زمینه متحرک ─── */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-animation::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 101, 132, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(99, 179, 255, 0.15) 0%, transparent 50%);
    animation: bgRotate 20s linear infinite;
}

@keyframes bgRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ─── ذرات شناور ─── */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: floatUp linear infinite;
}

.particle:nth-child(1) {
    width: 6px; height: 6px;
    background: var(--primary-light);
    left: 10%; animation-duration: 12s; animation-delay: 0s;
}
.particle:nth-child(2) {
    width: 4px; height: 4px;
    background: var(--accent);
    left: 25%; animation-duration: 15s; animation-delay: 2s;
}
.particle:nth-child(3) {
    width: 8px; height: 8px;
    background: rgba(99, 179, 255, 0.6);
    left: 45%; animation-duration: 10s; animation-delay: 4s;
}
.particle:nth-child(4) {
    width: 5px; height: 5px;
    background: var(--primary);
    left: 65%; animation-duration: 14s; animation-delay: 1s;
}
.particle:nth-child(5) {
    width: 7px; height: 7px;
    background: var(--accent);
    left: 80%; animation-duration: 11s; animation-delay: 3s;
}
.particle:nth-child(6) {
    width: 3px; height: 3px;
    background: var(--primary-light);
    left: 55%; animation-duration: 16s; animation-delay: 5s;
}
.particle:nth-child(7) {
    width: 5px; height: 5px;
    background: rgba(255, 255, 255, 0.3);
    left: 35%; animation-duration: 13s; animation-delay: 6s;
}
.particle:nth-child(8) {
    width: 4px; height: 4px;
    background: var(--primary);
    left: 90%; animation-duration: 17s; animation-delay: 2.5s;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) scale(1);
        opacity: 0;
    }
}

/* ─── کانتینر اصلی ─── */
.register-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 520px;
    animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(40px);
}

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

.register-container {
    background: var(--glass-bg);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px 40px 40px;
    box-shadow: 
        0 32px 64px var(--glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    /* overflow: hidden حذف شد تا دکمه مخفی نشود */
}

.register-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary-light));
    border-radius: 24px 24px 0 0;
}

/* ─── لوگو / آیکون ─── */
.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 12px 32px rgba(108, 99, 255, 0.4);
    animation: iconPulse 3s ease-in-out infinite;
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    opacity: 0.3;
    filter: blur(12px);
    z-index: -1;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.logo-icon svg {
    width: 36px;
    height: 36px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.logo-section h2 {
    color: var(--text-white);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.logo-section p {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}

/* ─── فرم ─── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 500;
}

.form-group label .label-icon {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.input-wrapper {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    color: var(--text-white);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    direction: rtl;
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-size: 13px;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(108, 99, 255, 0.08);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.form-group input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.25);
}

.form-group input[type="email"],
.form-group input[type="tel"] {
    direction: ltr;
    text-align: right;
}

/* ─── نشانگر قدرت رمز عبور ─── */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.strength-bar {
    height: 3px;
    flex: 1;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.strength-bar.active.weak { background: #FF4757; }
.strength-bar.active.medium { background: #FFA502; }
.strength-bar.active.strong { background: #2ED573; }
.strength-bar.active.very-strong { background: #1DD1A1; }

.strength-text {
    font-size: 11px;
    margin-top: 4px;
    color: var(--text-muted);
    text-align: left;
    direction: ltr;
    min-height: 16px;
}

/* ─── نمایش/مخفی رمز ─── */
.toggle-password {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s;
}

.toggle-password:hover svg {
    stroke: var(--text-light);
}

/* ─── دکمه ثبت‌نام ─── */
.btn-register {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 8px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
    /* مقادیر اولیه قابل مشاهده - انیمیشن آن‌ها را تنظیم می‌کند */
    opacity: 1;
    transform: none;
}

.btn-register::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(108, 99, 255, 0.5);
}

.btn-register:hover::before {
    left: 100%;
}

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

/* ─── پیام‌ها ─── */
.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    font-size: 13px;
    line-height: 1.8;
    backdrop-filter: blur(10px);
    animation: alertSlide 0.4s ease-out;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border: 1px solid var(--danger-border);
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.alert div {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── لینک ورود ─── */
.login-link {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.login-link a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.login-link a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 2px;
    background: var(--primary-light);
    transition: width 0.3s;
    border-radius: 2px;
}

.login-link a:hover::after {
    width: 100%;
}

.login-link a:hover {
    color: var(--text-white);
}

/* ─── جداکننده ─── */
.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

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

.divider span {
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}

/* ─── ریسپانسیو ─── */
@media (max-width: 540px) {
    .register-container {
        padding: 36px 24px 32px;
        border-radius: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .logo-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
    }

    .logo-icon svg {
        width: 30px;
        height: 30px;
    }

    .logo-section h2 {
        font-size: 20px;
    }
}

/* ─── انیمیشن ورودی‌ها ─── */
.form-row {
    animation: fieldFadeIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: 0.1s;
}

.form-row ~ .form-group:nth-of-type(1) {
    animation: fieldFadeIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: 0.15s;
}

.form-row ~ .form-group:nth-of-type(2) {
    animation: fieldFadeIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: 0.2s;
}

.form-row ~ .form-group:nth-of-type(3) {
    animation: fieldFadeIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: 0.25s;
}

.form-row ~ .form-group:nth-of-type(4) {
    animation: fieldFadeIn 0.5s ease-out forwards;
    opacity: 0;
    transform: translateY(15px);
    animation-delay: 0.3s;
}

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