/* Mi Plugin Tablas – Estilos Frontend
   Color principal: #005DA1
   Tipografía: Montserrat
*/

:root {
    /* Paleta de colores basada en #005DA1 */
    --mpt-primary: #005DA1;
    --mpt-primary-900: #003d6b;
    --mpt-primary-800: #004a85;
    --mpt-primary-700: #005494;
    --mpt-primary-600: #005da1;
    --mpt-primary-500: #0066b3;
    --mpt-primary-400: #0070c5;
    --mpt-primary-300: #007ad7;
    --mpt-primary-200: #0084e9;
    --mpt-primary-100: #008efb;
    --mpt-primary-50: #f0f8ff;
    --mpt-primary-25: #f8fbff;
    
    /* Colores de fondo */
    --mpt-bg: #ffffff;
    --mpt-card: #f8fafc;
    --mpt-card-hover: #f1f5f9;
    
    /* Bordes */
    --mpt-border: #e5e7eb;
    --mpt-border-light: #f1f5f9;
    --mpt-border-primary: rgba(0, 93, 161, 0.2);
    
    /* Texto */
    --mpt-text: #0f172a;
    --mpt-text-light: #475569;
    --mpt-text-muted: #6b7280;
    --mpt-text-inverse: #ffffff;
    
    /* Estados */
    --mpt-success: #059669;
    --mpt-warning: #d97706;
    --mpt-error: #dc2626;
    --mpt-info: #005DA1;
    
    /* Espaciado y bordes */
    --mpt-radius: 16px;
    --mpt-radius-sm: 12px;
    --mpt-radius-xs: 8px;
    
    /* Sombras */
    --mpt-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --mpt-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --mpt-shadow-primary: 0 4px 14px 0 rgba(0, 93, 161, 0.15);
    
    /* Inputs */
    --mpt-input-bg: #fff;
    --mpt-input-focus: rgba(0, 93, 161, 0.1);
    --mpt-input-border: #d1d5db;
    --mpt-input-border-focus: #005DA1;
}

/* Configuración global de tipografía */
* {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Mejoras para dispositivos táctiles */
@media (hover: none) and (pointer: coarse) {
    .mpt-btn,
    .mpt-link,
    .mpt-page {
        min-height: 44px;
        min-width: 44px;
    }
    
    .mpt-input,
    .mpt-select {
        min-height: 44px;
        font-size: 16px; /* Previene zoom en iOS */
    }
    
    .mpt-table thead th,
    .mpt-table tbody td {
        min-height: 44px;
    }
}

.mpt-wrap {
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--mpt-text);
    background: var(--mpt-bg);
    border: 1px solid var(--mpt-border-light);
    border-radius: var(--mpt-radius);
    padding: 24px;
    box-shadow: var(--mpt-shadow);
    max-width: 100%;
    margin: 0 auto;
    font-weight: 400;
    line-height: 1.6;
}

.mpt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 20px 0;
    border-bottom: 1px solid var(--mpt-border-light);
    margin-bottom: 20px;
}

.mpt-title {
    margin: 0;
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--mpt-primary-800);
    letter-spacing: -0.025em;
    text-shadow: 0 1px 2px rgba(0, 93, 161, 0.1);
}

/* ===================== Filtros ===================== */
.mpt-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    align-items: end;
    margin: 0 0 24px 0;
    padding: 24px;
    background: linear-gradient(135deg, var(--mpt-primary-25) 0%, var(--mpt-primary-50) 100%);
    border: 1px solid var(--mpt-primary-200);
    border-radius: var(--mpt-radius-sm);
    box-shadow: 0 2px 8px rgba(0, 93, 161, 0.08);
}

.mpt-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mpt-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--mpt-primary-800);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mpt-input,
.mpt-select {
    width: 100%;
    border: 1px solid var(--mpt-border);
    border-radius: var(--mpt-radius-sm);
    padding: 12px 16px;
    background: var(--mpt-input-bg);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

.mpt-input:focus,
.mpt-select:focus {
    border-color: var(--mpt-primary);
    box-shadow: 0 0 0 3px var(--mpt-input-focus), 0 2px 8px rgba(0, 93, 161, 0.1);
    outline: none;
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* Estilos específicos para filtros de fecha */
.mpt-input[type="date"] {
    min-height: 44px;
    cursor: pointer;
    position: relative;
}

.mpt-input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(0.5);
    transition: filter 0.2s ease;
    background-color: transparent;
    border: none;
    padding: 4px;
    border-radius: 4px;
}

.mpt-input[type="date"]::-webkit-calendar-picker-indicator:hover {
    filter: invert(0.3);
    background-color: rgba(0, 93, 161, 0.1);
}

/* Estilos para select de filtros */
.mpt-select {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
}

.mpt-input::placeholder {
    color: var(--mpt-muted);
}

.mpt-filter-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--mpt-border);
    margin-top: 8px;
}

