@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');

:root {
    --primary-font: 'Roboto Mono', monospace;
    --arabic-font: 'Cairo', sans-serif;
    --animation-speed: 0.3s;
}

body {
    font-family: var(--primary-font);
    transition: all var(--animation-speed);
}

/* RTL Support */
[dir="rtl"] body {
    font-family: var(--arabic-font);
}

[dir="rtl"] .space-x-2 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 1;
}

[dir="rtl"] .ml-2 {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a202c;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Pulse animation for active signals */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px rgba(72, 187, 120, 0.3); }
    50% { box-shadow: 0 0 20px rgba(72, 187, 120, 0.6); }
}

@keyframes slideIn {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.active-pulse {
    animation: pulse 2s infinite;
}

.trade-glow {
    animation: glow 2s infinite;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Responsive grid improvements */
@media (max-width: 1024px) {
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }
    
    main {
        padding: 0.5rem;
    }
}

/* Chart container styles */
.chart-container {
    position: relative;
    width: 100%;
    height: 400px;
}

/* Language toggle button */
.lang-toggle {
    transition: all 0.2s ease;
    cursor: pointer;
}

.lang-toggle:hover {
    transform: scale(1.05);
}

/* API status indicator */
.api-connected {
    position: relative;
    padding-left: 20px;
}

.api-connected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #48bb78;
    animation: pulse 2s infinite;
}

.api-disconnected::before {
    background: #f56565;
}

/* Dark/Light theme transitions */
.theme-transition {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* Loading spinner */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #4a5568;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    background: #2d3748;
    color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

[dir="rtl"] .toast {
    right: auto;
    left: 20px;
}

.toast.success {
    border-left: 4px solid #48bb78;
}

.toast.error {
    border-left: 4px solid #f56565;
}

.toast.warning {
    border-left: 4px solid #ed8936;
}