/* =========================================
   1. تنسيقات أساسية للقوائم (Bootstrap Dropdown Fixed)
   ========================================= */
.prices-scraper-exchange-rate-convert {
    position: relative;
    font-family: inherit;
    box-sizing: border-box;
}

.prices-scraper-exchange-rate-convert * {
    box-sizing: border-box;
}

/* إصلاح القائمة المنسدلة للغة العربية */
.prices-scraper-exchange-rate-convert .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;      /* في العربي يجب أن تبدأ من اليمين */
    left: auto;    /* إلغاء اليسار */
    z-index: 1000;
    display: none;
    float: left;
    min-width: 100%;
    padding: 5px 0;
    margin: 2px 0 0;
    font-size: 14px;
    text-align: right;
    list-style: none;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, .15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, .175);
}

.prices-scraper-exchange-rate-convert .show > .dropdown-menu {
    display: block;
}

.prices-scraper-exchange-rate-convert .input-group-btn {
    position: relative;
    width: 100%;
}

/* تنسيق الزر الرئيسي للقائمة */
.prices-scraper-exchange-rate-convert .btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important; /* لضمان توزيع العناصر */
    width: 100%;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid #ccc;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 4px;
    color: #333;
    background-color: #ffffff7a;
    cursor: pointer;
    height: 42px !important;
}

.prices-scraper-exchange-rate-convert .caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 5px;
    vertical-align: middle;
    border-top: 4px dashed;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

/* =========================================
   2. تخطيط الحاسبة (Layout & Container)
   ========================================= */
.psmc-wrapper {
    direction: rtl;
    max-width: 100%;
    margin: 0 auto;
}

.psmc-wrapper .pserc-modul {
    background: #cfcfcf42;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* --- [إصلاح] حاوية الحقول العلوية --- */
.psmc-selectors-container {
    display: flex;
    flex-wrap: wrap; /* يسمح بالنزول لسطر جديد */
    gap: 15px;       /* مسافة بين الحقول */
    margin-bottom: 15px;
}

.psmc-input-group {
    flex: 1;              /* تمدد لتأخذ المساحة المتاحة */
    min-width: 160px;     /* أقل عرض للحقل لمنع الانضغاط */
    display: flex;
    flex-direction: column;
}

/* النصوص العلوية للحقول */
.psmc-wrapper .convert-from-text {
    text-align: right;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
    font-size: 13px;
}

/* محتوى الزر الداخلي */
.psmc-wrapper .tile {
    display: flex;
    align-items: center;
    width: 100%;
}

.psmc-wrapper .tile-content {
    flex-grow: 1;
    text-align: right;
    overflow: hidden; /* لمنع النص الطويل من كسر التصميم */
    text-overflow: ellipsis;
}

.psmc-wrapper .tile-title {
    font-weight: bold;
    font-size: 17px;
}

/* القوائم الداخلية */
.psmc-wrapper .dropdown-menu-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.psmc-wrapper .psmc-option {
    cursor: pointer;
    padding: 8px 15px;
    border-bottom: 1px solid #f9f9f9;
    transition: background 0.2s;
    display: block;
    width: 100%;
    text-align: right;
}

.psmc-wrapper .psmc-option:hover {
    background-color: #f0f4ff;
    color: #000;
}

.psmc-wrapper .input-search {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.psmc-wrapper .input-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* =========================================
   3. حقل الإدخال والنتيجة
   ========================================= */
.pserc-input-form {
    margin-top: 25px;
    text-align: center;
}

.pserc-input-form .convert-from-text {
    width: 100%;
    text-align: center; /* توسيط العنوان فوق حقل الوزن */
}

.pserc-inputs {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    font-size: 18px;
    text-align: center;
    border: 1px solid #cccccc8c !important;
    border-radius: 6px;
    direction: ltr;
    height: 42px !important;
    display: inline-block;
    background: #f5f5f5 !important;
}

.pserc-output-form {
    text-align: center;
    margin-top: 15px;
}

.pserc-result {
    font-size: 24px;
    font-weight: bold;
    color: #333; /* لون أسود محايد بدلاً من الأخضر الثابت */
    transition: color 0.3s ease; /* تأثير ناعم عند تغير اللون */
}
/* إضافة كلاسات الألوان الديناميكية */
.psmc-text-up {
    color: #0fa709 !important; /* أخضر للارتفاع */
}

.psmc-text-down {
    color: #fa3333 !important; /* أحمر للهبوط */
}

.psmc-text-neutral {
    color: #333 !important;   /* لون محايد */
}


#psmc-output-currency {
    color: #555;
    margin-right: 5px;
    font-size: 18px;
}

/* صور وأيقونات */
.psmc-wrapper img, 
.psmc-wrapper svg {
    max-height: 24px;
    width: auto !important;
    object-fit: contain;
}

#psmc-change-indicator img {
    vertical-align: middle;
    margin-bottom: 2px;
}