.mpt-btn {
    appearance: none;
    border: none;
    border-radius: var(--mpt-radius-sm);
    padding: 12px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mpt-btn--primary {
    background: var(--mpt-primary);
    color: var(--mpt-text-inverse);
    box-shadow: var(--mpt-shadow-primary);
    font-weight: 600;
    letter-spacing: 0.025em;
}

.mpt-btn--primary:hover {
    background: var(--mpt-primary-700);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px 0 rgba(0, 93, 161, 0.25);
}

.mpt-btn--primary:active {
    background: var(--mpt-primary-800);
    transform: translateY(0);
    box-shadow: var(--mpt-shadow-primary);
}

.mpt-btn--primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 93, 161, 0.2), var(--mpt-shadow-primary);
}

/* Botón para URLs */
.mpt-btn--url {
    background: var(--mpt-primary);
    color: var(--mpt-text-inverse);
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: var(--mpt-radius-xs);
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 93, 161, 0.2);
}

.mpt-btn--url:hover {
    background: var(--mpt-primary-700);
    color: var(--mpt-text-inverse);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 93, 161, 0.3);
    text-decoration: none;
}

.mpt-btn--url:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 93, 161, 0.2);
}

/* ===================== Tabla ===================== */
.mpt-table-wrap {
    background: var(--mpt-bg);
    border: 1px solid var(--mpt-border);
    border-radius: var(--mpt-radius-sm);
    overflow: hidden;
    box-shadow: var(--mpt-shadow);
}

.mpt-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
    table-layout: fixed; /* Evita que las columnas se acorten */
}

/* Evitar que las columnas se acorten */
.mpt-table th,
.mpt-table td {
    min-width: 180px; /* Aún más ancho mínimo para evitar altura excesiva */
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Columnas específicas que no deben acortarse */
.mpt-table th:first-child,
.mpt-table td:first-child {
    min-width: 80px; /* ID o columnas pequeñas */
}

.mpt-table th:last-child,
.mpt-table td:last-child {
    min-width: 100px; /* Columnas de acciones */
}

/* Campo detalle con doble ancho */
.mpt-cell-detail {
    min-width: 600px !important; /* Mucho más ancho para evitar altura excesiva */
    max-width: none !important;
}

/* Ajustes responsive para campo detalle */
@media (max-width: 1023px) {
    .mpt-cell-detail {
        min-width: 500px !important;
    }
}

@media (max-width: 767px) {
    .mpt-cell-detail {
        min-width: 400px !important;
    }
}

@media (max-width: 480px) {
    .mpt-cell-detail {
        min-width: 300px !important;
    }
}

.mpt-cell-detail .mpt-text-cell {
    max-width: none !important; /* Sin límite de ancho para que crezca horizontalmente */
}

/* Forzar que el texto no se envuelva en el campo detalle */
.mpt-cell-detail .mpt-text-full,
.mpt-cell-detail .mpt-text-truncated {
    white-space: nowrap !important; /* Evita que el texto se envuelva */
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.mpt-table thead th {
    background: var(--mpt-primary);
    color: var(--mpt-text-inverse);
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--mpt-primary-700);
    padding: 18px 20px;
    position: sticky;
    top: 0;
    z-index: 10;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.mpt-table tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--mpt-border-light);
    vertical-align: top; /* Cambiar a top para textos largos */
    font-size: 0.95rem;
    color: var(--mpt-primary);
    font-weight: 500;
    min-height: 60px; /* Altura mínima para celdas con texto largo */
}

.mpt-table tbody tr {
    background: var(--mpt-bg);
}

.mpt-table tbody tr:nth-child(even) {
    background: var(--mpt-bg);
}

.mpt-table tbody tr:hover {
    background: var(--mpt-primary-25);
    transform: translateY(-1px);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 93, 161, 0.1);
}

.mpt-table tbody tr:last-child td {
    border-bottom: none;
}

.mpt-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--mpt-primary);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: var(--mpt-radius-sm);
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.mpt-link:hover {
    background: var(--mpt-primary-50);
    border-color: var(--mpt-primary-300);
    color: var(--mpt-primary-700);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 93, 161, 0.15);
}

.mpt-link:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(0, 93, 161, 0.1);
}

/* Enlaces en encabezados de tabla */
.mpt-table thead th .mpt-link {
    color: var(--mpt-text-inverse);
    font-weight: 600;
    padding: 0;
    border: none;
    background: none;
}

