/* ============================================================
   MAPA DE COLORES — Stylesheet v1.1.0
   ============================================================ */

.ppg-wrapper {
    max-width: 920px;
    margin: 0 auto;
    padding: 18px;
    background: transparent;
}

.ppg-title {
    font-size: 20px;
    margin-bottom: 12px;
}

.ppg-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.ppg-row label {
    width: 160px;
    font-weight: 600;
}

.ppg-row select,
.ppg-row input {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
}

/* =========================
   🎛 ACCIONES
========================= */
.ppg-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.ppg-btn {
    padding: 8px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: #2b6cb0;
    color: #fff;
    text-decoration: none;
    display: inline-block;
    transition: background 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.ppg-btn:hover {
    background: #2c5282;
    transform: translateY(-1px);
}

.ppg-btn:active {
    transform: translateY(0);
}

/* Botón de Prompt Natural — color diferenciado para distinguirlo visualmente */
.ppg-btn-natural {
    background: #276749;
}

.ppg-btn-natural:hover {
    background: #22543d;
}

.ppg-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Grupos de botones separados */
.ppg-actions-json {
    margin-top: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #cbd5e0;
}

.ppg-actions-natural {
    margin-top: 10px;
}

/* =========================
   🗂 TABS DE SALIDA
========================= */
.ppg-tabs {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.ppg-tab-btn {
    padding: 7px 16px;
    border: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    background: #edf2f7;
    color: #4a5568;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.ppg-tab-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.ppg-tab-btn.active {
    background: #fff;
    color: #2b6cb0;
    border-color: #2b6cb0;
}

.ppg-tab-btn.active.tab-natural {
    color: #276749;
    border-color: #276749;
}

/* =========================
   📄 PANELES DE SALIDA
========================= */
.ppg-output-panel {
    display: none;
}

.ppg-output-panel.active {
    display: block;
}

.ppg-output {
    white-space: pre-wrap;
    background: #fff;
    padding: 12px;
    border: 1px solid #eee;
    border-top: none;
    border-radius: 0 0 6px 6px;
    min-height: 200px;
    font-family: monospace;
    font-size: 13px;
    color: #111;
    margin-top: 0;
}

/* El panel de prompt natural usa texto corrido, no monospace */
.ppg-output-natural {
    white-space: pre-wrap;
    background: #f0fff4;
    padding: 14px 16px;
    border: 1px solid #c6f6d5;
    border-top: none;
    border-radius: 0 0 6px 6px;
    min-height: 200px;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 14px;
    line-height: 1.7;
    color: #1a202c;
    margin-top: 0;
}

/* Badge explicativo debajo del output natural */
.ppg-natural-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 11px;
    color: #276749;
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 4px;
    padding: 3px 8px;
}

/* =========================
   🔥 WIKIPEDIA BOX
========================= */
.ppg-wiki-box {
    margin-top: 12px;
    transition: all 0.3s ease;
}

.ppg-wiki-box img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #eee;
    margin-top: 8px;
}

.ppg-wiki-attr {
    font-size: 11px;
    color: #555;
    margin-top: 6px;
    line-height: 1.6;
}

/* Línea principal: autor · licencia · enlace */
.ppg-attr-line {
    display: block;
}

.ppg-attr-line a {
    color: #2b6cb0;
    text-decoration: underline;
}

/* Leyenda legal de no respaldo (CC BY cláusula endorsement) */
.ppg-attr-disclaimer {
    display: block;
    margin-top: 4px;
    font-size: 10px;
    color: #888;
    font-style: italic;
}

.ppg-wiki-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.ppg-wiki-controls {
    display: flex;
    gap: 6px;
}

.ppg-wiki-controls button {
    background: #2b6cb0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    color: #fff;
    transition: background 0.15s ease;
}

.ppg-wiki-controls button:hover {
    background: #2c5282;
}

/* ESTADOS */
.ppg-wiki-box.minimized #ppg-wiki-result {
    display: none !important;
}

.ppg-wiki-box.hidden {
    display: none;
}

/* =========================
   📌 STICKY MODE
========================= */
.ppg-wiki-box.sticky {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 320px;
    max-width: 90vw;
    background: #fff;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 9999;
    /* FIX: el padding no suma al ancho total y nada se desborda */
    box-sizing: border-box;
    overflow: hidden;
}

/* FIX: header ocupa exactamente el ancho disponible */
.ppg-wiki-box.sticky .ppg-wiki-header {
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
}

/* FIX: el boton principal se encoge si no hay espacio, sin rebasar */
.ppg-wiki-box.sticky .ppg-wiki-header #ppg-wiki-btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    word-break: break-word;
}

/* FIX: los controles (- x) no se encogen nunca */
.ppg-wiki-box.sticky .ppg-wiki-controls {
    flex: 0 0 auto;
}

/* =========================
   📱 RESPONSIVE
========================= */
@media (max-width: 600px) {
    .ppg-row {
        flex-direction: column;
        align-items: stretch;
    }

    .ppg-row label {
        width: auto;
    }

    .ppg-actions {
        flex-direction: column;
    }

    .ppg-tabs {
        flex-wrap: wrap;
    }

    .ppg-wiki-box.sticky {
        right: 10px;
        bottom: 10px;
        width: calc(100% - 20px);
    }
}
/* =========================
   MAPA DE COLORES — estilos específicos
   Se añaden al prompt-generator.css compartido
========================= */

.mdc-description {
    font-size: 13px;
    color: #555;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* Fila inline para zoom + botones en la misma línea */
.mdc-inline-row {
    margin-bottom: 0;
    flex: 0 0 auto;
    gap: 6px;          /* gap mínimo entre label y select */
}

.mdc-inline-row label {
    width: auto !important;   /* anula los 160px de .ppg-row label */
    white-space: nowrap;
    font-weight: 600;
}

.mdc-inline-row select {
    flex: 0 0 auto;
    width: 110px;
}

/* Contenedor de la tabla con scroll horizontal */
.mdc-table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    margin-top: 16px;
    border: 1px solid #eee;
    border-radius: 6px;
    max-height: 70vh;
}

/* Tabla de colores */
.mdc-table {
    border-collapse: collapse;
    font-size: 10px;
    font-family: monospace;
    transform-origin: top left;
    transition: transform 0.2s ease;
}

.mdc-table caption {
    font-size: 12px;
    color: #888;
    padding: 8px;
    text-align: center;
    caption-side: top;
}

.mdc-table td {
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 2px 4px;
    text-align: center;
    min-width: 54px;
    white-space: nowrap;
    /* color lo asigna JS con getContrastColor según luminosidad del fondo */
    font-size: 9px;
}

/* Celdas de número de fila/columna */
.mdc-table tr td:first-child,
.mdc-table tr:first-child td,
.mdc-table tr:last-child td {
    background: #f7fafc;
    color: #718096;
    font-weight: 600;
    min-width: 28px;
}

@media (max-width: 600px) {
    .mdc-inline-row {
        flex-direction: row;
        align-items: center;
    }
}