/* =========================================
    1. الإعدادات الأساسية والتصميم العام
========================================= */
body {
    background-color: #121212; color: #ffffff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; margin: 0; padding: 20px; box-sizing: border-box; padding-bottom: 80px; 
}
.container {
    background-color: #1e1e1e; padding: 30px; border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.8); width: 100%; max-width: 420px; position: relative;
}
h1 { text-align: center; color: #00ff88; margin-top: 20px; margin-bottom: 25px; font-size: 24px; }
label { display: block; margin-bottom: 8px; color: #aaaaaa; font-size: 14px; font-weight: 600; }

/* =========================================
    2. حقول الإدخال وإصلاح المحاذاة
========================================= */
input {
    width: 100%; padding: 12px; margin-bottom: 5px; 
    border: 1px solid #333; border-radius: 6px;
    background-color: #2a2a2a; color: #fff; font-size: 16px;
    box-sizing: border-box; transition: all 0.3s ease;
}
input:focus { outline: none; border-color: #00ff88; box-shadow: 0 0 10px rgba(0, 255, 136, 0.2); }

input[inputmode="decimal"], input[inputmode="numeric"] {
    font-family: monospace, sans-serif; font-size: 18px;
}

/* محاذاة الأرقام لليسار في الواجهة الإنجليزية */
[dir="ltr"] input[inputmode="decimal"], [dir="ltr"] input[inputmode="numeric"] {
    direction: ltr; text-align: left;
}

/* محاذاة الأرقام لليمين في الواجهة العربية مع الحفاظ على بنية الرقم */
[dir="rtl"] input[inputmode="decimal"], [dir="rtl"] input[inputmode="numeric"] {
    direction: ltr; text-align: right;
}

/* =========================================
    3. القوائم المنسدلة الذكية
========================================= */
.dropdown { position: relative; width: 100%; margin-bottom: 5px; }
.dropdown-input { padding-right: 35px; cursor: text; }
[dir="rtl"] .dropdown-input { padding-right: 12px; padding-left: 35px; }

.dropdown-arrow {
    position: absolute; right: 12px; top: 14px; color: #888;
    pointer-events: none; font-size: 12px; transition: 0.3s;
}
[dir="rtl"] .dropdown-arrow { right: auto; left: 12px; }

.dropdown-list {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    background-color: #2a2a2a; border: 1px solid #444; border-radius: 6px;
    z-index: 100; max-height: 200px; overflow-y: auto;
    box-shadow: 0 8px 16px rgba(0,0,0,0.6); margin-top: 4px;
}
.dropdown-item { padding: 10px 15px; cursor: pointer; transition: 0.2s; border-bottom: 1px solid #333; }
.dropdown-item:hover { background-color: #00ff88; color: #000; font-weight: bold; }
.dropdown-item:last-child { border-bottom: none; }

/* =========================================
    4. أزرار الواجهة
========================================= */
.swap-container { display: flex; justify-content: center; margin: 15px 0; }
.btn-swap {
    background: #333; color: #00ff88; border: 1px solid #444; border-radius: 50%;
    width: 40px; height: 40px; cursor: pointer; font-size: 18px;
    transition: 0.3s; display: flex; align-items: center; justify-content: center;
}
.btn-swap:hover, .btn-swap:focus { background: #444; transform: rotate(180deg); outline: none; border-color: #00ff88; }

.action-row { display: flex; gap: 8px; margin-top: 15px; }
.btn-primary { flex: 1; padding: 10px; border-radius: 6px; border: none; cursor: pointer; background: #00ff88; color: #000; font-weight: 700; transition: 0.2s; }
.btn-primary:hover { background: #00cc6a; }
.btn-secondary { flex: 1; padding: 10px; border-radius: 6px; border: 1px solid #333; background: #2a2a2a; color: #fff; cursor: pointer; font-weight: 600; transition: 0.2s; }
.btn-secondary:hover { background: #3a3a3a; }

.monetization-row { display: flex; gap: 8px; margin-top: 15px; }
.monetization-row a { flex: 1; text-decoration: none; }
.btn-coffee { width: 100%; padding: 10px; border-radius: 6px; border: none; background: #ffdd57; color: #000; font-weight: 700; cursor: pointer; transition: 0.2s; }
.btn-coffee:hover { background: #e6c74e; }

.lang-toggle {
    position: absolute; top: 15px; right: 15px; background-color: #2a2a2a; color: #00ff88;
    border: 1px solid #333; padding: 5px 10px; border-radius: 5px; cursor: pointer;
    font-size: 12px; font-weight: bold; transition: 0.2s; z-index: 10;
}
.lang-toggle:hover { background-color: #00ff88; color: #000; }
[dir="rtl"] .lang-toggle { right: auto; left: 15px; }

/* =========================================
    5. قسم الخيارات المتقدمة والنتائج
========================================= */
.advanced-toggle { text-align: center; margin: 15px 0; font-size: 13px; color: #888; cursor: pointer; text-decoration: underline; transition: 0.2s; }
.advanced-toggle:hover { color: #00ff88; }
.advanced-section { display: none; padding-top: 10px; border-top: 1px dashed #333; margin-top: 10px; }
.result-box { background-color: #00ff88; color: #000; padding: 15px; border-radius: 6px; text-align: center; font-size: 22px; font-weight: bold; margin-top: 15px; display: flex; flex-direction: column; }
.edpi-text { font-size: 14px; color: #333; margin-top: 5px; font-weight: normal; }
#toast { opacity: 0; transition: opacity 0.25s; margin-top: 8px; text-align: center; color: #aaa; font-size: 13px; height: 15px; }
.footer-text { text-align: center; font-size: 12px; color: #666; margin-top: 25px; line-height: 1.5; }

/* =========================================
    6. تصميم نافذة الدفع والباركود (USDT Modal)
========================================= */
.modal-overlay { 
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0,0,0,0.85); justify-content: center; align-items: center; 
    z-index: 1000; padding: 20px; backdrop-filter: blur(8px); 
}
.modal-content { 
    background: #1e1e1e; padding: 25px; border-radius: 12px; 
    border: 1px solid #333; width: 100%; max-width: 400px; position: relative; 
    box-shadow: 0 15px 50px rgba(0,255,136,0.15); 
}
.close-modal { 
    position: absolute; top: 15px; right: 15px; background: transparent; 
    border: none; color: #888; font-size: 18px; cursor: pointer; transition: 0.2s; 
}
[dir="rtl"] .close-modal { right: auto; left: 15px; }
.close-modal:hover { color: #ff4444; }

/* تصميم البطاقة التي تجمع الباركود والعنوان */
.crypto-card { 
    display: flex; align-items: center; background: #2a2a2a; 
    padding: 15px; border-radius: 10px; margin-bottom: 15px; 
    border: 1px solid #444; gap: 15px; transition: transform 0.2s;
}
.crypto-card:hover { border-color: #00ff88; transform: translateY(-2px); }

/* إطار الباركود (الخلفية البيضاء ضرورية لقراءة الكاميرا) */
.qr-code { 
    width: 80px; height: 80px; border-radius: 6px; 
    background: #fff; padding: 4px; border: 1px solid #ddd;
}

.crypto-details { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.crypto-net { font-size: 14px; font-weight: bold; color: #fff; margin-bottom: 6px; }
.crypto-addr { 
    font-size: 11px; color: #aaa; font-family: monospace; 
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; 
    margin-bottom: 10px; user-select: all; 
}

/* زر النسخ العريض */
.btn-copy-full { 
    background: #333; color: #00ff88; border: 1px solid #444; 
    border-radius: 6px; padding: 8px 0; cursor: pointer; 
    transition: 0.2s; font-size: 12px; font-weight: bold; text-align: center; width: 100%;
}
.btn-copy-full:hover { background: #00ff88; color: #000; }