/* =========================================
   4. تنسيقات السلة (Basket Table)
   ========================================= */
.psmc-basket-table th, 
.psmc-basket-table td {
    padding: 8px;
    vertical-align: middle;
    border: 1px solid #eee;
}

.psmc-basket-table img {
    vertical-align: middle;
    margin-left: 5px;
}

.psmc-remove-item {
    color: #dc3545;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}
.psmc-remove-item:hover { color: #a71d2a; }

.basket-change-up { color: #0fa709; }
.basket-change-down { color: #fa3333; }
.basket-change-none { color: #555; }

/* =========================================
   5. تنسيقات العنوان (Header)
   ========================================= */
.psmc-header-section {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
}

.psmc-main-title {
    font-size: 22px;
    font-weight: 800;
    color: #333;
    margin: 0 0 20px 0;
    line-height: 1.3;
}
.psmc-main-title span { color: #d4af37; }

.psmc-main-desc {
    font-size: 14px;
    color: #666;
    margin: 0 auto;
    line-height: 1.6;
    max-width: 90%;
}

.psmc-header-section:empty { display: none; margin: 0; border: none; }



/* =========================================
   4. التحكم في أحجام الصور (Image Sizing Control)
   ========================================= */

/* -----------------------------------------
   أولاً: أيقونات المعادن (الذهب والفضة)
   ----------------------------------------- */
/* 1. داخل الزر (بعد الاختيار) */
#psmc-metal-select img {
    height: 18px !important;   /* الارتفاع */
    margin: 3px 0px 0px 0px;
}

/* 2. داخل القائمة المنسدلة (عند الاختيار) */
#psmc-metal-list img {
    width: 28px !important;    /* يمكن جعلها أكبر قليلاً في القائمة */
    height: 28px !important;
}
div#psmc-country-flag {
    margin: 0px 0px 0px 5px;
}
/* -----------------------------------------
   ثانياً: أعلام الدول
   ----------------------------------------- */
/* 1. العلم داخل الزر (بجانب اسم الدولة المختار) */
#psmc-country-select img {
    width: 23px !important;    /* الأعلام تحتاج عرض أكبر لتظهر تفاصيلها */
    height: auto !important;   /* الارتفاع تلقائي للحفاظ على الأبعاد */
}

/* 2. الأعلام داخل القائمة المنسدلة */
#psmc-country-list img {
    width: 24px !important;
    height: auto !important;
}

/* -----------------------------------------
   ثالثاً: مؤشرات التغيير (الأسهم - ارتفاع/هبوط)
   ----------------------------------------- */
/* السهم الذي يظهر أسفل السعر النهائي */
#psmc-change-indicator img {
    width: 18px !important;    /* حجم صغير ومناسب */
    height: 18px !important;
    margin-bottom: 3px !important; /* ضبط المحاذاة مع النص */
}

/* -----------------------------------------
   رابعاً: أيقونات سلة المحفظة (الجدول)
   ----------------------------------------- */
/* الأيقونات داخل الجدول (ذهب/فضة) */
.psmc-basket-table img {
    width: 20px !important;
    height: 20px !important;
    margin-left: 5px !important;
}

/* -----------------------------------------
   خامساً: تحكم خاص جداً (مثلاً الذهب فقط)
   ----------------------------------------- */
/* إذا أردت تكبير أيقونة الذهب فقط دون الفضة استخدم هذا */
img[alt="gold"] {
    /* width: 30px !important; */ 
}

/* =========================================
   6. التجاوب (Mobile Responsive)
   ========================================= */
@media (max-width: 600px) {
    .psmc-selectors-container {
        flex-direction: column; /* الحقول تحت بعض في الموبايل */
        gap: 10px;
    }
    
    .psmc-input-group {
        width: 100%;
        min-width: 100%;
    }
}