/* ملف التنسيقات الخاص بنتائج التحليل */
/* analysis-results.css */

/* حاوي النتائج الرئيسي */
.analysis-results-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* بطاقة النتائج */
.results-card-modern {
    background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 100%);
    border-radius: 30px;
    padding: 40px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    position: relative;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    animation: slideUp 0.5s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* تحسينات خاصة للموبايل */
.results-card-modern.mobile-optimized {
    max-width: 95vw;
    max-height: 95vh;
    padding: 25px 20px;
    border-radius: 20px;
    margin: 10px;
    animation: slideUpMobile 0.4s ease;
}

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

@keyframes slideUpMobile {
    from {
        transform: translateY(30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* إطار متوهج */
.results-card-modern::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #00ff88, #ff00aa, #00ff88);
    border-radius: inherit;
    z-index: -1;
    opacity: 0.5;
    filter: blur(10px);
    animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
}

/* زر الإغلاق */
.close-results {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
}

.close-results:hover,
.close-results:active {
    background: rgba(255, 0, 85, 0.8);
    transform: rotate(90deg) scale(1.1);
}

/* رأس البطاقة */
.results-header {
    text-align: center;
    margin-bottom: 25px;
    padding-top: 10px;
}

.results-title {
    font-size: 24px;
    font-weight: 700;
    background: linear-gradient(45deg, #00ff88, #ff00aa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 8px 0;
    font-family: 'Cairo', sans-serif;
    line-height: 1.2;
}

.results-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
    font-family: 'Cairo', sans-serif;
    margin: 0;
}

/* حاوي الإحصائيات */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

/* عنصر الإحصائية */
.stat-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 15px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

/* ترتيب العناصر */
.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    color: #ffffff;
}

.stat-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.stat-percentage {
    font-size: 26px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    flex-shrink: 0;
}

/* شريط التقدم */
.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    border-radius: 8px;
    position: relative;
    width: 0%;
    transition: width 0.8s ease-out;
}

/* تأثير التموج على شريط التقدم */
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ألوان الاتجاهات */
.stat-bullish .stat-percentage {
    color: #00ff88;
}

.stat-bullish .progress-fill {
    background: linear-gradient(90deg, #00ff88, #00cc6a);
}

.stat-bearish .stat-percentage {
    color: #ff0055;
}

.stat-bearish .progress-fill {
    background: linear-gradient(90deg, #ff0055, #cc0044);
}

.stat-sideways .stat-percentage {
    color: #ffaa00;
}

.stat-sideways .progress-fill {
    background: linear-gradient(90deg, #ffaa00, #cc8800);
}

/* قسم التوصية */
.recommendation-section {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.recommendation-title {
    color: #00ff88;
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Cairo', sans-serif;
}

.recommendation-text {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    line-height: 1.5;
    font-family: 'Cairo', sans-serif;
    margin: 0;
}

/* أزرار الإجراءات */
.actions-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 15px;
}

.action-btn {
    padding: 12px 20px;
    border-radius: 25px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Cairo', sans-serif;
    flex: 1;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* حد أدنى للمس */
}

.btn-share {
    background: linear-gradient(45deg, #00ff88, #00cc6a);
    color: #000;
}

.btn-share:hover,
.btn-share:active {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 255, 136, 0.4);
}

.btn-new-analysis {
    background: transparent;
    color: #00ff88;
    border: 2px solid #00ff88;
}

.btn-new-analysis:hover,
.btn-new-analysis:active {
    background: #00ff88;
    color: #000;
    transform: translateY(-2px);
}

/* معرف التحليل */
.analysis-id {
    text-align: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-family: 'Cairo', sans-serif;
}

.analysis-id span {
    color: rgba(0, 255, 136, 0.8);
    font-weight: 600;
}

/* Canvas للمشاركة (مخفي) */
#shareCanvas {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* شريط التحميل للمشاركة */
.sharing-loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 25px;
    border-radius: 15px;
    z-index: 10001;
    text-align: center;
    color: #fff;
    backdrop-filter: blur(10px);
}

.sharing-loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 136, 0.3);
    border-top: 3px solid #00ff88;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sharing-loader-text {
    font-size: 14px;
    font-family: 'Cairo', sans-serif;
}

/* تحسينات للجوال */
@media (max-width: 768px) {
    .analysis-results-container {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .results-card-modern {
        margin-top: 0;
        max-height: calc(100vh - 40px);
    }

    .results-title {
        font-size: 20px;
    }

    .results-subtitle {
        font-size: 13px;
    }

    .stat-label {
        font-size: 14px;
    }

    .stat-percentage {
        font-size: 22px;
    }

    .stat-icon {
        font-size: 18px;
    }

    .actions-container {
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }

    .recommendation-title {
        font-size: 15px;
    }

    .recommendation-text {
        font-size: 13px;
    }

    .close-results {
        width: 36px;
        height: 36px;
        font-size: 16px;
        top: 12px;
        right: 12px;
    }
}

/* تحسينات للشاشات الصغيرة جداً */
@media (max-width: 400px) {
    .analysis-results-container {
        padding: 5px;
    }

    .results-card-modern {
        padding: 20px 15px;
        border-radius: 15px;
        max-height: calc(100vh - 10px);
    }

    .results-card-modern.mobile-optimized {
        padding: 20px 15px;
    }

    .results-title {
        font-size: 18px;
    }

    .stat-percentage {
        font-size: 20px;
    }

    .recommendation-text {
        font-size: 12px;
    }

    .action-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .stat-item {
        padding: 12px;
    }

    .recommendation-section {
        padding: 12px;
    }
}

/* تحسين التمرير للموبايل */
@media (max-width: 768px) {
    .analysis-results-container {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }

    .results-card-modern {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
}

/* تحسين الأداء للحركات */
.stat-item,
.action-btn,
.close-results {
    will-change: transform;
}

/* إزالة التأثيرات المتقدمة على الأجهزة الضعيفة */
@media (prefers-reduced-motion: reduce) {
    .results-card-modern::before {
        animation: none;
    }

    .progress-fill::after {
        animation: none;
    }

    .sharing-loader-spinner {
        animation: none;
        border: 3px solid #00ff88;
    }
}

/* تأثيرات إضافية */
.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* إخفاء شريط التمرير */
.analysis-results-container {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.analysis-results-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

.results-card-modern {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.results-card-modern::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* تحسين الطباعة */
@media print {
    .analysis-results-container {
        position: static;
        background: white;
        color: black;
    }

    .results-card-modern {
        box-shadow: none;
        background: white;
        color: black;
    }

    .close-results {
        display: none;
    }
}