/* Widget Container */
.si2-api-list-widget {
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
}

/* Loading State */
.si2-loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.si2-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1976d2;
    border-radius: 50%;
    animation: si2-spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.si2-loading-state p,
.si2-error-state p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

/* Error State */
.si2-error-state {
    padding: 40px 20px;
    text-align: center;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
}

.si2-error-state p {
    color: #856404;
    font-weight: 500;
}

/* Filters Section */
.si2-filters-section {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
}

.si2-filter-group {
    display: flex;
    align-items: center;
}

.si2-search-wrapper,
.si2-select-wrapper {
    display: flex;
    gap: 8px;
}

.si2-search-input,
.si2-status-filter {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #D9D9D9 !important;
    font-size: 14px;
    color: #333;
    outline: none;
    max-width: 280px;
}

.si2-search-input::placeholder {
    color: #999;
}

.si2-status-filter {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.si2-search-button,
.si2-filter-button {
    padding: 10px 20px;
    background: transparent;
    color: #000;
    border: 1px solid #D9D9D9;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.si2-search-button:hover,.si2-search-button:focus
.si2-filter-button:hover,.si2-filter-button:focus {
    background: #D9D9D9;
    color: #000;
}

.si2-search-button:active,
.si2-filter-button:active {
    background: #D9D9D9;
    color: #000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .si2-filters-section {
        flex-direction: row;
        gap: 12px;
        padding: 16px;
    }
}

/* Table Container */
.si2-table-container {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.si2-table-wrapper {
    overflow-x: auto;
}

/* Table Styles */
.si2-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0;
}

/* Reset Elementor Styles */
table.si2-data-table tbody>tr:nth-child(odd)>td, table tbody>tr:nth-child(odd)>th{
    background-color: unset;
}
table.si2-data-table td, table.si2-data-table th {
    border: unset;
}

.si2-data-table thead {
    border-bottom: 1px solid #e0e0e0;
}

.si2-data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #424242;
    font-size: 13px;
    white-space: nowrap;
    border: unset !important;
}

/* Sortable Headers */
.si2-data-table thead th.si2-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.si2-data-table thead th.si2-sortable:hover {
    background-color: #f5f5f5;
}

.si2-header-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.si2-sort-icon {
    display: inline-flex;
    align-items: center;
    opacity: 0.3;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.si2-sortable:hover .si2-sort-icon {
    opacity: 0.6;
}

.si2-sortable.si2-sort-asc .si2-sort-icon {
    opacity: 1;
    transform: rotate(0deg);
}

.si2-sortable.si2-sort-desc .si2-sort-icon {
    opacity: 1;
    transform: rotate(180deg);
}

.si2-sort-icon svg {
    width: 12px;
    height: 12px;
    stroke: #424242;
}

.si2-data-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.si2-data-table tbody tr:hover {
    background-color: #fafafa;
}

.si2-data-table tbody tr:last-child {
    border-bottom: none;
}

.si2-data-table tbody td {
    padding: 12px 16px;
    color: #616161;
    vertical-align: middle;
}

/* Table Footer */
.si2-table-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 16px;
}

/* Rows Per Page */
.si2-rows-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
}

.si2-rows-per-page label {
    font-size: 14px;
    color: #616161;
    margin: 0;
}

.si2-rows-select {
    width: auto;
    padding: 6px 32px 6px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fff;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg width="12" height="8" viewBox="0 0 12 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L6 6L11 1" stroke="%23616161" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    font-size: 14px;
    color: #424242;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.2s ease;
}

.si2-rows-select:hover {
    border-color: #bdbdbd;
}

.si2-rows-select:focus {
    outline: none;
    border-color: #1976d2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

/* Pagination Info */
.si2-pagination-info {
    display: flex;
    align-items: center;
    justify-content: center;
}

.si2-page-indicator {
    font-size: 14px;
    color: #616161;
}

/* Pagination Controls */
.si2-pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.si2-prev-page,
.si2-next-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background-color: #fff;
    color: #424242;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.si2-prev-page:hover:not(:disabled),
.si2-next-page:hover:not(:disabled) {
    background-color: #f5f5f5;
    border-color: #bdbdbd;
}

.si2-prev-page:active:not(:disabled),
.si2-next-page:active:not(:disabled) {
    background-color: #eeeeee;
}

.si2-prev-page:disabled,
.si2-next-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.si2-prev-page svg,
.si2-next-page svg {
    width: 20px;
    height: 20px;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .si2-table-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .si2-rows-per-page,
    .si2-pagination-info,
    .si2-pagination-controls {
        justify-content: center;
    }
    
    .si2-data-table {
        font-size: 13px;
    }
    
    .si2-data-table thead th,
    .si2-data-table tbody td {
        padding: 10px 12px;
    }
}

@media screen and (max-width: 640px) {
    .si2-data-table {
        font-size: 12px;
    }
    
    .si2-data-table thead th,
    .si2-data-table tbody td {
        padding: 8px 10px;
    }
    
    .si2-estado-badge {
        padding: 3px 8px;
        font-size: 11px;
    }
}

/* ESTILOS PARA PLANTILLAS */

/* Titular Column */
.si2-titular-main {
    color: #1976d2;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 2px;
}

.si2-titular-main:hover {
    text-decoration: underline;
}

.si2-titular-sub {
    color: #757575;
    font-size: 13px;
}

/* Estado Pagos Badges */
.si2-estado-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: lowercase;
}

.si2-estado-pagado {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.si2-estado-pendiente {
    background-color: #fff3e0;
    color: #e65100;
}

.si2-estado-impagado {
    background-color: #ffebee;
    color: #c62828;
}

.si2-estado-default {
    background-color: #e0e0e0;
    color: #616161;
}

/* Mapa Link */
.si2-mapa-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.si2-mapa-link:hover {
    color: #1565c0;
    text-decoration: underline;
}

.si2-mapa-link svg {
    width: 16px;
    height: 16px;
}