/* ملف CSS للواجهة الأمامية لبوت التداول */

/* المتغيرات العامة */
:root {
    --binance-primary: #f0b90b;
    --binance-secondary: #1e2329;
    --binance-success: #0ecb81;
    --binance-danger: #f6465d;
    --binance-warning: #fcd535;
    --binance-info: #1890ff;
    --binance-light: #f8f9fa;
    --binance-dark: #212529;
    --binance-border: #eaecef;
    --binance-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --binance-radius: 8px;
    --binance-transition: all 0.3s ease;
}

/* إعادة تعيين الأنماط */
.binance-bot-container * {
    box-sizing: border-box;
}

.binance-bot-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    direction: rtl;
    text-align: right;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--binance-light);
    border-radius: var(--binance-radius);
    box-shadow: var(--binance-shadow);
}

/* شريط التحكم العلوي */
.bot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--binance-radius);
    box-shadow: var(--binance-shadow);
}

.bot-title h2 {
    margin: 0 0 5px 0;
    color: var(--binance-secondary);
    font-size: 24px;
    font-weight: 600;
}

.bot-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    transition: var(--binance-transition);
}

.status-indicator.running {
    background: var(--binance-success);
    animation: pulse 2s infinite;
}

.status-indicator.stopped {
    background: var(--binance-danger);
}

.status-indicator.loading {
    background: var(--binance-warning);
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

.bot-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* الأزرار */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--binance-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--binance-transition);
    text-decoration: none;
    background: white;
    color: var(--binance-secondary);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--binance-primary);
    color: white;
}

.btn-success {
    background: var(--binance-success);
    color: white;
}

.btn-danger {
    background: var(--binance-danger);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    padding: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--binance-border);
    cursor: pointer;
    transition: var(--binance-transition);
}

.btn-icon:hover {
    background: var(--binance-light);
    border-color: var(--binance-primary);
}

/* لوحة الإعدادات السريعة */
.quick-settings {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: var(--binance-radius);
    box-shadow: var(--binance-shadow);
    border-right: 4px solid var(--binance-primary);
}

.settings-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--binance-secondary);
    white-space: nowrap;
}

/* الشبكة الرئيسية */
.bot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

/* الويدجت */
.widget {
    background: white;
    border-radius: var(--binance-radius);
    box-shadow: var(--binance-shadow);
    overflow: hidden;
    transition: var(--binance-transition);
}

.widget:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--binance-light);
    border-bottom: 1px solid var(--binance-border);
}

.widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--binance-secondary);
}

.widget-actions {
    display: flex;
    gap: 5px;
}

.widget-content {
    padding: 20px;
}

/* معلومات السوق */
.price-display {
    text-align: center;
    margin-bottom: 20px;
}

.current-price {
    font-size: 32px;
    font-weight: 700;
    color: var(--binance-secondary);
    margin-bottom: 5px;
}

.price-currency {
    font-size: 18px;
    color: #666;
    margin-right: 5px;
}

.price-change {
    font-size: 16px;
    font-weight: 600;
}

.price-change.positive {
    color: var(--binance-success);
}

.price-change.negative {
    color: var(--binance-danger);
}

.market-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--binance-light);
    border-radius: var(--binance-radius);
}

.stat-label {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.stat-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--binance-secondary);
}

/* الأرصدة */
.balance-list {
    max-height: 300px;
    overflow-y: auto;
}

.balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--binance-border);
}

.balance-item:last-child {
    border-bottom: none;
}

.asset-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.asset-symbol {
    font-weight: 600;
    color: var(--binance-secondary);
}

.balance-amounts {
    text-align: center;
}

.amount-free {
    font-weight: 600;
    color: var(--binance-secondary);
}

.amount-locked {
    font-size: 12px;
    color: #666;
}

.balance-value {
    text-align: left;
}

.usd-value {
    font-size: 12px;
    color: #666;
}

/* نموذج الأمر */
.order-tabs {
    display: flex;
    margin-bottom: 20px;
    border-radius: var(--binance-radius);
    overflow: hidden;
    border: 1px solid var(--binance-border);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: white;
    cursor: pointer;
    transition: var(--binance-transition);
    font-weight: 500;
}

.tab-btn.active {
    background: var(--binance-primary);
    color: white;
}

.tab-btn[data-side="BUY"].active {
    background: var(--binance-success);
}

