/* ====================================
   تحسينات بصرية لشاشات المصادقة
   Auth Visual Enhancements
   تستخدم ألوان الثيم من النظام
   ==================================== */

/* متغيرات الألوان لكل ثيم */
body.theme-1 {
    --theme-color: #0CAF60;
    --theme-hover: #0a9552;
}

body.theme-2 {
    --theme-color: #584ED2;
    --theme-hover: #4639a8;
}

body.theme-3 {
    --theme-color: #6FD943;
    --theme-hover: #59ae36;
}

body.theme-4 {
    --theme-color: #1c449b;
    --theme-hover: #16367c;
}

body.custom-color {
    --theme-color: var(--color-customColor);
    --theme-hover: var(--color-customColor);
}

/* خلفية متحركة بتأثير الجزيئات */
.custom-login {
    position: relative;
    overflow: hidden;
}

.custom-login::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, var(--theme-color) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, var(--theme-color) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, var(--theme-color) 0%, transparent 50%);
    opacity: 0.1;
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* تحسين البطاقة الرئيسية */
.login-card-body {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow:
        0 8px 32px 0 rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    animation: slideInUp 0.6s ease-out;
}

.login-card-body:hover {
    box-shadow:
        0 12px 48px 0 rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* تحسين العناوين */
.login-card-body h2 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    position: relative;
    display: inline-block;
    animation: fadeInDown 0.8s ease-out;
}

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

/* تحسين حقول الإدخال */
.custom-login-form .form-control {
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.custom-login-form .form-control:focus {
    border-color: var(--theme-color) !important;
    box-shadow:
        0 0 0 4px rgba(0, 0, 0, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    background: #ffffff;
}

.custom-login-form .form-control::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

/* تأثير التركيز المتحرك */
.form-control-wrapper {
    position: relative;
}

.form-control-wrapper::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.form-control-wrapper:focus-within::after {
    width: 100%;
}

/* تحسين الأزرار */
.custom-login-form .btn-primary {
    background: var(--theme-color) !important;
    border: none !important;
    border-radius: 12px;
    padding: 14px 28px;
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.custom-login-form .btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.custom-login-form .btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.custom-login-form .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.custom-login-form .btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* تحسين أزرار Login/Register */
.users-btn .btn-group .btn {
    border: 2px solid #e0e7ff;
    background: #ffffff;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-weight: 600;
}

.users-btn .btn-group .btn a {
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.users-btn .btn-group .btn.active {
    background: var(--theme-color) !important;
    border-color: var(--theme-color) !important;
}

.users-btn .btn-group .btn.active a {
    color: #ffffff !important;
}

.users-btn .btn-group .btn:hover:not(.active) {
    border-color: var(--theme-color);
    background: rgba(0, 0, 0, 0.03);
    transform: translateY(-2px);
}

/* تحسين حقل رمز التحقق */
.verification-input {
    background: linear-gradient(135deg, #f6f8ff 0%, #ffffff 100%);
    border: 3px solid #e0e7ff;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.verification-input:focus {
    border-color: var(--theme-color);
    box-shadow:
        0 0 0 6px rgba(0, 0, 0, 0.05),
        0 8px 30px rgba(0, 0, 0, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.05);
    transform: scale(1.02);
    background: #ffffff;
}

/* تأثير الوميض للحقل النشط */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.verification-input:focus {
    animation: pulse 2s infinite;
}

/* تحسين زر إعادة الإرسال */
.btn-link {
    color: var(--accent-color);
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
}

.btn-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-gradient);
    transition: width 0.3s ease;
}

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

.btn-link:hover {
    color: var(--accent-hover);
    transform: translateX(5px);
}

/* تحسين رسائل التنبيه */
.alert {
    border-radius: 12px;
    border: none;
    animation: slideInRight 0.5s ease-out;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
}

.alert-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
}

/* جزيئات متحركة في الخلفية */
.auth-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.auth-particles .particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: auth-float-particle 15s infinite ease-in-out;
}

@keyframes auth-float-particle {
    0%, 100% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 0.3;
    }
    90% {
        opacity: 0.3;
    }
    100% {
        transform: translate(100px, -100vh);
        opacity: 0;
    }
}

/* تأثيرات تفاعلية مع Alpine.js */
[x-cloak] {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* تحسين السلايدر */
.custom-features .swiper {
    animation: fadeInLeft 1s ease-out;
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.swiper-slide {
    transition: all 0.3s ease;
}

.swiper-slide:hover {
    transform: scale(1.05);
}

/* تأثير التوهج للعناصر المهمة */
.glow-effect {
    position: relative;
}

.glow-effect::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--primary-gradient);
    border-radius: inherit;
    opacity: 0;
    filter: blur(10px);
    transition: opacity 0.3s ease;
    z-index: -1;
}

.glow-effect:hover::before {
    opacity: 0.7;
}

/* تحسينات للشاشات الصغيرة */
@media only screen and (max-width: 767px) {
    .login-card-body {
        animation: slideInUp 0.5s ease-out;
    }

    .custom-login-form .btn-primary {
        padding: 12px 24px;
        font-size: 15px;
    }
}

@media only screen and (max-width: 575px) {
    .custom-login-form .form-control {
        padding: 12px 16px;
        font-size: 14px;
    }

    .users-btn .btn-group .btn {
        font-size: 14px;
    }
}

/* تأثير التحميل */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

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

/* تحسين النصوص */
.text-muted {
    color: #718096 !important;
    font-weight: 500;
}

/* تأثير الانتقال السلس للصفحات */
.page-transition {
    animation: pageTransition 0.5s ease-out;
}

@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