.mpt-table thead th .mpt-link:hover {
    background: none;
    border: none;
    color: var(--mpt-text-inverse);
    transform: none;
    opacity: 0.8;
}

/* Enlaces de URL en las celdas de la tabla */
.mpt-table tbody td .mpt-link {
    color: var(--mpt-primary);
    font-weight: 600;
    text-decoration: underline;
    padding: 4px 8px;
    border-radius: var(--mpt-radius-xs);
    transition: all 0.2s ease;
}

.mpt-table tbody td .mpt-link:hover {
    background: var(--mpt-primary-50);
    color: var(--mpt-primary-700);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 93, 161, 0.15);
}

.mpt-muted {
    color: var(--mpt-muted);
    font-style: italic;
}

.mpt-empty,
.mpt-notice {
    margin: 16px 0;
    padding: 20px;
    border-radius: var(--mpt-radius-sm);
    border: 1px dashed var(--mpt-border);
    background: var(--mpt-card);
    text-align: center;
}

.mpt-error {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

.mpt-info {
    border-color: var(--mpt-primary);
    background: var(--mpt-primary-50);
    color: var(--mpt-primary);
}

/* ===================== Paginación ===================== */
.mpt-pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 20px 0 0 0;
    margin-top: 20px;
    border-top: 1px solid var(--mpt-border-light);
}

.mpt-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: var(--mpt-radius-sm);
    border: 1px solid var(--mpt-border);
    background: var(--mpt-bg);
    text-decoration: none;
    font-weight: 500;
    color: var(--mpt-text);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.mpt-page:hover {
    background: var(--mpt-primary-50);
    border-color: var(--mpt-primary);
    color: var(--mpt-primary);
    transform: translateY(-1px);
}

.mpt-page.is-active {
    color: var(--mpt-text-inverse);
    background: var(--mpt-primary);
    border-color: var(--mpt-primary);
    font-weight: 700;
    box-shadow: var(--mpt-shadow-primary);
    transform: scale(1.05);
}

/* ===================== TEXT HANDLING ===================== */

/* Manejo de textos largos */
.mpt-text-cell {
    position: relative;
    max-width: 800px; /* Ancho máximo de la celda - doble de ancho */
    min-height: 60px; /* Altura mínima para 3 líneas */
    padding: 8px 0; /* Padding vertical para más espacio */
}

.mpt-text-truncated {
    display: -webkit-box;
    -webkit-line-clamp: 3; /* Mostrar exactamente 3 líneas */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4; /* Espaciado entre líneas */
    max-height: 4.2em; /* 3 líneas * 1.4 line-height */
    cursor: help;
    word-wrap: break-word;
    white-space: normal;
}

/* Fallback para navegadores que no soportan -webkit-line-clamp */
@supports not (-webkit-line-clamp: 3) {
    .mpt-text-truncated {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.4;
        max-height: 4.2em;
        position: relative;
    }
    
    .mpt-text-truncated::after {
        content: '...';
        position: absolute;
        bottom: 0;
        right: 0;
        background: white;
        padding-left: 4px;
    }
}

.mpt-text-full {
    display: block;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
    min-height: 1.4em;
}



.mpt-text-expand {
    background: none;
    border: none;
    color: #005DA1;
    font-size: 12px;
    padding: 4px 8px;
    margin-top: 6px;
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 4px;
    display: inline-block;
}

.mpt-text-expand:hover {
    color: #003d7a;
    background-color: #f0f8ff;
    border-radius: 4px;
    text-decoration: none;
}

/* Modal para texto completo */
.mpt-text-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.mpt-text-modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.mpt-text-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e5e7eb;
}

.mpt-text-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #005DA1;
    margin: 0;
}

