/* Professional Trading Chart - Enhanced UI */

.trading-chart-container {
    background: linear-gradient(180deg, #0d0e14 0%, #1a1d29 100%);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(79, 70, 229, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

/* Animated background pattern */
.trading-chart-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 119, 198, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 100%, rgba(79, 70, 229, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

/* Chart Header with Glassmorphism */
.chart-header {
    padding: 24px 28px;
    background: rgba(13, 14, 20, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 10;
}

.symbol-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.symbol-pair {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Enhanced Crypto Icons */
.crypto-icons {
    display: flex;
    position: relative;
}

.crypto-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    border: 3px solid #0d0e14;
    position: relative;
    animation: float 6s ease-in-out infinite;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(255, 255, 255, 0.1);
}

.crypto-icon.bitcoin {
    background: linear-gradient(135deg, #ff9500 0%, #ffb143 100%);
    color: white;
    z-index: 2;
    animation-delay: 0s;
}

.crypto-icon.tether {
    background: linear-gradient(135deg, #26d0a8 0%, #50e3c2 100%);
    color: white;
    margin-left: -12px;
    animation-delay: 0.5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

/* Symbol Text with Gradient */
.symbol-text {
    font-size: 18px;
    font-weight: 600;
    background: linear-gradient(90deg, #ffffff 0%, #a8a8b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 4px 20px rgba(102, 126, 234, 0.6); }
}

/* Price Display with Animation */
.price-info {
    display: flex;
    align-items: baseline;
    gap: 20px;
    flex-wrap: wrap;
}

.current-price {
    font-size: 42px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -1px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
    animation: priceGlow 3s ease-in-out infinite;
}

@keyframes priceGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.2); }
    50% { text-shadow: 0 0 40px rgba(255, 255, 255, 0.3); }
}

.price-currency {
    font-size: 16px;
    font-weight: 600;
    color: #7f8489;
    text-transform: uppercase;
    margin-left: -16px;
    letter-spacing: 1px;
}

/* Animated Price Changes */
.price-change {
    font-size: 24px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.price-change.positive {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    animation: greenPulse 2s infinite;
}

.price-change.negative {
    color: #ff3366;
    background: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 20px rgba(255, 51, 102, 0.2);
    animation: redPulse 2s infinite;
}

@keyframes greenPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.2); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.4); }
}

@keyframes redPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 51, 102, 0.2); }
    50% { box-shadow: 0 0 30px rgba(255, 51, 102, 0.4); }
}

.price-change-percent {
    font-size: 24px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.price-change-percent.positive {
    color: #00ff88;
}

.price-change-percent.negative {
    color: #ff3366;
}

.period-label {
    font-size: 14px;
    color: #7f8489;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Time Intervals */
.time-intervals {
    display: flex;
    gap: 6px;
    padding: 12px 28px;
    background: rgba(13, 14, 20, 0.6);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
    z-index: 10;
}

.interval-btn {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: #7f8489;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.interval-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 10px;
}

.interval-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    color: #ffffff;
    border-color: rgba(102, 126, 234, 0.3);
}

.interval-btn:hover::before {
    opacity: 0.1;
}

.interval-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #ffffff !important;
    box-shadow: 
        0 2px 10px rgba(102, 126, 234, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
    position: relative;
    z-index: 1;
}

.interval-btn.active::before {
    opacity: 0; /* Don't show the overlay on active */
}

/* Chart Container with Enhanced Styling */
.chart-main {
    height: 600px;
    min-height: 600px;
    background: linear-gradient(180deg, rgba(13, 14, 20, 0.9) 0%, rgba(26, 29, 41, 0.9) 100%);
    position: relative;
    z-index: 5;
}

#chart-container {
    width: 100%;
    height: 100%;
    min-height: 600px;
    position: relative;
}

/* Chart grid overlay effect */
.chart-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.01) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 1;
}

/* Loading Animation */
.chart-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
    color: #7f8489;
}

.chart-spinner {
    width: 60px;
    height: 60px;
    position: relative;
    margin-bottom: 20px;
}

.chart-spinner::before,
.chart-spinner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 3px solid transparent;
}

.chart-spinner::before {
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

.chart-spinner::after {
    border-bottom-color: #764ba2;
    animation: spin 1.5s linear infinite reverse;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.chart-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 600px;
    color: #ff3366;
    font-size: 16px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .chart-header {
        padding: 20px 24px;
    }
    
    .current-price {
        font-size: 32px;
    }
    
    .price-change,
    .price-change-percent {
        font-size: 18px;
    }
    
    .time-intervals {
        padding: 12px 24px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .interval-btn {
        padding: 5px 10px;
        font-size: 11px;
        white-space: nowrap;
    }
    
    .chart-main {
        height: 500px;
        min-height: 500px;
    }
    
    #chart-container {
        min-height: 500px;
    }
}

@media (max-width: 480px) {
    .crypto-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    
    .symbol-text {
        font-size: 16px;
    }
    
    .current-price {
        font-size: 28px;
    }
    
    .price-change,
    .price-change-percent {
        font-size: 16px;
    }
    
    .chart-main {
        height: 400px;
        min-height: 400px;
    }
    
    #chart-container {
        min-height: 400px;
    }
}

/* Chart Tools Panel */
.chart-tools {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

.tool-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 14, 20, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #7f8489;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-btn:hover {
    background: rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.5);
    color: #ffffff;
    transform: scale(1.1);
}

.tool-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: #ffffff;
}

/* Custom scrollbar */
.time-intervals::-webkit-scrollbar {
    height: 6px;
}

.time-intervals::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.time-intervals::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 3px;
}

.time-intervals::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #764ba2 0%, #667eea 100%);
}

/* Ensure main chart container is properly sized */
#trading-chart-container {
    width: 100%;
    min-height: 700px;
    display: block;
}