/* ── Variables heredadas del sistema del curso ── */
.opt-trap-container {
    font-family: 'DM Sans', Arial, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
    box-sizing: border-box;
}

/* ── Loading ── */
.opt-trap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #1E3A5F;
    font-weight: 500;
    font-size: 1.1em;
}

.opt-trap-spinner {
    border: 4px solid #D1DCF0;
    border-top: 4px solid #1E3A5F;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    animation: opt-trap-spin 1.2s linear infinite;
    margin-right: 12px;
}

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

.opt-trap-app { display: none; }

/* ── Título principal del widget ── */
.opt-trap-title {
    font-family: 'Playfair Display', serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: #1E3A5F;
    border-bottom: 2px solid #C8960C;
    padding-bottom: 8px;
    margin: 0 0 16px 0;
}

/* ── Layout ── */
.opt-trap-flex-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Paneles ── */
.opt-trap-panel {
    border: 1px solid #D1DCF0;
    border-top: 3px solid #1E3A5F;
    padding: 14px 16px;
    border-radius: 8px;
    background-color: #ffffff;
    box-shadow: 0 2px 10px rgba(30,58,95,.08);
}

.opt-trap-panel h3 {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.82rem;
    font-weight: 500;
    color: #1E3A5F;
    letter-spacing: 0.02em;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid #D1DCF0;
}

/* ── Gráficos ── */
.opt-trap-graph-container {
    width: 100%;
    background-color: #ffffff;
    border-radius: 4px;
    margin-top: 10px;
    position: relative;
    overflow: hidden;
}

.opt-trap-graph-container::before {
    content: "";
    display: block;
    padding-top: 100%;
}

.opt-trap-area-graph::before {
    padding-top: 75%;
}

.opt-trap-graph-container svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}

/* ── Slider ── */
.opt-trap-slider-container {
    margin: 10px 0;
    padding: 10px 12px;
    background-color: #FDF8EC;
    border-radius: 5px;
    border-left: 3px solid #C8960C;
}

.opt-trap-slider-label {
    margin-bottom: 6px;
    font-size: 0.88rem;
    color: #1a2332;
}

.opt-trap-slider-label strong {
    color: #1E3A5F;
}

.opt-trap-slider-label span {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #C8960C;
    font-weight: 600;
}

.opt-trap-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    margin: 8px 0 2px;
    accent-color: #1E3A5F;
    cursor: pointer;
}

/* ── Tabla ── */
.opt-trap-table {
    border-collapse: collapse;
    width: 100%;
    margin-top: 8px;
    font-size: 0.83rem;
    font-family: 'JetBrains Mono', monospace;
}

.opt-trap-table th,
.opt-trap-table td {
    border: 1px solid #D1DCF0;
    padding: 6px 10px;
    text-align: center;
}

.opt-trap-table th {
    background-color: #EEF4FF;
    color: #1E3A5F;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.opt-trap-table tr:nth-child(even) td {
    background-color: #F4F7FB;
}

/* ── Líneas de cuadrícula D3 ── */
.opt-trap-grid-line {
    stroke: #D1DCF0;
    stroke-width: 0.7;
}

.opt-trap-axis text {
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    fill: #6b7a92;
}

.opt-trap-axis line,
.opt-trap-axis path {
    stroke: #b0bcd4;
}

/* ── Media queries ── */
@media (min-width: 768px) {
    .opt-trap-flex-container {
        flex-direction: row;
        flex-wrap: wrap;
    }
    .opt-trap-panel {
        flex: 1 1 calc(50% - 16px);
        min-width: 260px;
    }
    .opt-trap-trapezoid-panel {
        flex: 2 1 calc(66.66% - 16px);
    }
    .opt-trap-values-panel,
    .opt-trap-area-panel {
        flex: 1 1 calc(33.33% - 16px);
    }
}

@media (min-width: 1024px) {
    .opt-trap-flex-container {
        display: grid;
        grid-template-columns: 2fr 1fr 1fr;
    }
    .opt-trap-trapezoid-panel { grid-row: 1; grid-column: 1; }
    .opt-trap-values-panel    { grid-row: 1; grid-column: 2; }
    .opt-trap-area-panel      { grid-row: 1; grid-column: 3; }
}