.mpt-text-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.mpt-text-modal-close:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.mpt-text-modal-body {
    line-height: 1.6;
    color: #374151;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===================== RESPONSIVE DESIGN ===================== */

/* ===== DESKTOP LARGE (1200px+) ===== */
@media (min-width: 1200px) {
    .mpt-wrap {
        max-width: 1400px;
        margin: 0 auto;
        padding: 32px;
    }
    
    .mpt-header {
        padding: 32px 40px;
    }
    
    .mpt-title {
        font-size: 2rem;
        margin-bottom: 12px;
    }
    
    .mpt-filters {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .mpt-table {
        font-size: 1rem;
    }
    
    /* Celdas de texto largo en pantallas grandes */
    .mpt-text-cell {
        max-width: 800px;
        min-height: 60px;
    }
    
    /* Campo detalle en pantallas grandes */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
}

/* ===== DESKTOP EXTRA LARGE (1600px+) ===== */
@media (min-width: 1600px) {
    .mpt-wrap {
        max-width: 1600px;
        padding: 40px;
    }
    
    .mpt-header {
        padding: 40px 50px;
    }
    
    .mpt-title {
        font-size: 2.25rem;
    }
    
    .mpt-filters {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
        padding: 30px;
    }
    
    .mpt-table {
        font-size: 1.1rem;
    }
    
    .mpt-table thead th,
    .mpt-table tbody td {
        padding: 20px 24px;
    }
    
    /* Celdas de texto largo en pantallas extra grandes */
    .mpt-text-cell {
        max-width: 1000px;
        min-height: 70px;
    }
    
    /* Campo detalle en pantallas extra grandes */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
}

/* ===== DESKTOP MEDIUM (1024px - 1199px) ===== */
@media (max-width: 1199px) and (min-width: 1024px) {
    .mpt-wrap {
        max-width: 100%;
        margin: 0 16px;
        padding: 24px;
    }
    
    .mpt-header {
        padding: 24px 30px;
    }
    
    .mpt-title {
        font-size: 1.75rem;
    }
    
    .mpt-filters {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 16px;
        padding: 24px;
    }
    
    .mpt-table {
        font-size: 0.95rem;
    }
    
    .mpt-table thead th,
    .mpt-table tbody td {
        padding: 16px 18px;
    }
    
    /* Celdas de texto largo en pantallas medianas */
    .mpt-text-cell {
        max-width: 600px;
        min-height: 55px;
    }
    
    /* Campo detalle en pantallas medianas */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
}

/* ===== TABLET LANDSCAPE (768px - 1023px) ===== */
@media (max-width: 1023px) and (min-width: 768px) {
    .mpt-wrap {
        padding: 20px;
        margin: 0 12px;
    }
    
    .mpt-header {
        padding: 20px 24px;
    }
    
    .mpt-title {
        font-size: 1.4rem;
    }
    
    .mpt-filters {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        padding: 18px;
    }
    
    .mpt-filter-actions {
        grid-column: 1 / -1;
        justify-content: center;
    }
    
    .mpt-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--mpt-radius-xs);
    }
    
    .mpt-table {
        min-width: 600px;
    }
    
    .mpt-table thead th,
    .mpt-table tbody td {
        padding: 14px 16px;
        font-size: 0.9rem;
    }
    
    .mpt-btn--url {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    /* Celdas de texto largo en tablet landscape */
    .mpt-text-cell {
        max-width: 400px;
        min-height: 50px;
    }
    
    /* Campo detalle en tablet landscape */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
}

/* ===== TABLET PORTRAIT (481px - 767px) ===== */
@media (max-width: 767px) and (min-width: 481px) {
    .mpt-wrap {
        padding: 16px;
        margin: 0 8px;
        border-radius: var(--mpt-radius-sm);
    }
    
    .mpt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 16px;
    }
    
    .mpt-title {
        font-size: 1.25rem;
        line-height: 1.3;
    }
    
    .mpt-filters {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
    }
    
    .mpt-field {
        gap: 6px;
    }
    
    .mpt-label {
        font-size: 0.8rem;
    }
    
    .mpt-input,
    .mpt-select {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .mpt-filter-actions {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    
    .mpt-btn {
        padding: 12px 18px;
        font-size: 0.9rem;
    }
    
    .mpt-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: var(--mpt-radius-xs);
        margin: 0 -8px;
    }
    
    .mpt-table {
        min-width: 500px;
    }
    
    .mpt-table thead th {
        padding: 12px 14px;
        font-size: 0.75rem;
        white-space: nowrap;
    }
    
    .mpt-table tbody td {
        padding: 12px 14px;
        font-size: 0.85rem;
    }
    
    .mpt-btn--url {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .mpt-pagination {
        flex-wrap: wrap;
        gap: 6px;
        justify-content: center;
    }
    
    .mpt-page {
        min-width: 36px;
        height: 36px;
        font-size: 0.85rem;
    }
    
    /* Celdas de texto largo en tablet portrait */
    .mpt-text-cell {
        max-width: 350px;
        min-height: 48px;
    }
    
    /* Campo detalle en tablet portrait */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
    
    .mpt-text-truncated {
        -webkit-line-clamp: 2; /* Solo 2 líneas en tablet */
        max-height: 2.8em;
    }
}

/* ===== MOBILE LARGE (375px - 480px) ===== */
@media (max-width: 480px) and (min-width: 376px) {
    .mpt-wrap {
        padding: 12px;
        margin: 0 4px;
        border-radius: var(--mpt-radius-xs);
    }
    
    .mpt-header {
        padding-bottom: 12px;
        margin-bottom: 16px;
    }
    
    .mpt-title {
        font-size: 1.125rem;
        line-height: 1.2;
    }
    
    .mpt-filters {
        padding: 12px;
        gap: 10px;
    }
    
    .mpt-input,
    .mpt-select {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .mpt-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .mpt-table-wrap {
        margin: 0 -4px;
    }
    
    .mpt-table {
        min-width: 450px;
    }
    
    .mpt-table thead th {
        padding: 10px 12px;
        font-size: 0.7rem;
    }
    
    .mpt-table tbody td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }
    
    /* Celdas de texto largo en móvil */
    .mpt-text-cell {
        max-width: 500px;
        min-height: 45px;
    }
    
    /* Campo detalle en móvil */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
    
    .mpt-text-truncated {
        -webkit-line-clamp: 2; /* Solo 2 líneas en móvil */
        max-height: 2.8em;
    }
    
    .mpt-btn--url {
        padding: 5px 8px;
        font-size: 0.7rem;
    }
    
    .mpt-page {
        min-width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
}

/* ===== MOBILE SMALL (320px - 375px) ===== */
@media (max-width: 375px) {
    .mpt-wrap {
        padding: 8px;
        margin: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .mpt-header {
        padding-bottom: 10px;
        margin-bottom: 12px;
    }
    
    .mpt-title {
        font-size: 1rem;
        line-height: 1.1;
    }
    
    .mpt-filters {
        padding: 10px;
        gap: 8px;
    }
    
    .mpt-field {
        gap: 4px;
    }
    
    .mpt-label {
        font-size: 0.75rem;
        margin-bottom: 2px;
    }
    
    .mpt-input,
    .mpt-select {
        padding: 6px 10px;
        font-size: 0.8rem;
    }
    
    .mpt-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
    
    .mpt-table-wrap {
        margin: 0;
        border-radius: 0;
    }
    
    .mpt-table {
        min-width: 400px;
    }
    
    .mpt-table thead th {
        padding: 8px 10px;
        font-size: 0.65rem;
    }
    
    .mpt-table tbody td {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .mpt-btn--url {
        padding: 4px 6px;
        font-size: 0.65rem;
    }
    
    .mpt-pagination {
        gap: 4px;
    }
    
    .mpt-page {
        min-width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }
    
    /* Celdas de texto largo en móvil pequeño */
    .mpt-text-cell {
        max-width: 200px;
        min-height: 40px;
    }
    
    /* Campo detalle en móvil pequeño */
    .mpt-cell-detail .mpt-text-cell {
        max-width: none !important; /* Sin límite para crecer horizontalmente */
    }
    
    .mpt-text-truncated {
        -webkit-line-clamp: 1; /* Solo 1 línea en móvil pequeño */
        max-height: 1.4em;
    }
}

/* ===== MOBILE EXTRA SMALL (menos de 320px) ===== */
@media (max-width: 319px) {
    .mpt-wrap {
        padding: 6px;
    }
    
    .mpt-title {
        font-size: 0.9rem;
    }
    
    .mpt-filters {
        padding: 8px;
        gap: 6px;
    }
    
    .mpt-input,
    .mpt-select {
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .mpt-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .mpt-table {
        min-width: 350px;
    }
    
    .mpt-table thead th,
    .mpt-table tbody td {
        padding: 6px 8px;
        font-size: 0.7rem;
    }
    
    .mpt-btn--url {
        padding: 3px 5px;
        font-size: 0.6rem;
    }
    
    .mpt-page {
        min-width: 24px;
        height: 24px;
        font-size: 0.7rem;
    }
}

/* ===== ORIENTACIÓN LANDSCAPE EN MÓVILES ===== */
@media (max-width: 767px) and (orientation: landscape) {
    .mpt-wrap {
        padding: 12px;
    }
    
    .mpt-filters {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }
    
    .mpt-filter-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .mpt-table-wrap {
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* ===== ACCESIBILIDAD Y FOCUS ===== */
@media (prefers-reduced-motion: reduce) {
    .mpt-wrap * {
        transition: none !important;
        animation: none !important;
    }
}

/* ===== IMPRESIÓN ===== */
@media print {
    .mpt-wrap {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .mpt-filters,
    .mpt-pagination {
        display: none;
    }
    
    .mpt-table-wrap {
        overflow: visible;
    }
    
    .mpt-table {
        min-width: auto;
        width: 100%;
    }
    
    .mpt-btn--url {
        background: none !important;
        color: #000 !important;
        border: 1px solid #000;
        text-decoration: none;
    }
}