/**
 * Dashboard V2 Styles
 * 🎯 TITAN Platform - Professional Dashboard
 * Version: 2.0.0
 * Last Updated: 2024-11-15
 */

/* ==========================================
   DASHBOARD WRAPPER
   ========================================== */
.dashboard-wrapper {
    padding: 2rem;
    max-width: 1920px;
    margin: 0 auto;
    direction: rtl;
}

/* ==========================================
   DASHBOARD HEADER
   ========================================== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-title h1 {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
    margin: 0;
}

.dashboard-subtitle {
    font-size: 1rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.dashboard-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.last-update {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #d1d5db;
}

.update-icon {
    font-size: 1rem;
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.refresh-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

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

/* ==========================================
   WIDGETS GRID
   ========================================== */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (min-width: 1024px) {
    .widgets-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1440px) {
    .widgets-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================
   DASHBOARD WIDGET (Base Styles)
   ========================================== */
.dashboard-widget {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(75, 85, 99, 0.3);
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-icon {
    font-size: 1.5rem;
}

.widget-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.widget-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.widget-action-btn {
    padding: 0.5rem;
    background: rgba(75, 85, 99, 0.3);
    border: none;
    border-radius: 0.375rem;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s ease;
}

.widget-action-btn:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.widget-content {
    margin-bottom: 1rem;
}

.widget-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(75, 85, 99, 0.3);
}

.widget-link {
    color: #60a5fa;
    font-size: 0.875rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.widget-link:hover {
    color: #3b82f6;
}

/* ==========================================
   PORTFOLIO WIDGET
   ========================================== */
.balance-section {
    text-align: center;
    margin-bottom: 1.5rem;
}

.balance-label {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.balance-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
}

.amount-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: #fff;
}

.amount-currency {
    font-size: 1.25rem;
    color: #9ca3af;
}

.change-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.change-section.change-positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.change-section.change-negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.change-indicator {
    font-size: 1.25rem;
}

.change-value {
    font-size: 1.125rem;
    font-weight: 600;
}

.change-percentage {
    font-size: 0.875rem;
}

.change-period {
    font-size: 0.75rem;
    opacity: 0.8;
}

.balance-breakdown {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
}

.breakdown-item {
    text-align: center;
}

.breakdown-label {
    display: block;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.breakdown-value {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.breakdown-divider {
    width: 1px;
    height: 2rem;
    background: rgba(75, 85, 99, 0.3);
}

.additional-changes {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.change-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.change-period-label {
    color: #9ca3af;
}

/* ==========================================
   MARKET WIDGET
   ========================================== */
.crypto-prices {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    margin-bottom: 1.5rem;
}

.price-item {
    flex: 1;
    text-align: center;
}

.price-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.crypto-symbol {
    font-size: 0.875rem;
    font-weight: 500;
    color: #9ca3af;
}

.crypto-icon {
    font-size: 1.25rem;
}

.price-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.5rem;
}

.price-change {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-size: 0.875rem;
}

.price-divider {
    width: 1px;
    background: rgba(75, 85, 99, 0.3);
    margin: 0 1rem;
}

.market-indicators {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.indicator-item {
    padding: 1rem;
    background: rgba(75, 85, 99, 0.2);
    border-radius: 0.5rem;
}

.indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.indicator-label {
    font-size: 0.875rem;
    color: #9ca3af;
}

.indicator-info {
    font-size: 0.875rem;
    color: #9ca3af;
    cursor: help;
}

.fear-greed-gauge {
    width: 100%;
}

.gauge-bar {
    width: 100%;
    height: 8px;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.gauge-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.gauge-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gauge-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
}

.gauge-label {
    font-size: 0.875rem;
    font-weight: 500;
}

.dominance-display {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dominance-percentage {
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
}

.dominance-bar {
    width: 100%;
    height: 6px;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.dominance-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 0.3s ease;
}

/* ==========================================
   SYSTEM WIDGET
   ========================================== */
.system-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-operational .status-dot { background: #10b981; }
.status-healthy .status-dot { background: #10b981; }
.status-warning .status-dot { background: #f59e0b; }
.status-degraded .status-dot { background: #f59e0b; }
.status-error .status-dot { background: #ef4444; }
.status-down .status-dot { background: #ef4444; }
.status-unknown .status-dot { background: #6b7280; }

.status-operational { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-healthy { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.status-warning { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-degraded { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-error { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.status-down { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.status-unknown { background: rgba(107, 114, 128, 0.1); color: #9ca3af; }

.system-metrics {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(75, 85, 99, 0.2);
    border-radius: 0.5rem;
}

.metric-icon {
    font-size: 1.5rem;
}

.metric-content {
    flex: 1;
}

.metric-label {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
}

.service-health {
    padding: 1rem;
    background: rgba(75, 85, 99, 0.2);
    border-radius: 0.5rem;
}

.health-header {
    margin-bottom: 0.75rem;
}

.health-title {
    font-size: 0.875rem;
    color: #9ca3af;
}

.health-items {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.health-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(31, 41, 55, 0.5);
    border-radius: 0.375rem;
}

.health-label {
    font-size: 0.875rem;
    color: #d1d5db;
}

.health-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.health-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.health-status.healthy .health-dot { background: #10b981; }
.health-status.unhealthy .health-dot { background: #ef4444; }

.health-status.healthy { color: #10b981; }
.health-status.unhealthy { color: #ef4444; }

/* ==========================================
   CHART WIDGET
   ========================================== */
.timeframe-selector {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.timeframe-btn {
    padding: 0.375rem 0.75rem;
    background: rgba(75, 85, 99, 0.3);
    border: 1px solid transparent;
    border-radius: 0.375rem;
    color: #9ca3af;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeframe-btn:hover {
    background: rgba(75, 85, 99, 0.5);
    color: #d1d5db;
}

.timeframe-btn.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: #3b82f6;
    color: #60a5fa;
}

.chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #9ca3af;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.chart-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.chart-info-label {
    color: #9ca3af;
}

.chart-info-value {
    font-weight: 600;
    color: #fff;
}

/* ==========================================
   AI AGENTS SECTION
   ========================================== */
.ai-agents-section {
    margin-top: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-title h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #fff;
    margin: 0;
}

.section-icon {
    font-size: 1.75rem;
}

.section-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.section-stats {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 0.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.75rem;
    color: #9ca3af;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
}

.stat-value.active {
    color: #10b981;
}

.stat-divider {
    color: #6b7280;
    font-size: 1.25rem;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-footer {
    text-align: center;
}

.view-all-btn {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* ==========================================
   AGENT CARD
   ========================================== */
.agent-card {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border: 1px solid rgba(75, 85, 99, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.agent-card:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.2);
    transform: translateY(-2px);
}

.agent-card.agent-active {
    border-left: 3px solid #10b981;
}

.agent-card.agent-inactive {
    opacity: 0.7;
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.agent-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.agent-icon {
    font-size: 1.5rem;
}

.agent-name h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.agent-status {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.agent-description {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.agent-metrics {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.metric-label {
    color: #9ca3af;
}

.metric-value {
    font-weight: 600;
    color: #fff;
}

.metric-value.success { color: #10b981; }
.metric-value.warning { color: #f59e0b; }
.metric-value.danger { color: #ef4444; }
.metric-value.profit { color: #10b981; }
.metric-value.loss { color: #ef4444; }

.metric-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    margin-left: 1rem;
}

.metric-bar {
    flex: 1;
    height: 6px;
    background: rgba(75, 85, 99, 0.3);
    border-radius: 3px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
}

.agent-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid rgba(75, 85, 99, 0.3);
}

.last-active {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.last-active-icon {
    font-size: 0.875rem;
}

.agent-detail-btn {
    padding: 0.375rem 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    border-radius: 0.375rem;
    color: #60a5fa;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.agent-detail-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateX(-2px);
}

/* ==========================================
   LOADING STATES
   ========================================== */
.widget-loading-state,
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.loading-text {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* ==========================================
   ERROR STATES
   ========================================== */
.widget-error-state,
.error-state,
.dashboard-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-message {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.retry-btn {
    padding: 0.625rem 1.5rem;
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid #3b82f6;
    border-radius: 0.5rem;
    color: #60a5fa;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

/* ==========================================
   EMPTY STATES
   ========================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    text-align: center;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-message {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.5rem;
}

.empty-description {
    font-size: 0.875rem;
    color: #9ca3af;
    max-width: 400px;
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 768px) {
    .dashboard-wrapper {
        padding: 1rem;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
    }
    
    .crypto-prices {
        flex-direction: column;
        gap: 1rem;
    }
    
    .price-divider {
        width: 100%;
        height: 1px;
        margin: 1rem 0;
    }
}

/* ==========================================
   ANIMATIONS
   ========================================== */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.dashboard-widget,
.agent-card {
    animation: fadeIn 0.5s ease-out;
}

/* ==========================================
   UTILITIES
   ========================================== */
.change-positive {
    color: #10b981 !important;
}

.change-negative {
    color: #ef4444 !important;
}

/* ============================================
   HIDE OLD DASHBOARD WIDGETS
   ============================================ */

/* Hide all siblings after #dashboard-container */
#dashboard-container ~ * {
    display: none !important;
}

/* Ensure dashboard-container is visible */
#dashboard-container {
    display: block !important;
}

/* Mobile responsive improvements */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .widget {
        margin-bottom: 1rem;
    }
    
    .chart-container {
        height: 300px !important;
    }
}

@media (max-width: 640px) {
    .dashboard-header h1 {
        font-size: 1.5rem !important;
    }
    
    .widget-title {
        font-size: 1rem !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
}

/* ============================================
   SMOOTH ANIMATIONS & TRANSITIONS
   ============================================ */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Scale up animation */
@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse animation for loading */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Shimmer effect for skeleton loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Apply animations to widgets */
.dashboard-widget {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
    transition: all 0.3s ease;
}

/* Stagger animation delays */
.dashboard-widget:nth-child(1) {
    animation-delay: 0.1s;
}

.dashboard-widget:nth-child(2) {
    animation-delay: 0.2s;
}

.dashboard-widget:nth-child(3) {
    animation-delay: 0.3s;
}

.dashboard-widget:nth-child(4) {
    animation-delay: 0.4s;
}

/* Hover effects */
.dashboard-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

/* AI Agents animation */
.ai-agent-card {
    animation: slideInRight 0.5s ease-out;
    animation-fill-mode: both;
    transition: all 0.3s ease;
}

.ai-agent-card:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Stagger AI agent cards */
.ai-agent-card:nth-child(1) { animation-delay: 0.1s; }
.ai-agent-card:nth-child(2) { animation-delay: 0.15s; }
.ai-agent-card:nth-child(3) { animation-delay: 0.2s; }
.ai-agent-card:nth-child(4) { animation-delay: 0.25s; }
.ai-agent-card:nth-child(5) { animation-delay: 0.3s; }

/* Button transitions */
button, .btn, .timeframe-btn {
    transition: all 0.2s ease;
}

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

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

/* Loading skeleton shimmer */
.widget-loading-state {
    background: linear-gradient(
        90deg,
        rgba(55, 65, 81, 0.1) 25%,
        rgba(75, 85, 101, 0.2) 50%,
        rgba(55, 65, 81, 0.1) 75%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Chart animation */
#portfolio-chart {
    animation: scaleUp 0.6s ease-out;
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

/* Number count-up effect (optional, requires JS) */
.stat-value, .balance-value {
    transition: all 0.5s ease;
}

/* Icon spin on refresh */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.refreshing .widget-action-btn svg {
    animation: spin 1s linear infinite;
}

/* Success/Error flash animations */
@keyframes flashGreen {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(34, 197, 94, 0.2);
    }
}

@keyframes flashRed {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(239, 68, 68, 0.2);
    }
}

.flash-success {
    animation: flashGreen 0.6s ease;
}

.flash-error {
    animation: flashRed 0.6s ease;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   LIGHT THEME
   ============================================ */

.light-theme {
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    
    /* Text colors */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #6b7280;
    
    /* Border colors */
    --border-color: #d1d5db;
    --border-hover: #9ca3af;
    
    /* Widget backgrounds */
    --widget-bg: #ffffff;
    --widget-border: #e5e7eb;
    --widget-shadow: rgba(0, 0, 0, 0.1);
    
    /* Chart colors */
    --chart-grid: #e5e7eb;
    --chart-text: #6b7280;
}

/* Apply light theme styles */
.light-theme body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.light-theme .dashboard-widget {
    background-color: var(--widget-bg);
    border-color: var(--widget-border);
    box-shadow: 0 1px 3px var(--widget-shadow);
}

.light-theme .widget-title h3 {
    color: var(--text-primary);
}

.light-theme .stat-label,
.light-theme .chart-info-label {
    color: var(--text-secondary);
}

.light-theme .stat-value {
    color: var(--text-primary);
}

/* Navigation in light mode */
.light-theme nav {
    background-color: var(--bg-primary);
    border-bottom-color: var(--border-color);
}

/* Buttons in light mode */
.light-theme button,
.light-theme .btn {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.light-theme button:hover {
    background-color: var(--border-hover);
}

/* Theme toggle button */
.theme-toggle-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

/* Smooth theme transition */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.dashboard-widget,
button,
.nav-link {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
