:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-gradient: linear-gradient(135deg, #4f46e5, #7c3aed);
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-focus: #4f46e5;
    --card-bg: rgba(255, 255, 255, 0.96);
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --success: #10b981;
    --success-bg: #f0fdf4;
    --error: #ef4444;
    --error-bg: #fef2f2;
    --font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    direction: rtl;
}

.bg-pattern {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.bg-pattern::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, rgba(79, 70, 229, 0.06) 0%, transparent 50%);
}

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

.bg-circle-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    right: -150px;
    animation: floatSlow 20s ease-in-out infinite;
}

.bg-circle-2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    left: -100px;
    animation: floatSlow 25s ease-in-out infinite reverse;
}

.bg-circle-3 {
    width: 200px;
    height: 200px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: floatSlow 15s ease-in-out infinite;
}

@keyframes floatSlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.02); }
    66% { transform: translate(-20px, 20px) scale(0.98); }
}

.auth-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    animation: fadeSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 44px 36px 36px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-gradient);
}

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

.auth-logo {
    margin-bottom: 20px;
    display: inline-block;
    position: relative;
}

.auth-logo img {
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.auth-logo:hover img {
    transform: scale(1.05);
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.3px;
}

.auth-header p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
    line-height: 1.5;
}

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    animation: alertSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.alert-icon {
    flex-shrink: 0;
}

.alert-error {
    background: var(--error-bg);
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--success-bg);
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.2px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    right: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 1;
}

.form-group input {
    width: 100%;
    padding: 12px 46px 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    background: #fafbfc;
    color: var(--text-primary);
    direction: rtl;
}

.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
    background: #ffffff;
}

.form-group input:focus ~ .input-icon,
.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

.form-group input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.form-group input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px #fafbfc inset;
    -webkit-text-fill-color: var(--text-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    border: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.3px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

.btn-primary:hover::after {
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.btn-block {
    width: 100%;
}

.btn-spinner {
    animation: spin 0.8s linear infinite;
}

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

.auth-footer {
    text-align: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.auth-footer p {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

@media (max-width: 480px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-container {
        max-width: 100%;
    }

    .auth-card {
        padding: 32px 24px 28px;
        border-radius: 14px;
    }

    .auth-header {
        margin-bottom: 26px;
    }

    .auth-header h1 {
        font-size: 22px;
    }

    .auth-header p {
        font-size: 13px;
    }

    .form-group input {
        padding: 11px 42px 11px 14px;
        font-size: 16px;
    }

    .input-icon {
        right: 12px;
    }

    .btn {
        padding: 12px 24px;
        font-size: 14px;
    }

    .auth-footer {
        margin-top: 22px;
        padding-top: 18px;
    }

    .bg-circle-1 {
        width: 300px;
        height: 300px;
    }

    .bg-circle-2 {
        width: 200px;
        height: 200px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .auth-card {
        padding: 38px 30px 32px;
    }
}

@media (min-height: 900px) {
    body {
        padding: 40px 20px;
    }
}