.tab-btn[data-side="SELL"].active {
    background: var(--binance-danger);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 500;
    color: var(--binance-secondary);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--binance-border);
    border-radius: var(--binance-radius);
    font-size: 14px;
    transition: var(--binance-transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--binance-primary);
    box-shadow: 0 0 0 2px rgba(240, 185, 11, 0.2);
}

.quantity-helpers {
    display: flex;
    gap: 5px;
    margin-top: 8px;
}

.btn-helper {
    flex: 1;
    padding: 6px;
    border: 1px solid var(--binance-border);
    background: white;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--binance-transition);
}

.btn-helper:hover {
    background: var(--binance-light);
    border-color: var(--binance-primary);
}

.order-summary {
    margin: 15px 0;
    padding: 15px;
    background: var(--binance-light);
    border-radius: var(--binance-radius);
}

.summary-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-item:last-child {
    margin-bottom: 0;
    font-weight: 600;
    color: var(--binance-secondary);
}

/* الأوامر والتاريخ */
.orders-table,
.history-table {
    max-height: 400px;
    overflow-y: auto;
}

.order-row,
.history-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--binance-border);
}

.order-row:last-child,
.history-row:last-child {
    border-bottom: none;
}

.order-info,
.history-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-symbol,
.history-symbol {
    font-weight: 600;
    color: var(--binance-secondary);
}

.order-side,
.history-side {
    font-size: 12px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}

.order-side.BUY,
.history-side.BUY {
    background: rgba(14, 203, 129, 0.1);
    color: var(--binance-success);
}

.order-side.SELL,
.history-side.SELL {
    background: rgba(246, 70, 93, 0.1);
    color: var(--binance-danger);
}

.order-details,
.history-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.order-actions {
    display: flex;
    gap: 5px;
}

/* إحصائيات الأداء */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-card {
    text-align: center;
    padding: 20px;
    background: var(--binance-light);
    border-radius: var(--binance-radius);
    transition: var(--binance-transition);
}

.stat-card:hover {
    background: #e9ecef;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--binance-secondary);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    font-weight: 500;
}

/* النوافذ المنبثقة */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--binance-radius);
    max-width: 400px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--binance-border);
}

.modal-header h3 {
    margin: 0;
    color: var(--binance-secondary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--binance-border);
}

/* الإشعارات */
.notifications {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: var(--binance-radius);
    box-shadow: var(--binance-shadow);
    margin-bottom: 10px;
    padding: 15px;
    border-right: 4px solid var(--binance-info);
    animation: slideIn 0.3s ease;
}

.notification.success {
    border-right-color: var(--binance-success);
}

.notification.error {
    border-right-color: var(--binance-danger);
}

.notification.warning {
    border-right-color: var(--binance-warning);
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* حالات التحميل */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--binance-border);
    border-top: 2px solid var(--binance-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .binance-bot-container {
        padding: 10px;
    }
    
    .bot-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .bot-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .bot-grid {
        grid-template-columns: 1fr;
    }
    
    .settings-row {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .setting-group {
        justify-content: space-between;
    }
    
    .market-stats {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .order-row,
    .history-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .order-details,
    .history-details {
        text-align: right;
    }
    
    .notifications {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .current-price {
        font-size: 24px;
    }
    
    .price-currency {
        font-size: 14px;
    }
    
    .widget-content {
        padding: 15px;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .btn {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* الثيمات */
.binance-bot-container[data-theme="dark"] {
    --binance-light: #2b3139;
    --binance-secondary: #f8f9fa;
    --binance-border: #3c4043;
    background: #1e2329;
    color: #f8f9fa;
}

.binance-bot-container[data-theme="dark"] .widget {
    background: #2b3139;
    color: #f8f9fa;
}

.binance-bot-container[data-theme="dark"] .widget-header {
    background: #3c4043;
}

.binance-bot-container[data-theme="dark"] .form-control {
    background: #3c4043;
    border-color: #5a5d63;
    color: #f8f9fa;
}

.binance-bot-container[data-theme="dark"] .btn {
    background: #3c4043;
    color: #f8f9fa;
}

/* تحسينات إضافية */
.widget.market-info {
    grid-column: span 2;
}

.widget.order-form {
    grid-row: span 2;
}

@media (max-width: 768px) {
    .widget.market-info {
        grid-column: span 1;
    }
    
    .widget.order-form {
        grid-row: span 1;
    }
}

