/* ═══════════════════════════════════════════════════════════════
   Modal genérico EX-xx (EX-17, EX-10, EX-31)
   ═══════════════════════════════════════════════════════════════
   Clona el diseño visual del EX-32 (tools-ex32.css). Reusa las
   clases del modal-overlay/modal-container/modal-header/modal-body/
   modal-footer y los tokens del tema (--bg-primary, --accent, etc.).
   Sólo añade los estilos específicos del modal genérico que no
   existen en el del EX-32 (grid de 12 columnas, radio-group, fechas
   partidas, condicional show/hide).
   ═══════════════════════════════════════════════════════════════ */

/* Contenedor — alias visual de .ex32-modal-container */
.ex-generic-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ═══ Smart paste (idéntico al EX-32) ═══ */
.ex-smart-paste {
    background: linear-gradient(135deg, rgba(29,155,240,0.05), rgba(0,186,124,0.05));
    border: 1px solid rgba(29,155,240,0.2);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 18px;
}
.ex-smart-paste label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--accent);
}
.ex-smart-paste textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
}
.ex-smart-paste textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.ex-smart-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 10px;
    flex-wrap: wrap;
}
.ex-hint {
    font-size: 11px;
    color: var(--text-muted);
    flex: 1 1 auto;
    min-width: 140px;
}

/* Botón "Adjuntar" — usa .btn-secondary del EX-32 + ajustes propios */
.ex-btn-attach {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 12px !important;
    padding: 8px 14px !important;
}

/* ═══ Botones "copiar de…" en sección Notificaciones ═══ */
.ex-copy-helpers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 14px;
}
.ex-btn-copy {
    flex: 0 1 auto !important;
    font-size: 12px !important;
    padding: 7px 14px !important;
}

/* ═══ Lista de archivos adjuntados ═══ */
.ex-files-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: var(--bg-input);
}
.ex-files-list.hidden { display: none; }

.ex-file-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
}
.ex-file-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}
.ex-file-nota {
    width: 100%;
    font-size: 12px;
    padding: 4px 8px;
    margin-top: 2px;
}
.ex-file-nota::placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-size: 11px;
}
.ex-file-icon {
    font-size: 16px;
    flex-shrink: 0;
}
.ex-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
    min-width: 0;
}
.ex-file-size {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.ex-file-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.ex-file-remove:hover {
    background: var(--bg-hover);
    color: var(--danger, #e53935);
}

/* ═══ Tabs (idéntico al EX-32) ═══ */
.ex-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ex-tab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition);
}
.ex-tab:hover { color: var(--text-primary); }
.ex-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.ex-tab.hidden { display: none; }

.ex-tab-content { display: none; }
.ex-tab-content.active { display: block; }
.ex-tab-content.hidden { display: none !important; }

/* ═══ Secciones en tarjetas (idéntico al EX-32) ═══ */
.ex-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 14px;
}
.ex-section h3 {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ex-section-note {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    font-style: italic;
}

/* ═══ Filas con grid de 12 columnas ═══
   Permite layouts mixtos: por defecto, 1 fila = 1 grid de 12 cols,
   y cada campo ocupa N columnas según `grid` del config.
   En móvil colapsa a 1 columna. */
.ex-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}
.ex-grid:last-child { margin-bottom: 0; }

.ex-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.ex-col-1  { grid-column: span 1;  }
.ex-col-2  { grid-column: span 2;  }
.ex-col-3  { grid-column: span 3;  }
.ex-col-4  { grid-column: span 4;  }
.ex-col-5  { grid-column: span 5;  }
.ex-col-6  { grid-column: span 6;  }
.ex-col-7  { grid-column: span 7;  }
.ex-col-8  { grid-column: span 8;  }
.ex-col-9  { grid-column: span 9;  }
.ex-col-10 { grid-column: span 10; }
.ex-col-11 { grid-column: span 11; }
.ex-col-12 { grid-column: span 12; }

/* ═══ Label + input (igual EX-32) ═══ */
.ex-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}
.ex-input {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.ex-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim, rgba(79,195,247,0.15));
}
.ex-input:read-only,
.ex-input[readonly] {
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: not-allowed;
}
.ex-uppercase { text-transform: uppercase; }

/* ═══ FIX modo oscuro — pulido para paleta Slate ═══
   Con la nueva paleta Slate, el --accent (#60a5fa) ya es un azul tranquilo
   que no deslumbra. Los overrides son mucho más sencillos: sólo refuerzo
   bordes de inputs y subo la legibilidad de labels.
   ═══════════════════════════════════════════════════════════════════════ */

