/* Global Styles */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    text-align: center;
    /* Unificando el padding:
       - Top: 60px (para dejar espacio a la barra superior)
       - Resto: 30px */
    padding: 60px 30px 30px;
}

h1 {
    color: #333;
}

/* Table Styles */
table {
    width: 100%;
    margin: 20px auto;
    border-collapse: collapse;
    background: white;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.table-responsive {
    width: 90%; /* O el ancho que desees */
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

thead {
    background: #007bff;
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    text-align: center;
}

tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

tbody tr:hover {
    background-color: #e3f2fd;
    transition: 0.3s;
}

/* Canvas styling */
canvas {
    background: white;
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

/* Controls */
#controls {
    margin-bottom: 15px;
    text-align: center;
}

#dateSelector {
    padding: 8px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* Difference Boxes */
#difference-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin: 20px auto;
}

.difference-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 60px;
    padding: 10px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    background: white;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

.label {
    font-size: 14px;
    color: #666;
}

.value {
    font-size: 22px;
}

.green-text {
    color: green;
}

.red-text {
    color: red;
}

/* Spinner Styles */
.spinner-overlay {
    /* Oculto por defecto; se cambiará a 'flex' cuando se muestre */
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner-container {
    text-align: center;
}

.spinner {
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-left-color: #007bff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

.spinner-container p {
    margin-top: 10px;
    font-size: 18px;
    color: #333;
    font-weight: bold;
}

/* Trend Text */
.trend-up {
    color: green;
    font-weight: bold;
}

.trend-down {
    color: red;
    font-weight: bold;
}

.trend-neutral {
    color: gray;
    font-weight: bold;
}

/* Scale Container and Bar */
#scale-container {
    /* Si se desea que el contenedor tenga un ancho máximo de 1000px en pantallas grandes */
    width: 50%;
    margin: 20px auto;
    text-align: center;
    max-width: 1000px;
}

/* Puedes usar media queries para ajustar el ancho en pantallas pequeñas */
@media (max-width: 600px) {
    #scale-container {
        width: 80%;
    }
}

.scale-label {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 5px;
}

.scale-bar {
    position: relative;
    width: 100%;
    height: 40px;
    background: linear-gradient(to left,
        darkgreen 0%,
        lightgreen 45%,
        yellow 50%,
        lightcoral 55%,
        darkred 100%);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
}

#scale-indicator {
    position: absolute;
    top: 0;
    width: 10px;
    height: 100%;
    background: black;
    border-radius: 5px;
    transition: left 0.5s ease-in-out;
}

.scale-ticks {
    position: absolute;
    width: 100%;
    top: 22px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #333;
    font-weight: bold;
}

.tick {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
    bottom: -10px;
}

.tick::before {
    content: "";
    display: block;
    width: 2px;
    height: 10px;
    background: black;
    margin: 0 auto;
}

/* Chart Containers */
#chart-container {
    /* width: 90%; */
    max-width: 90%;
    margin: 0 auto;
}

#chart-containerSmall {
    max-width: 90%;
    margin: 0 auto;
    height: 300px;
}

#chart {
    display: block;
    width: 100%;
    height: auto;
}

/* Market Status */
.market-status {
    position: fixed;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    color: #fff;
    z-index: 9999;
}

.market-live {
    background-color: red;
    animation: blink 1s infinite alternate;
}

.market-closed {
    background-color: #666;
    animation: none;
}

@keyframes blink {
    from {
        opacity: 1;
    }
    to {
        opacity: 0.2;
    }
}

.hidden {
    display: none;
}

.modal-body {
    max-height: 400px;
    overflow-y: auto;
}

/* Black Top Bar Styling */
.top-bar {
    background-color: #000;
    color: white;
    padding: 10px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-title {
    font-size: 24px;
    margin: 0;
    padding-left: 20px;
    color: white;
}

/* DatePicker Input (si usas uno distinto al select) */
#datePicker {
    width: 150px;
    text-align: center;
}

/* Responsive adjustments for difference boxes */
@media (max-width: 600px) {
    .difference-box {
        width: 100%;
        max-width: 300px;
        margin-bottom: 10px;
    }
}
