:root {
    --primary: #5c53be;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #ebddea;
    --dark: #343a40;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* الهيدر */
header {
    background: linear-gradient(to bottom, #5c53be, hsla(224, 67%, 98%, 0.95));
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}

h1 {
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.subtitle {
    opacity: 0.9;
    font-size: 1rem;
}

/* التبويبات */
.tabs {
    display: flex;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tab {
    flex: 1;
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 1rem;
    border-bottom: 3px solid transparent;
}

.tab:hover {
    background: #f8f9fa;
}

.tab.active {
    background: linear-gradient(to bottom, #5c53be, hsla(224, 67%, 98%, 0.95));
    color: white;
    border-bottom: 3px solid var(--warning);
}

/* محتوى التبويبات */
.tab-content {
    display: none;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* بطاقات الملخص */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    text-align: center;
    border-left: 4px solid var(--primary);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

.card h3 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

.card .value {
    font-size: 1.6rem;
    font-weight: bold;
    margin: 8px 0;
}

.card .sub-value {
    font-size: 0.85rem;
    color: #888;
}

/* الألوان للمؤشرات */
.profit { color: var(--success); }
.loss { color: var(--danger); }
.neutral { color: var(--warning); }
.active-status { color: var(--info); }

/* الفلاتر */
.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    font-size: 0.9rem;
    min-width: 150px;
}

/* الجدول */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: linear-gradient(to bottom, #5c53be, hsla(224, 67%, 98%, 0.95));
    color: white;
}

th {
    padding: 15px 12px;
    text-align: right;
    font-weight: 600;
    font-size: 0.9rem;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    text-align: right;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

/* بطاقات الإستراتيجيات */
.strategy-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.strategy-card {
    background: linear-gradient(135deg, #fff, #f8f9fa);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    border-top: 4px solid var(--primary);
}

.strategy-card h3 {
    color: var(--primary);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.strategy-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.stat-item {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: bold;
    margin: 5px 0;
}

.stat-label {
    font-size: 0.8rem;
    color: #666;
}

/* الأزرار والإجراءات */
.btn {
    padding: 8px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s;
}

.btn-view {
    background: linear-gradient(to bottom, #5c53be);
    color: white;
}

.btn-view:hover {
    background: #b8b1ff;
}

/* التجاوب مع الشاشات الصغيرة */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .summary-cards {
        grid-template-columns: 1fr;
    }
    
    .filters {
        flex-direction: column;
    }
    
    th, td {
        padding: 8px 6px;
        font-size: 0.8rem;
    }
    
    .strategy-cards {
        grid-template-columns: 1fr;
    }
    
    .strategy-stats {
        grid-template-columns: 1fr;
    }
}

/* شريط التحميل */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* تحسينات الفوتر */
.footer {
    background: linear-gradient(to bottom, #5c53be, hsla(224, 67%, 98%, 0.95));
    color: white;
    padding: 1.5rem; /* نفس padding الهيدر = 24px */
    border-radius: 15px;
    margin-top: 25px; /* نفس margin الهيدر لكن من الأعلى */
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
    width: 100%;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.footer a {
    color: #4338ca;
    text-decoration: none;
    font-weight: bold;
}

.footer a:hover {
    color: #6366f1;
    text-decoration: underline;
}

.footer p {
    color: #6b7280;
    margin: 0;
}

/* تحسينات إضافية للصفحة */
.container {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
}

.tab-content {
    flex: 1;
}

/* تحسينات للشاشات الصغيرة */
@media (max-width: 768px) {
    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .footer {
        border-radius: 0;
        margin-top: 20px;
        padding: 15px;
    }
    
    .container {
        padding: 15px;
    }
}

/* تأكد من أن الهيدر والحاوية الرئيسية لها نفس العرض */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* للشاشات الكبيرة جداً */
@media (min-width: 1400px) {
    .container, .footer-container {
        max-width: 1200px;
    }
}
