/* هذا هو محتوى ملف style.css */
/* تم نقل جميع أنماط CSS من وسم <style> في ملف HTML إلى هنا */

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #f59e0b;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

body {
    font-family: 'Cairo', sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex; /* اجعل الـ body حاوية flexbox */
    flex-direction: column; /* ترتيب العناصر عموديا */
    /* تمت إزالة justify-content: center; و padding: 2rem 0; من هنا */
    align-items: center; /* توسيط المحتوى أفقياً داخل الـ body */
    position: relative;
    overflow-x: hidden; /* إخفاء شريط التمرير الأفقي */
}

/* العنصر الجديد main-wrapper لتصحيح التمرير العمودي */
.main-wrapper {
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* اجعله يتمدد ليأخذ كل المساحة المتاحة عموديا */
    align-items: center; /* توسيط المحتوى أفقياً داخل الـ main-wrapper */
    justify-content: center; /* توسيط المحتوى عمودياً داخل الـ main-wrapper */
    width: 100%; /* تأكد من أنه يمتد بعرض كامل */
    padding: 2rem 0; /* تطبيق المسافات البادئة الرأسية هنا بدلاً من الـ body */
}

/* خلفية متحركة أنيقة */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 200, 255, 0.2) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
    z-index: -1;
}

@keyframes float {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

.converter-container {
    background: var(--surface);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 480px;
    position: relative;
    backdrop-filter: blur(20px);
    margin-bottom: 0; /* تم إزالة الهامش السفلي من هنا، يتم التحكم بالمسافة بواسطة الـ flexbox */
}

.converter-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient);
    border-radius: 24px 24px 0 0;
}

.title {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.currency-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.currency-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-container {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 1rem;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.input-container:hover {
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -8px rgba(99, 102, 241, 0.3);
}

.input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.amount-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    font-family: inherit;
    outline: none;
}

.amount-input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.currency-select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.currency-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.currency-select option {
    background: var(--surface);
    color: var(--text);
    padding: 0.5rem;
}

.swap-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.swap-btn {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--gradient);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.swap-btn:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.6);
}

.swap-icon {
    width: 20px;
    height: 20px;
    fill: white;
}

.result-container {
    background: var(--gradient);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.result-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: sparkle 20s linear infinite;
}

.result-label {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.result-rate {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.result-info {
    font-size: 0.85rem;
    opacity: 0.8;
    position: relative;
    z-index: 1;
}

.next-update-countdown { /* تنسيقات العداد */
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    margin-top: 0.5rem;
    position: relative;
    z-index: 1;
}


@keyframes sparkle {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(-20px) translateY(-20px); }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* تحسينات الاستجابة */
@media (max-width: 480px) {
    .main-wrapper { /* تعديل المسافات البادئة للـ wrapper على الشاشات الصغيرة */
        padding: 1rem 0; 
    }

    .converter-container {
        margin: 0.5rem; /* تعديل الهوامش الجانبية لضمان عدم وجود تمرير أفقي */
        padding: 1.5rem 1rem; /* تقليل المسافات البادئة الداخلية */
    }
    
    .title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .input-container {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .currency-select {
        min-width: unset;
    }

    .footer { /* تعديل هامش الفوتر على الشاشات الصغيرة */
        margin-top: 1rem; 
    }
}

/* تأثيرات إضافية */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

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

/* تنسيقات حقوق الطبع والنشر */
.footer {
    text-align: center;
    margin-top: 2rem; /* هامش علوي للفوتر */
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.7;
}
