/* Bajt Metal Charts - Styles */

.metalcharts-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Controls */
.metalcharts-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 15px;
}

.currency-switcher {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.currency-label {
    font-weight: 600;
    color: #333;
}

.currency-buttons {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #d4a852;
}

.currency-btn {
    padding: 8px 20px;
    border: none;
    background: #fff;
    color: #d4a852;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.currency-btn:hover {
    background: #fdf6e3;
}

.currency-btn.active {
    background: #d4a852;
    color: #fff;
}

.exchange-rate {
    color: #666;
    font-size: 0.9em;
}

.exchange-rate small {
    color: #999;
}

/* Category */
.metal-category {
    margin-bottom: 40px;
}

.category-title {
    font-size: 1.5em;
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #d4a852;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 25px;
}

@media (max-width: 480px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Chart Container */
.chart-container {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
}

.chart-container:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

/* Chart Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border-bottom: 1px solid #eee;
}

.chart-title {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.metal-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
}

.metal-code {
    font-size: 0.85em;
    color: #888;
    text-transform: uppercase;
}

.chart-price {
    text-align: right;
}

.price-value {
    font-size: 1.3em;
    font-weight: 700;
    color: #d4a852;
}

.price-value.no-data {
    color: #999;
    font-size: 1em;
    font-weight: 400;
}

.price-currency {
    font-size: 0.8em;
    font-weight: 400;
}

.price-unit {
    font-size: 0.85em;
    color: #888;
    margin-left: 3px;
}

/* Period Buttons */
.chart-period-buttons {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.period-btn {
    padding: 6px 14px;
    border: 1px solid #ddd;
    background: #fff;
    color: #666;
    font-size: 0.85em;
    font-weight: 500;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-btn:hover {
    border-color: #d4a852;
    color: #d4a852;
}

.period-btn.active {
    background: #d4a852;
    border-color: #d4a852;
    color: #fff;
}

/* Chart Wrapper */
.chart-wrapper {
    position: relative;
    height: 250px;
    background: #fafafa;
}

.chart-element {
    width: 100%;
    height: 100%;
}

.chart-loading,
.chart-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(250, 250, 250, 0.95);
    gap: 10px;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #eee;
    border-top-color: #d4a852;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.chart-loading span,
.chart-error span {
    color: #666;
    font-size: 0.9em;
}

.retry-btn {
    padding: 8px 16px;
    background: #d4a852;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.2s ease;
}

.retry-btn:hover {
    background: #c49942;
}

/* Chart Stats */
.chart-stats {
    display: flex;
    justify-content: space-around;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.stat-value {
    font-size: 0.95em;
    font-weight: 600;
    color: #333;
}

.change-value.positive {
    color: #28a745;
}

.change-value.positive::before {
    content: '+';
}

.change-value.negative {
    color: #dc3545;
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    color: #666;
}

/* Lightweight Charts customization */
.tv-lightweight-charts {
    font-family: inherit !important;
}

/* Responsive */
@media (max-width: 768px) {
    .metalcharts-controls {
        justify-content: center;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .chart-price {
        text-align: left;
    }

    .chart-stats {
        flex-wrap: wrap;
        gap: 15px;
    }

    .stat {
        flex: 1 1 30%;
    }

    .chart-period-buttons {
        flex-wrap: wrap;
        gap: 4px;
    }

    .period-btn {
        padding: 5px 10px;
        font-size: 0.8em;
    }
}
