/* Reset some default styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body and main container */
body {
    font-family: 'Poppins', sans-serif;
    background-color: #f9fafc;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Header styling */
.header {
    text-align: center;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.5em;
    color: #007bff;
}

.header p {
    color: #555;
    font-size: 1.2em;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.toggle-btn {
    padding: 12px 24px;
    font-size: 1em;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #007bff;
    background-color: #fff;
    color: #007bff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.toggle-btn:hover {
    background-color: #f0f8ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.2);
}

.toggle-btn.active {
    background-color: #007bff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.toggle-btn:active {
    transform: translateY(0);
}

/* Price section */
.price-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* View Container Management */
.view-container {
    display: none !important;
}

.view-container.active {
    display: block !important;
}

#prices-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.price-item {
    background-color: #f1f1f1;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.price-item h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    color: #333;
}

.price-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.price-display span {
    font-size: 1.3em;
    color: #28a745;
    font-weight: 600;
}

.price-card {
    background-color: #f1f1f1;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.price-card h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: #333;
}

.price-card p {
    font-size: 1.5em;
    color: #28a745;
}

/* Hover effect for cards and items */
.price-card:hover,
.price-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.loading-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading-message p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

/* Loading animation */
.loading {
    font-size: 1.2em;
    color: #999;
}

/* Spinner styling */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: #007bff;
    animation: spin 1s ease-in-out infinite;
    margin-left: 10px; /* Space between the text and the spinner */
}

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

/* Hide the spinner when data is fetched */
.hidden {
    display: none;
}

/* Chart View Styles */
#charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
}

.chart-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chart-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.chart-title {
    font-size: 1.3em;
    color: #333;
    font-weight: 600;
    margin: 0;
}

.chart-price-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chart-current-price {
    font-size: 1.2em;
    color: #28a745;
    font-weight: 600;
}

.chart-price-change {
    font-size: 0.9em;
    margin-top: 5px;
}

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

.chart-price-change.negative {
    color: #dc3545;
}

.timeframe-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.timeframe-btn {
    padding: 6px 14px;
    font-size: 0.85em;
    font-family: 'Poppins', sans-serif;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    color: #666;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.timeframe-btn:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

.timeframe-btn.active {
    background-color: #007bff;
    color: #fff;
    border-color: #007bff;
}

.chart-canvas-container {
    position: relative;
    height: 250px;
    width: 100%;
}

.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 250px;
    color: #666;
    font-size: 1.1em;
}

.chart-error {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 250px;
    color: #dc3545;
    font-size: 0.95em;
    text-align: center;
    padding: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #charts-container {
        grid-template-columns: 1fr;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .chart-price-info {
        align-items: flex-start;
        width: 100%;
    }
    
    .toggle-btn {
        padding: 10px 18px;
        font-size: 0.9em;
    }
}
