/* =========================================================
   RESULTADOS OMIE · v2.0.2
   Extiende la estructura visual de grafica_generacion.html.
   ========================================================= */

/* =========================================================
   CABECERA
   ========================================================= */
.omie-dashboard .hero-stats {
    grid-template-columns: 1.05fr 1.15fr .86fr;
}

.omie-dashboard #headerCoverage {
    font-size: 10px;
}

/* =========================================================
   CONTROLES
   ========================================================= */
.omie-controls {
    grid-template-columns: 135px 125px 155px 155px minmax(230px, 1fr) 210px 92px;
}

.omie-controls input[type="date"] {
    width: 100%;
    height: 29px;
    padding: 0;
    border: 0;
    border-bottom: 1px solid #c5cfcc;
    border-radius: 0;
    outline: none;
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 11px;
}

.omie-controls input[type="date"]:disabled,
.omie-controls select option:disabled {
    color: #9aa5a6;
}

.omie-controls input[type="date"]:disabled {
    cursor: wait;
}

.omie-controls input[type="date"]:focus {
    border-bottom-color: var(--evo-green);
}

.omie-title-control {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
}

.omie-market-title {
    width: 100%;
    overflow: hidden;
    color: #403b39;
    font-size: clamp(19px, 1.48vw, 27px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -.025em;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.omie-reload-wrap {
    padding: 0;
}

/* =========================================================
   KPI CUARTO-HORARIOS
   ========================================================= */
.omie-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.omie-kpis > .kpi {
    width: 100%;
    min-height: 82px;
    box-sizing: border-box;
}

.omie-kpis .kpi::before {
    background: #00a878;
}

.omie-brand-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 18px;
}

.omie-brand-card::before {
    background: #17728c !important;
}

.omie-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 52px;
    object-fit: contain;
}

.omie-metric-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.omie-metric-card .kpi-label {
    color: #42403f;
    font-size: 13px;
    font-weight: 800;
}

.omie-metric-card .kpi-main {
    width: 100%;
    margin-top: 4px;
    justify-content: center;
}

.omie-metric-card .kpi-value {
    color: #403b39;
    font-size: 22px;
    font-style: italic;
}

.omie-metric-card .kpi-unit {
    color: #4f4a47;
    font-size: 12px;
    font-style: italic;
}

.omie-metric-card .kpi-sub {
    min-height: 14px;
    margin-top: 3px;
    white-space: nowrap;
}

/* =========================================================
   CABECERA DE GRÁFICA Y CALIDAD
   ========================================================= */
.chart-head-copy {
    min-width: 0;
}

.chart-meta {
    text-align: right;
    white-space: nowrap;
}

.quality-legend[hidden] {
    display: none !important;
}

.quality-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    color: #a52f2a;
    font-size: 9px;
    font-weight: 650;
}

.quality-marker {
    display: inline-flex;
    width: 14px;
    height: 14px;
    align-items: center;
    justify-content: center;
    flex: 0 0 14px;
    border-radius: 50%;
    background: #d6453d;
    box-shadow: 0 0 0 2px rgba(214,69,61,.12);
}

/* =========================================================
   GRÁFICA
   ========================================================= */
.omie-chart-body {
    position: relative;
    padding: 6px 10px 5px;
}

.omie-canvas-wrap {
    overflow: hidden;
}

#chartCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-tooltip {
    position: absolute;
    z-index: 30;
    min-width: 170px;
    max-width: 250px;
    padding: 8px 10px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(17,23,24,.96);
    color: #fff;
    box-shadow: 0 8px 22px rgba(16,30,25,.18);
    font-size: 10px;
    line-height: 1.35;
    pointer-events: none;
    transform: translate(10px, -50%);
}

.chart-tooltip strong {
    display: block;
    margin-top: 2px;
    color: #67e4ab;
    font-size: 12px;
}

.chart-tooltip .tooltip-warning {
    display: block;
    margin-top: 4px;
    color: #ff786f;
    font-weight: 700;
}

/* Resumen global de toda la serie representada. En pantallas amplias se
   reserva espacio para no cubrir la gráfica; además puede arrastrarse. */
.group-summary {
    position: absolute;
    z-index: 18;
    top: 12px;
    right: 18px;
    width: 292px;
    padding: 10px 12px;
    border: 1px solid rgba(31,78,67,.18);
    border-radius: 10px;
    background: rgba(255,255,255,.94);
    color: #364442;
    box-shadow: 0 8px 22px rgba(16,30,25,.12);
    backdrop-filter: blur(2px);
    pointer-events: auto;
    cursor: grab;
    user-select: none;
    touch-action: none;
}

.group-summary-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e1e8e5;
}

.group-summary-title {
    min-width: 0;
    color: #174b3e;
    font-size: 11px;
    line-height: 1.25;
    font-weight: 850;
}

.group-summary-drag-hint {
    flex: 0 0 auto;
    padding-top: 1px;
    color: #8a9995;
    font-size: 7px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: .08em;
}

.group-summary.is-dragging {
    cursor: grabbing;
    box-shadow: 0 12px 30px rgba(16,30,25,.18);
}

.group-summary-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-top: 4px;
    font-size: 10px;
}

.group-summary-value-stack {
    display: flex;
    min-width: 125px;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.group-summary-value-stack small {
    margin-top: 1px;
    color: #7a8784;
    font-size: 8px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

.group-summary-row span {
    color: #71807d;
}

.group-summary-row strong {
    color: #34423f;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.group-summary-records {
    padding-top: 4px;
    margin-top: 6px;
    border-top: 1px solid #edf1ef;
}

.group-summary-quality {
    margin-top: 7px;
    padding: 5px 7px;
    border-radius: 6px;
    background: #fde9e7;
    color: #a52f2a;
    font-size: 9px;
    line-height: 1.25;
    font-weight: 700;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1180px) {
    .omie-controls {
        grid-template-columns: 120px 112px 145px 145px minmax(200px, 1fr) 185px 84px;
    }

    .omie-market-title {
        font-size: 18px;
    }

    .group-summary {
        width: 260px;
    }
}

@media (max-width: 920px), (max-height: 650px) {
    .omie-title-control {
        min-height: 54px;
    }

    .omie-controls {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Neutraliza los nth-child heredados de generacion.css para la nueva
       estructura de 7 controles. */
    .omie-controls .control:nth-child(4) {
        grid-column: auto;
    }

    .omie-controls .control:nth-child(5) {
        grid-column: 1 / -1;
        padding: 7px 11px 5px;
    }

    .omie-controls .control:nth-child(6),
    .omie-controls .control:nth-child(7) {
        padding: 0;
    }

    .omie-controls .control:nth-child(2n) {
        border-right: 0;
    }

    .omie-controls .control:nth-child(5) {
        border-right: 0;
    }

    .omie-kpis {
        grid-template-columns: repeat(2, 1fr);
    }

    .chart-meta {
        white-space: normal;
    }
}

@media (max-width: 650px) {
    .group-summary {
        top: 8px;
        right: 8px;
        width: 190px;
        padding: 8px 9px;
    }
}
