/* ===== COMPONENT STYLES ===== */

/* TradingView-style Animations */
@keyframes rise {
    0% { 
        transform: translateY(4px); 
        opacity: 0; 
    }
    100% { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

@keyframes fall {
    0% { 
        transform: translateY(-4px); 
        opacity: 0; 
    }
    100% { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

@keyframes tick-update {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.animate-rise { 
    animation: rise 0.4s ease-out; 
}

.animate-fall { 
    animation: fall 0.4s ease-out; 
}

.animate-tick-update {
    animation: tick-update 0.5s ease-in-out;
}

/* Gradient Text Effects */
.gradient-text-positive {
    background: linear-gradient(135deg, #4ade80, #84cc16);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.gradient-text-negative {
    background: linear-gradient(135deg, #f87171, #fb7185);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.gradient-text-neutral {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Chart Container Styles */
.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.chart-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
}

.chart-container[data-symbol-type="stock"] .chart-title::before {
    background: #10b981; /* Green for stocks */
}

.chart-container[data-symbol-type="crypto"] .chart-title::before {
    background: #f59e0b; /* Orange for crypto */
}

/* Symbol Type Badges */
.symbol-type-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.symbol-type-badge.stock {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.symbol-type-badge.crypto {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Analysis Card Type Styling */
.analysis-card.stock-analysis {
    border-left: 4px solid #10b981;
}

.analysis-card.crypto-analysis {
    border-left: 4px solid #f59e0b;
}

.analysis-card.stock-analysis .analysis-card-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.analysis-card.crypto-analysis .analysis-card-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* Tooltip Styling */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: tooltipFadeIn 0.2s ease-out;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Enhanced Change Indicator Styling */
.change-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    letter-spacing: 0.025em;
}

.change-indicator span {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.change-indicator span:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

/* Header Components */
.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.brand-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-surface);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.live-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.theme-toggle-btn {
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.theme-toggle-btn:hover {
    background: var(--bg-card);
}

.theme-toggle-btn i {
    width: 20px;
    height: 20px;
}

/* Section Headers */
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.section-header i {
    stroke-width: 2;
}

/* Enhanced Section Headers (for main sections) */
.section-header.enhanced {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 20px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.section-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.section-icon i {
    width: 20px;
    height: 20px;
}

.section-info {
    display: flex;
    flex-direction: column;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.section-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Market Tabs */
.market-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.market-tab {
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.market-tab:hover {
    background: var(--bg-surface);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.market-tab.active {
    background: var(--bg-surface);
    color: var(--text);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.market-tab i {
    width: 16px;
    height: 16px;
}

/* Enhanced Cards */
.enhanced-card {
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInUp 0.6s ease-out;
}

.enhanced-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%, rgba(255,255,255,0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.enhanced-card:hover::before {
    opacity: 1;
}

.enhanced-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.enhanced-card:hover .card-icon {
    transform: scale(1.1) rotate(5deg);
    background: rgba(255, 255, 255, 0.25);
}

.card-title {
    font-size: 0.875rem;
    font-weight: 600;
    opacity: 0.9;
    margin: 0;
    letter-spacing: 0.025em;
}

.card-value {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 12px 0 8px 0;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-description {
    font-size: 0.75rem;
    opacity: 0.8;
    margin: 0;
    font-weight: 500;
}

.card-change {
    position: absolute;
    top: 16px;
    right: 16px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-change.positive {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

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

/* Market Sections */
.market-section {
    animation: fadeInUp 0.5s ease-out;
}

/* Sortable Sections */
.sortable-section {
    cursor: grab;
    margin-bottom: 20px;
}

.sortable-section.dragging {
    opacity: 0.5;
}

.placeholder {
    border: 2px dashed #aaa;
    height: 50px;
    margin-bottom: 20px;
    border-radius: 8px;
}

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

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

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

/* Nav Link Enhancements */
.nav-link {
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link.active {
    background: var(--bg-surface);
    color: var(--text);
}

.nav-link:hover {
    background: var(--bg-surface);
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .header-left {
        width: 100%;
    }
    
    .nav-link {
        flex: 1;
        justify-content: center;
    }
    
    .market-tabs {
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}
