/* ===================================================================
   ESTILOS GENERALES Y LAYOUT PRINCIPAL
   =================================================================== */

.lswp-form-wrap {
    max-width: 1200px;
    margin: 20px 0;
}

.lswp-form-row {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.lswp-form-group {
    flex: 1;
    min-width: 250px;
    margin-right: 20px;
    margin-bottom: 15px;
}

.lswp-form-group:last-child {
    margin-right: 0;
}

.lswp-form-group-full {
    flex: 100%;
    width: 100%;
}

.lswp-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.lswp-form-group input[type="text"],
.lswp-form-group input[type="email"],
.lswp-form-group input[type="tel"],
.lswp-form-group select,
.lswp-form-group textarea {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.lswp-form-section {
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 4px;
    border: 2px solid #e5e5e5;
}

.lswp-form-section h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.lswp-form-submit {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lswp-form-status {
    flex: 1;
    margin-right: 15px;
}

/* ===================================================================
   CAMPOS PERSONALIZADOS
   =================================================================== */

.lswp-custom-field-row {
    display: flex;
    margin-bottom: 10px;
}

.lswp-form-group-actions {
    flex: 0 0 auto;
    width: auto;
}

/* ===================================================================
   TABLAS Y LISTADOS
   =================================================================== */

.lswp-clients-table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.lswp-clients-table {
    width: 100%;
    border-collapse: collapse;
}

.lswp-clients-table th,
.lswp-clients-table td {
    padding: 10px;
    text-align: left;
}

.lswp-clients-table th {
    background-color: #f1f1f1;
}

.lswp-col-id {
    width: 50px;
}

.lswp-col-type,
.lswp-col-status {
    width: 100px;
}

.lswp-col-created {
    width: 150px;
}

.lswp-col-actions {
    width: 150px;
}

/* ===================================================================
   BADGES Y ESTADOS
   =================================================================== */

.lswp-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.lswp-status-active {
    background-color: #d4edda;
    color: #155724;
}

.lswp-status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

.lswp-status-pending {
    background: #fff7e6;
    color: #f0ad4e;
}

.lswp-status-paid {
    background: #ecf7ed;
    color: #46b450;
}

.lswp-status-overdue {
    background: #fef1f1;
    color: #dc3232;
    border: 1px solid #dc3232;
}

.lswp-status-cancelled {
    background: #f5f5f5;
    color: #666;
}

/* ===================================================================
   FILTROS Y BÚSQUEDA
   =================================================================== */

.lswp-filters {
    background: #fff;
    padding: 15px;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    margin-bottom: 20px;
}

.lswp-filters-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 10px;
}

.lswp-filter-group {
    margin-right: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.lswp-filter-group label {
    margin-right: 8px;
    font-weight: 600;
}

.lswp-search-group {
    display: flex;
    flex: 1;
}

.lswp-search-group input {
    flex: 1;
    margin-right: 10px;
}

.lswp-actions-row {
    display: flex;
    justify-content: flex-end;
}

/* ===================================================================
   PAGINACIÓN
   =================================================================== */

.lswp-pagination {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lswp-pagination-controls {
    display: flex;
    align-items: center;
}

.lswp-pagination-pages {
    margin: 0 10px;
}

/* ===================================================================
   VALIDACIÓN DE FORMULARIOS
   =================================================================== */

.lswp-form-group input.error,
.lswp-form-group select.error,
.lswp-form-group textarea.error {
    border-color: #dc3232;
}

.required {
    color: #dc3232;
}

.lswp-user-linked {
    display: inline-block;
    margin-left: 5px;
    color: #0073aa;
    font-size: 18px;
    vertical-align: middle;
}

.lswp-user-linked:hover {
    color: #00a0d2;
}


.lswp-note-preview {
    background: #f8fafc;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #8b5cf6;
    margin-top: 10px;
    font-style: italic;
    color: #334155;
}

.lswp-event-details-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.lswp-event-details-list li {
    padding: 5px 0;
    color: #475569;
}

.lswp-event-details-list li strong {
    color: #1e293b;
    margin-right: 5px;
}


.lswp-billing-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
}

.lswp-summary-card {
    flex: 1;
    background: #fff;
    border: 1px solid #ccd0d4;
    padding: 20px;
    text-align: center;
    border-radius: 4px;
}

.lswp-summary-card h4 {
    margin: 0 0 10px 0;
    color: #23282d;
}

.lswp-summary-card .amount {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.lswp-summary-card .amount.paid {
    color: #46b450;
}

.lswp-summary-card .amount.pending {
    color: #f0ad4e;
}

.lswp-summary-card .amount.overdue {
    color: #dc3232;
    font-weight: bold;
}

.lswp-billing-filters {
    background: #fff;
    padding: 15px;
    border: 1px solid #ccd0d4;
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.lswp-billing-filters .lswp-filter-group {
    flex: 0 0 auto;
}

.lswp-billing-filters .lswp-filter-field {
    width: 150px;
}

.lswp-billing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.lswp-billing-header h3 {
    margin: 0;
}

.lswp-billing-actions {
    display: flex;
    gap: 10px;
}

.lswp-billing-actions .dashicons {
    margin-right: 5px;
    vertical-align: text-bottom;
}

/* ===================================================================
   MODALES
   =================================================================== */

.lswp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px 0;
    -webkit-overflow-scrolling: touch;
}

.lswp-modal-content {
    background: #fff;
    width: 720px;
    max-width: 95%;
    max-height: 90vh;
    min-height: min-content;
    margin: auto;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.lswp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.lswp-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.lswp-modal-title:before {
    content: "📄";
    font-size: 24px;
}

.lswp-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.lswp-modal-close:hover {
    background: #e2e8f0;
    color: #334155;
}

.lswp-modal-body {
    padding: 25px;
    overflow-y: auto;
    flex: 1;
    max-height: calc(90vh - 160px);
}

.lswp-modal-footer {
    padding: 20px 25px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===================================================================
   CAMPOS DE FORMULARIO EN MODALES
   =================================================================== */

.lswp-form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.lswp-form-field {
    flex: 1;
    min-width: 0;
}

.lswp-form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #334155;
    font-size: 14px;
}

.lswp-form-field .required {
    color: #ef4444;
    margin-left: 2px;
}

.lswp-form-field input,
.lswp-form-field select,
.lswp-form-field textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    background-color: #fff;
}

.lswp-form-field input:focus,
.lswp-form-field select:focus,
.lswp-form-field textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lswp-form-field input[readonly] {
    background-color: #f8fafc;
    cursor: not-allowed;
}

.lswp-form-field textarea {
    resize: vertical;
    min-height: 80px;
}

.lswp-form-field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.lswp-form-field-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.lswp-form-field-icon::before {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 16px;
    z-index: 1;
}

.lswp-form-field-icon input {
    padding-left: 40px;
}

.lswp-field-currency::before {
    content: "$";
}

.lswp-field-date::before {
    content: "📅";
}

.lswp-field-select::before {
    content: "💳";
}

.lswp-form-field-group {
    display: flex;
    gap: 10px;
}

.lswp-form-field-group .lswp-form-field {
    flex: 3;
}

.lswp-form-field-group .lswp-form-field-small {
    flex: 1;
}

.lswp-help-text {
    font-size: 12px;
    color: #475569;
    margin-top: 6px;
    display: block;
}

/* ===================================================================
   BOTONES Y CONTROLES
   =================================================================== */

.lswp-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.lswp-btn-primary {
    background: #3b82f6;
    color: #fff;
    border: none;
}

.lswp-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

.lswp-btn-secondary {
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.lswp-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.lswp-btn.loading {
    opacity: 0.7;
    cursor: not-allowed;
}

.lswp-btn.loading .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ===================================================================
   VISUALIZACIÓN DE MONTOS
   =================================================================== */

.lswp-amount-display {
    text-align: right;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.lswp-amount-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 30px;
    margin-bottom: 10px;
}

.lswp-amount-label {
    color: #64748b;
    font-size: 14px;
}

.lswp-amount-value {
    font-weight: 600;
    font-size: 16px;
    color: #334155;
    min-width: 120px;
    text-align: right;
}

.lswp-amount-total {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #e2e8f0;
}

.lswp-amount-total .lswp-amount-label {
    font-weight: 600;
    color: #334155;
}

.lswp-amount-total .lswp-amount-value {
    font-size: 20px;
    color: #16a34a;
}

/* ===================================================================
   NOTIFICACIONES
   =================================================================== */

.lswp-notification {
    position: fixed;
    top: 32px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.lswp-notification.show {
    transform: translateX(0);
}

.lswp-notification-success {
    border-left: 4px solid #46b450;
}

.lswp-notification-error {
    border-left: 4px solid #dc3232;
}

/* ===================================================================
   AVISO DE FUNCIONALIDAD PREMIUM
   =================================================================== */

.lswp-premium-notice {
    margin: 20px 0;
    padding: 15px 20px;
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.lswp-premium-notice h4 {
    margin: 0 0 10px 0;
    color: #2271b1;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.lswp-premium-notice .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.lswp-premium-notice p {
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.lswp-premium-notice p:last-child {
    margin-bottom: 0;
}

/* ===================================================================
   ANIMACIONES
   =================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}


#mark-paid-modal.lswp-modal {
    animation: fadeIn 0.3s ease-out;
}

/* ===================================================================
   SCROLL Y BARRAS DE DESPLAZAMIENTO
   =================================================================== */

.lswp-modal::-webkit-scrollbar {
    width: 8px;
}

.lswp-modal::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.lswp-modal::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.lswp-modal::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.5);
}

/* ===================================================================
   RESPONSIVE (MÓVILES Y TABLETS)
   =================================================================== */

@media screen and (max-width: 782px) {
    .lswp-form-group {
        flex: 100%;
        margin-right: 0;
    }

    .lswp-col-type,
    .lswp-col-created,
    .lswp-col-status {
        display: none;
    }


    .lswp-checkbox-group {
        flex-direction: column;
    }

    .lswp-checkbox-label {
        margin-bottom: 10px;
    }
}

@media (max-width: 640px) {
    .lswp-form-row {
        flex-direction: column;
        gap: 15px;
    }

    .lswp-modal {
        padding: 10px 0;
    }

    .lswp-modal-content {
        margin: 10px;
        max-height: 95vh;
    }

    .lswp-modal-body {
        max-height: calc(95vh - 140px);
    }

    .lswp-modal-footer {
        flex-direction: column;
    }

    .lswp-btn {
        width: 100%;
        justify-content: center;
    }

    .lswp-amount-row {
        flex-direction: column;
        align-items: flex-end;
        gap: 5px;
    }
}

@media (max-width: 500px) {
    #mark-paid-modal .lswp-modal-content {
        max-width: 95% !important;
        margin: 10px;
    }

    #mark-paid-modal .lswp-modal-footer {
        flex-direction: column;
        gap: 10px;
    }

    #mark-paid-modal .lswp-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================================================
   BADGES DE ESTADOS DE FACTURAS
   =================================================================== */

/* Estado Pendiente - Amarillo/Naranja */
.status-pending {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Estado Pagado - Verde */
.status-paid {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Estado Vencido - Rojo */
.status-overdue {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f1b0b7;
    position: relative;
}

/* Estado Cancelado - Gris */
.status-cancelled {
    background-color: #e2e3e5;
    color: #383d41;
    border: 1px solid #d1d3d4;
}

/* Estilos para días vencidos */
.days-overdue {
    font-weight: bold;
    margin-left: 4px;
}

/* Efecto hover para todos los badges */
.lswp-status-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

/* Animación sutil para estados críticos */
.status-overdue {
    animation: subtle-pulse 2s infinite;
}

@keyframes subtle-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}