/* ==========================================================================
   تنسيق واجهة نظام التشخيص المقارن المحلي المطور - Smart Radiology Report System
   مُحسّن بالكامل للتوافق مع الجوال والأجهزة الذكية
   ========================================================================== */

/* 1. الحاوية الرئيسية */
.ultrasound-analyzer-container { 
    max-width: 800px; 
    margin: 20px auto; 
    padding: 25px; 
    background: #ffffff; 
    border-radius: 16px; 
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05); 
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    direction: rtl; 
    text-align: right; 
    box-sizing: border-box; 
}

/* 2. الهيدر والعناوين ثنائية اللغة */
.bilingual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 12px;
    margin-bottom: 20px;
}

.bilingual-header .ar-text {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
}

.bilingual-header .en-text {
    font-size: 16px;
    font-weight: 600;
    color: #0284c7;
    direction: ltr;
}

.bilingual-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 4px;
}

.bilingual-label .ar-text {
    font-size: 15px;
    font-weight: 600;
    color: #334155;
}

.bilingual-label .en-text {
    font-size: 13px;
    color: #64748b;
    direction: ltr;
}

/* 3. الأزرار الطبية (العضو والاشتباه) */
.organ-btn, .suspect-btn { 
    display: flex; 
    justify-content: space-between;
    align-items: center;
    width: 100%; 
    padding: 16px 20px; 
    margin: 10px 0; 
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: #ffffff; 
    border: none; 
    border-radius: 12px; 
    cursor: pointer; 
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s ease;
    box-shadow: 0 4px 6px -1px rgba(2, 132, 199, 0.2);
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.organ-btn:hover, .suspect-btn:hover { 
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(2, 132, 199, 0.3);
}

.organ-btn:active, .suspect-btn:active {
    transform: translateY(0);
}

.organ-btn .ar-text, .suspect-btn .ar-text {
    font-size: 16px;
    font-weight: 700;
}

.organ-btn .en-text, .suspect-btn .en-text {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    direction: ltr;
}

/* 4. زر العودة للخلف */
.back-btn { 
    background-color: #f1f5f9; 
    color: #475569; 
    border: 1px solid #cbd5e1; 
    padding: 10px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    margin-top: 15px; 
    font-weight: 600; 
    transition: all 0.2s ease; 
    -webkit-tap-highlight-color: transparent;
}

.back-btn:hover { 
    background-color: #e2e8f0; 
    color: #0f172a; 
}

/* 5. شبكة رفع التقاطات السونار */
.dual-capture-grid { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin: 20px 0; 
}

/* 6. صناديق التقاط السونار */
.capture-box { 
    background: #0f172a; 
    padding: 18px; 
    border-radius: 12px; 
    color: #ffffff; 
    text-align: center; 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
}

.capture-box h4 { 
    margin-top: 0; 
    margin-bottom: 12px; 
    font-size: 14px; 
    color: #38bdf8; 
    border-bottom: 1px solid #1e293b; 
    padding-bottom: 8px; 
}

.capture-box input[type="file"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 6px;
    font-size: 13px;
    box-sizing: border-box;
    cursor: pointer;
}

/* 7. حاوية المعاينة والقص (دعم Cropper.js) */
.image-wrapper { 
    width: 100%; 
    min-height: 200px; 
    max-height: 380px; 
    background-color: #000000; 
    margin: 10px 0; 
    border: 2px dashed #334155; 
    position: relative; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden;
    box-sizing: border-box;
}

.image-wrapper img { 
    max-width: 100%; 
    max-height: 360px; 
    height: auto; 
    display: block;
}

.image-wrapper .cropper-container {
    direction: ltr !important; /* إصلاح سحب المقابض في بيئة RTL */
    max-width: 100% !important;
}

/* 8. أزرار الاعتماد والتشخيص وشارات النجاح */
.sonotouch-btn {
    background-color: #0284c7;
    color: #ffffff;
    padding: 12px 18px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    margin-top: 10px;
    display: none;
    width: 100%;
    transition: background-color 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.sonotouch-btn:hover {
    background-color: #0369a1;
}

.crop-success-badge {
    display: none;
    color: #4ade80;
    font-weight: bold;
    margin-top: 10px;
    font-size: 13px;
    background: rgba(34, 197, 94, 0.15);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

#submit-analysis-btn {
    width: 100%;
    padding: 16px;
    background-color: #16a34a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 20px;
    -webkit-tap-highlight-color: transparent;
}

#submit-analysis-btn:hover {
    background-color: #15803d;
}

#submit-analysis-btn:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

/* 9. منطقة التقرير الناتج */
#analysis-result-output {
    background: #f8fafc;
    padding: 20px;
    border-right: 5px solid #0284c7;
    border-left: 1px solid #e2e8f0;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 8px;
    line-height: 1.8;
    margin-top: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   📱 التنسيق المخصص للجوال والأجهزة الذكية (أقل من 640px)
   ========================================================================== */
@media (max-width: 640px) {
    .ultrasound-analyzer-container { 
        padding: 16px 12px; 
        margin: 5px auto; 
        border-radius: 12px; 
    }

    .bilingual-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding-bottom: 10px;
    }

    .bilingual-header .ar-text {
        font-size: 18px;
    }

    .bilingual-header .en-text {
        font-size: 13px;
    }

    .bilingual-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .bilingual-label .en-text {
        font-size: 12px;
    }

    .organ-btn, .suspect-btn {
        padding: 14px 16px;
    }

    .organ-btn .ar-text, .suspect-btn .ar-text {
        font-size: 15px;
    }

    .organ-btn .en-text, .suspect-btn .en-text {
        font-size: 12px;
    }

    /* تحويل شبكة الرفع إلى عمود واحد فوق بعضهما */
    .dual-capture-grid { 
        grid-template-columns: 1fr; 
        gap: 16px; 
    }

    .capture-box {
        padding: 14px;
    }

    .image-wrapper { 
        min-height: 180px; 
        max-height: 300px; 
    }

    #submit-analysis-btn {
        padding: 14px;
        font-size: 16px;
    }
}