/* 1. Inputs con borde más visible contra la tarjeta y un brillo interior sutil */
html:not([data-theme="light"]) .modal-container .ex-input,
html:not([data-theme="light"]) .modal-container input[type="text"],
html:not([data-theme="light"]) .modal-container input[type="email"],
html:not([data-theme="light"]) .modal-container input[type="tel"],
html:not([data-theme="light"]) .modal-container input[type="number"],
html:not([data-theme="light"]) .modal-container textarea,
html:not([data-theme="light"]) .modal-container select {
    border-color: var(--border-hover);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
html:not([data-theme="light"]) .modal-container .ex-input:hover:not(:focus),
html:not([data-theme="light"]) .modal-container input:hover:not(:focus),
html:not([data-theme="light"]) .modal-container textarea:hover:not(:focus),
html:not([data-theme="light"]) .modal-container select:hover:not(:focus) {
    border-color: rgba(255,255,255,0.22);
}
html:not([data-theme="light"]) .modal-container .ex-input:focus,
html:not([data-theme="light"]) .modal-container input:focus,
html:not([data-theme="light"]) .modal-container textarea:focus,
html:not([data-theme="light"]) .modal-container select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim),
                inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* 2. Labels más legibles (sube de --text-muted a --text-secondary) */
html:not([data-theme="light"]) .modal-container .ex-label,
html:not([data-theme="light"]) .modal-container .ex32-row label {
    color: var(--text-secondary);
}

/* 3. Notas e hints también más legibles */
html:not([data-theme="light"]) .modal-container .ex-section-note,
html:not([data-theme="light"]) .modal-container .ex32-hint {
    color: var(--text-secondary);
}

textarea.ex-input {
    resize: vertical;
    min-height: 60px;
}

/* ═══ Checkbox inline (igual a .ex32-checks .check) ═══ */
.ex-checkbox-inline {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s;
    line-height: 1.4;
}
.ex-checkbox-inline:hover {
    background: var(--bg-hover);
}
.ex-checkbox-inline input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

/* ═══ Radio group ═══ */
.ex-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding-top: 4px;
}
.ex-radio-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 0;
}
.ex-radio-label input[type="radio"] {
    accent-color: var(--accent);
    cursor: pointer;
}

/* Radios largos (col-12 con muchas opciones, ej. los 25 supuestos del EX-10):
   se apilan en columna para mejor legibilidad */
.ex-col-12 .ex-radio-group {
    flex-direction: column;
    gap: 6px;
}

/* ═══ Fecha partida (DD/MM/AAAA) ═══ */
.ex-fecha-partida {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ex-fecha-part {
    text-align: center;
    padding: 8px 6px !important;
}
.ex-fecha-partida input[maxlength="2"] { max-width: 50px; }
.ex-fecha-partida input[maxlength="4"] { max-width: 70px; }
.ex-fecha-partida span {
    color: var(--text-muted);
    font-size: 13px;
}

/* ═══ Loading ═══ */
.ex-loading {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* ═══════════════════════════════════════════════════════════════
   MÓVIL — usa los mismos breakpoints y filosofía que tools-ex32.css
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* El modal-overlay y modal-container ya están responsivos
       desde tools-ex32.css. Aquí solo overrides específicos. */

    .ex-generic-container {
        max-width: 100%;
        width: 100%;
        max-height: 100vh;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    /* Grid colapsa a una columna en móvil */
    .ex-col-1, .ex-col-2, .ex-col-3, .ex-col-4,
    .ex-col-5, .ex-col-6, .ex-col-7, .ex-col-8,
    .ex-col-9, .ex-col-10, .ex-col-11 {
        grid-column: span 12;
    }

    .ex-section { padding: 12px; }
    .ex-tab { font-size: 12px; padding: 6px 10px; }

    /* Smart paste actions stack */
    .ex-smart-actions {
        flex-direction: column;
        align-items: stretch;
    }

    /* Las fechas partidas se mantienen en línea pero más compactas */
    .ex-fecha-partida input[maxlength="2"] { max-width: 44px; }
    .ex-fecha-partida input[maxlength="4"] { max-width: 64px; }
}

/* Texto de ayuda explicativo bajo un checkbox/campo (campo.ayuda en config) */
.ex-field-help {
    margin: 4px 0 0 28px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}
