:root {
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-dark: #065f46;
    --primary-light: #6ee7b7;
    --bg-dark: #021a11;
    --bg-light: #f0fdf4;
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-border: rgba(255, 255, 255, 0.6);
    --shadow-color: rgba(6, 95, 70, 0.08);
    --text-primary: #064e3b;
    --text-muted: #374151;
    --glow-color: rgba(16, 185, 129, 0.3);
}

/* Dark mode preferences support */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #10b981;
        --primary-hover: #34d399;
        --primary-dark: #047857;
        --primary-light: #a7f3d0;
        --bg-dark: #02120b;
        --bg-light: #031c12;
        --glass-bg: rgba(3, 28, 18, 0.55);
        --glass-border: rgba(16, 185, 129, 0.15);
        --shadow-color: rgba(0, 0, 0, 0.3);
        --text-primary: #ecfdf5;
        --text-muted: #9ca3af;
        --glow-color: rgba(16, 185, 129, 0.4);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Cairo', sans-serif;
}

html,
body {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    background: radial-gradient(circle at 50% 50%, var(--bg-light) 0%, var(--bg-dark) 120%);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    color: var(--text-primary);
    transition: background 0.5s ease;
}

/* الخلفيات المضيئة والشبكة */
.grid-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(16, 185, 129, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(16, 185, 129, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.8) 0%, transparent 80%);
    -webkit-mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.8) 0%, transparent 80%);
}

.bg-glow-top {
    position: absolute;
    top: -15%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    background: radial-gradient(circle, var(--glow-color) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    animation: floatGlow1 8s ease-in-out infinite;
}

.bg-glow-bottom {
    position: absolute;
    bottom: -15%;
    left: -10%;
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    background: radial-gradient(circle, var(--glow-color) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    z-index: 1;
    pointer-events: none;
    animation: floatGlow2 10s ease-in-out infinite;
}

/* الحاوية الزجاجية الرئيسية */
.container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 2.5rem;
    width: 90%;
    max-width: 480px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px var(--shadow-color),
                inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transform: translateY(0);
    animation: cardIntro 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* منطقة التحميل واللوجو الكبيرة المتجاوبة */
.loader-wrapper {
    position: relative;
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
    transition: all 0.3s ease;
}

.loader-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.2));
}

.circle-bg {
    fill: none;
    stroke: rgba(16, 185, 129, 0.08);
    stroke-width: 6;
}

.circle-progress {
    fill: none;
    stroke: url(#green-gradient);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 754; /* 2 * PI * r = 2 * 3.14159 * 120 */
    stroke-dashoffset: 754;
    transition: stroke-dashoffset 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* صندوق الشعار المحسن */
.logo-box {
    width: 180px;
    height: 180px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px var(--glow-color),
                inset 0 2px 5px rgba(255, 255, 255, 0.9);
    border: 2px solid var(--primary);
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

/* تأثير لمعان خفيف للشعار */
.logo-box::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: rotate(45deg);
    animation: shine 4s ease-in-out infinite;
}

.logo-icon {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-box:hover .logo-icon {
    transform: scale(1.08);
}

/* شارة العداد */
.counter-badge {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-dark);
    background: rgba(16, 185, 129, 0.12);
    padding: 3px 12px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    z-index: 3;
    border: 1px solid rgba(16, 185, 129, 0.1);
}

/* العناوين والنصوص */
.title {
    font-size: 2.4rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}

.title span {
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.3s ease;
}

/* الجسيمات العائمة */
.particle {
    position: absolute;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    z-index: 1;
    pointer-events: none;
    animation: floatParticle linear infinite;
}

/* الحركات */
@keyframes cardIntro {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes floatGlow1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-20px, 20px) scale(1.05); }
}

@keyframes floatGlow2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -20px) scale(1.05); }
}

@keyframes shine {
    0% { left: -100%; top: -100%; }
    20%, 100% { left: 100%; top: 100%; }
}

@keyframes floatParticle {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.35;
    }
    90% {
        opacity: 0.35;
    }
    100% {
        transform: translateY(-105vh) translateX(30px);
        opacity: 0;
    }
}

/* الاستجابة للهواتف المحمولة والشاشات الصغيرة جداً */
@media (max-width: 576px) {
    .container {
        padding: 2rem 1.5rem;
        width: 92%;
    }

    .loader-wrapper {
        width: 240px;
        height: 240px;
        margin-bottom: 2rem;
    }

    .logo-box {
        width: 160px;
        height: 160px;
    }

    .logo-icon {
        width: 100px;
        height: 100px;
    }

    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 375px) {
    .loader-wrapper {
        width: 200px;
        height: 200px;
    }

    .logo-box {
        width: 135px;
        height: 135px;
    }

    .logo-icon {
        width: 85px;
        height: 85px;
    }

    .title {
        font-size: 1.7rem;
    }
}
