/* ==================== ROOT VARIABLES ==================== */

:root {
    /* Dark Theme (Default) */
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-primary: #3b82f6;
    --accent-secondary: #8b5cf6;
    --border-color: rgba(75, 85, 99, 0.3);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: rgba(209, 213, 219, 0.5);
}

[data-theme="blue"] {
    --bg-primary: #0c1829;
    --bg-secondary: #162844;
    --bg-tertiary: #1e3a5f;
    --accent-primary: #60a5fa;
    --accent-secondary: #3b82f6;
}

[data-theme="purple"] {
    --bg-primary: #1a0f2e;
    --bg-secondary: #2d1b4e;
    --bg-tertiary: #3f2a5f;
    --accent-primary: #a78bfa;
    --accent-secondary: #8b5cf6;
}

/* ==================== GLOBAL STYLES ==================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.5);
}

/* ==================== ANIMATIONS ==================== */

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
}

.animate-slideIn {
    animation: slideInRight 0.3s ease-out;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--accent-primary);
    border-radius: 50%;
    animation: pulse 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

/* ==================== NAVIGATION ==================== */

.nav-item {
    position: relative;
    text-align: left;
}

.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
}

/* ==================== CHAT MESSAGES ==================== */

.message {
    animation: fadeIn 0.3s ease-out;
}

.message-user {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.message-content {
    max-width: 70%;
    padding: 16px;
    border-radius: 16px;
    line-height: 1.6;
}

.message-user .message-content {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-assistant .message-content {
    background: rgba(55, 65, 81, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-user .message-avatar {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.message-assistant .message-avatar {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.message-actions button {
    padding: 6px 12px;
    background: rgba(55, 65, 81, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.message-actions button:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* ==================== CARDS ==================== */

.market-card {
    background: linear-gradient(135deg, rgba(31, 41, 55, 0.5) 0%, rgba(31, 41, 55, 0.3) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.market-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

/* ==================== BUTTONS ==================== */

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: rgba(55, 65, 81, 0.5);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 500;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ==================== FORMS ==================== */

input, textarea, select {
    background: rgba(55, 65, 81, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

/* ==================== CHARTS ==================== */

.chart-container {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    height: 400px;
}

/* ==================== TOAST NOTIFICATIONS ==================== */

.toast {
    background: rgba(31, 41, 55, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    min-width: 300px;
}

.toast.success {
    border-left: 4px solid #10b981;
}

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

.toast.info {
    border-left: 4px solid #3b82f6;
}

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

/* ==================== LOADING STATES ==================== */

.skeleton {
    background: linear-gradient(90deg, rgba(55, 65, 81, 0.3) 25%, rgba(75, 85, 99, 0.3) 50%, rgba(55, 65, 81, 0.3) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* ==================== BADGES ==================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

/* ==================== MODAL ==================== */

.modal-backdrop {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideInRight 0.3s ease-out;
}

/* ==================== UTILITIES ==================== */

.gradient-text {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass {
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .message-content {
        max-width: 85%;
    }
    
    .toast {
        min-width: auto;
        max-width: calc(100vw - 48px);
    }
}

/* ==================== CUSTOM CHECKBOX ==================== */

.custom-checkbox {
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.custom-checkbox:checked {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    border-color: var(--accent-primary);
}

.custom-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
}

/* ==================== PROGRESS BAR ==================== */

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(55, 65, 81, 0.5);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* ==================== CODE BLOCKS ==================== */

code {
    background: rgba(55, 65, 81, 0.5);
    padding: 2px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
}

pre {
    background: rgba(31, 41, 55, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

pre code {
    background: transparent;
    padding: 0;
}
