/* Base styles for the page */
body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
}

h3 {
    text-align: center;
    margin-bottom: 30px;
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chart-count-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-count-controls select {
    padding: 8px 12px;
    background-color: #2d2d2d;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 16px;
}

.chart-count-controls select:focus {
    outline: none;
    border-color: #1e88e5;
}

button {
    padding: 10px 20px;
    background-color: #1e88e5;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background-color: #1976d2;
}

button:disabled {
    background-color: #555;
    cursor: not-allowed;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls select {
    padding: 8px 12px;
    background-color: #171717;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 16px;
}

.sort-controls select:focus {
    outline: none;
    border-color: #444;
}

.filter-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-controls input {
    padding: 8px 12px;
    background-color: #171717;
    color: #e0e0e0;
    border: 1px solid #444;
    border-radius: 4px;
    font-size: 16px;
    width: 150px;
}

.filter-controls input:focus {
    outline: none;
    border-color: #e0e0e0;
}

.filter-controls input:disabled {
    background-color: #0e0e0e; /* Light gray background */
    color: #000000; /* Darker text color */
    border: 1px solid #999999;
    /*cursor: not-allowed;*/
}

.filter-controls input.loading {
    background-color: #2d2d2d; /* Light gray background */
    color: #666666; /* Darker text color */
    border: 1px solid #444;
}

/* Styles for the charts container */
#charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Styles for each individual chart */
.chart-container {
    background-color: #1e1e1e;
    /*border: 1px solid #333;*/
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chart-container:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

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

.chart-title h3 {
    margin: 0;
    font-size: 18px;
}

.daily-change {
    font-weight: bold;
    font-size: 16px;
}

.chart {
    width: 100%;
    height: 300px;
}

/* Styles for the detailed chart page */
.chart-page {
    max-width: 1400px;
    margin: 0 auto;
}

.chart-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.back-button {
    display: inline-block;
    padding: 10px 15px;
    background-color: #1e88e5;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    margin-right: 20px;
}

.back-button:hover {
    background-color: #1976d2;
}

#detailed-chart-container {
    width: 100%;
    height: 70vh;
    background-color: #1e1e1e;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Styles for information elements */
.info-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 16px;
    color: #e0e0e0;
}

.info-controls span {
    background-color: #171717;
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid #444;
}

/* Styles for the preloader */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 18, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.preloader.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.1);
    border-top: 5px solid #1e88e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Styles for the modal window */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Semi-transparent background */
    box-sizing: content-box;
}

.modal-content {
    position: relative;
    background-color: #1e1e1e;
    margin: 2% auto;
    padding: 0;
    border: 1px solid #333;
    border-radius: 8px;
    width: 90%;
    max-width: 1400px;
    height: 90vh;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    box-sizing: content-box;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

#modal-pair-title {
    margin: 0;
    color: #e0e0e0;
    font-size: 1.5em;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 10px;
}

.close:hover,
.close:focus {
    color: #fff;
}

#modal-chart-container {
    width: 100%;
    height: calc(100% - 70px); /* Subtract the header height */
    padding: 15px;
    flex-grow: 1;
    overflow: hidden;
    box-sizing: content-box;
}

#chart-modal .modal-content,
#modal-chart-container {
    box-sizing: border-box;
    width: 97%;
    height: 92%;
    padding: 0px;
}

#modal-chart-wrapper {
    padding: 0px; /* Or any other value for "air" */
    width: 100%;
    height: 100%;
    box-sizing: border-box; /* Important so padding doesn't exceed boundaries */
}

/* Timeframe selector styles */
.timeframe-btn {
    transition: background-color 0.2s ease;
}

.timeframe-btn:hover:not(:disabled) {
    background-color: #3d3d3d;
}

