/* Morosidad Module Styles */

.morosidad-container {
    padding: 20px;
    background-color: #fff;
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.morosidad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.morosidad-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
}

/* Filter Panel */
.morosidad-filters {
    background: white;
    padding: 12px 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px 20px;
}

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

.filter-group label {
    width: 110px;
    font-size: 13px;
    font-weight: 600;
    color: var(--blue);
    flex-shrink: 0;
}

.filter-control {
    flex-grow: 1;
    position: relative;
}

.filter-control input[type="text"],
.filter-control input[type="number"],
.filter-control select,
.datepicker-wrapper input[type="date"] {
    width: 100%;
    height: 32px;
    padding: 0 10px;
    border: 1.5px solid var(--gray-d);
    border-radius: 5px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--ink);
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}

.filter-control input:focus,
.filter-control select:focus,
.datepicker-wrapper input:focus {
    border-color: var(--blue);
}

.filter-control-range {
    display: flex;
    gap: 10px;
}

.range-input-wrapper {
    display: flex;
    flex: 1;
    border: 1.5px solid var(--gray-d);
    border-radius: 5px;
    overflow: hidden;
    height: 32px;
    background: #fff;
    transition: border-color 0.15s;
}

.range-input-wrapper:focus-within {
    border-color: var(--blue);
}

.range-input-wrapper input {
    flex: 1;
    border: none !important;
    height: 100% !important;
    padding: 0 10px !important;
    outline: none;
    font-size: 12.5px;
    background: transparent;
}

.range-unit {
    background: #f8f9fa;
    border-left: 1.5px solid var(--gray-d);
    padding: 0 10px;
    display: flex;
    align-items: center;
    color: var(--ink-m);
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.datepicker-wrapper {
    position: relative;
    flex: 1;
}

/* Custom Multiselect */
.multi-select-toggle {
    width: 100%;
    height: 32px;
    padding: 0 30px 0 10px; /* Space for icon on the right */
    border: 1.5px solid var(--gray-d);
    border-radius: 5px;
    background: #fff url('data:image/svg+xml;charset=utf8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpath d="M6 9l6 6 6-6"/%3E%3C/svg%3E') no-repeat right 10px center;
    text-align: left;
    font-size: 12.5px;
    color: var(--ink-m);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s;
    appearance: none;
    -webkit-appearance: none;
}

.multi-select-toggle::after {
    display: none; /* Icon is now in background */
}

/* Detalle View */
.morosidad-detalle-view, .morosidad-pago-view {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    padding: 0;
    margin-top: 10px;
    overflow-y: auto;
    max-height: calc(100vh - var(--topbar-h) - 40px);
}

.detalle-header, .pago-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    background: #fdfdfd;
}

.detalle-title, .pago-title {
    font-size: 16px;
    color: #333;
}

.btn-cancelar-detalle, .btn-cancelar-pago {
    background: #e67e22;
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.btn-cancelar-detalle:hover, .btn-cancelar-pago:hover {
    background: #d35400;
}

.detalle-table-container {
    padding: 0;
}

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

.detalle-table th {
    text-align: left;
    padding: 6px 15px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #f0f0f0;
    background: #f9f9f9;
}

.detalle-table td {
    padding: 4px 15px;
    font-size: 13px;
    color: #444;
    border-bottom: 1px solid #eee;
}

.btn-select-all {
    background: #3498db;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.detalle-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px 25px;
    gap: 20px;
    background: #f9f9f9;
    border-top: 1px solid #eee;
}

.footer-selection-info {
    font-size: 13px;
    color: #666;
}

.btn-registrar-pagos {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-registrar-pagos:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
}

/* Pago Form */
.pago-form {
    padding: 30px 50px;
    max-width: 900px;
}

.pago-field-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.pago-field-row label {
    width: 150px;
    font-size: 13px;
    color: #555;
    flex-shrink: 0;
}

.pago-field-value {
    font-size: 14px;
    color: #333;
}

.pago-input, .pago-select, .pago-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    color: #333;
    background: white;
}

.pago-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2212%22%20height%3D%2212%22%20viewBox%3D%220%200%2012%2012%22%3E%3Cpath%20fill%3D%22%23333%22%20d%3D%22M10.293%203.293L6%207.586%201.707%203.293A1%201%200%2000.293%204.707l5%205a1%201%200%20001.414%200l5-5a1%201%200%2010-1.414-1.414z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.pago-summary-row {
    display: flex;
    gap: 40px;
    margin: 20px 0 20px 150px;
}

.pago-summary-item label {
    display: block;
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
}

.pago-total-val, .pago-pendiente-val {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.pago-flex-row {
    margin-left: 150px;
    gap: 15px;
}

.pago-flex-row label {
    width: auto;
}

.pago-subfield {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pago-input-with-unit {
    position: relative;
    display: flex;
}

.pago-unit {
    position: absolute;
    right: 1px;
    top: 1px;
    bottom: 1px;
    background: #f5f5f5;
    padding: 0 10px;
    display: flex;
    align-items: center;
    border-left: 1px solid #ddd;
    font-weight: 600;
    color: #777;
    border-radius: 0 4px 4px 0;
}

.pago-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #777;
}

.pago-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    padding-left: 150px;
}

.btn-añadir-producto, .btn-anotar-pago {
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
}

.btn-añadir-producto {
    background: #3498db;
}

.btn-anotar-pago {
    background: #27ae60;
}

.pago-concepts-table {
    border-top: 1px solid #eee;
    padding: 20px 25px;
}

.pago-concepts-table table {
    width: 100%;
    border-collapse: collapse;
}

.pago-concepts-table th {
    text-align: left;
    font-size: 12px;
    color: #888;
    padding-bottom: 10px;
}

.pago-concepts-table td {
    padding: 12px 0;
    font-size: 13px;
    color: #444;
    border-top: 1px solid #f5f5f5;
}

.concept-tag {
    background: #3498db;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    margin-left: 8px;
}

/* Small adjustments to main table buttons */
.btn-detalle-small {
    background: #3498db;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.btn-detalle-small:hover {
    opacity: 0.8;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.multi-select-dropdown.active {
    display: block;
}

.multi-select-option {
    padding: 5px 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    cursor: pointer;
}

.multi-select-option:hover {
    background-color: #f0f0f0;
}

.multi-select-option input[type="checkbox"] {
    margin: 0;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 15px;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

/* Table Area */
.morosidad-table-container {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 10px;
}

.table-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-excel {
    background-color: #2196f3;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    text-transform: uppercase;
    font-weight: bold;
}

.btn-excel:hover {
    background-color: #1976d2;
}

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

.morosidad-table th {
    text-align: left;
    padding: 6px 15px;
    border-bottom: 2px solid #eee;
    font-size: 0.9rem;
    color: #333;
    background: #fdfdfd;
}

.morosidad-table td {
    padding: 4px 15px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85rem;
    color: #555;
}

.morosidad-table tr:hover {
    background-color: #f9f9f9;
}

.btn-cobrar-small {
    background-color: #2196f3;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    padding: 10px;
}

.pagination-info {
    font-size: 0.85rem;
    color: #777;
}

.pagination-controls {
    display: flex;
    gap: 2px;
}

.page-btn {
    padding: 5px 10px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    font-size: 0.85rem;
}

.page-btn.active {
    background-color: #2196f3;
    color: white;
    border-color: #2196f3;
}

.page-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* Modificar Precio View */
.morosidad-modificar-precio-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #f1f1f1;
}

.modificar-precio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
    background: white;
    border-bottom: 1px solid #ddd;
}

.header-breadcrumb {
    font-size: 14px;
    font-weight: bold;
    color: #999;
}

.header-breadcrumb .active {
    color: #333;
}

.btn-cancelar-modificar {
    background: #e67e22;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
}

.modificar-precio-content {
    display: flex;
    gap: 20px;
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.resumen-panel {
    flex: 1;
    background: white;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: fit-content;
}

.desglose-panel {
    flex: 2;
    background: white;
    padding: 0;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 15px 20px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    font-size: 13px;
    color: #555;
    text-transform: uppercase;
}

.resumen-row {
    padding: 15px 20px;
    border-bottom: 1px solid #f9f9f9;
}

.resumen-row label {
    display: block;
    font-size: 12px;
    color: #888;
    margin-bottom: 5px;
}

.resumen-value {
    font-weight: bold;
    color: #333;
}

.resumo-total {
    background: #fff;
}

.concept-list {
    padding: 10px 0;
    flex: 1;
}

.concept-edit-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f5f5f5;
}

.concept-name {
    font-size: 13px;
    color: #333;
}

.concept-price-input {
    width: 150px;
}

.desglose-actions {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    border-top: 1px solid #eee;
}

.btn-reiniciar-precios {
    background: #f39c12;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}

.btn-guardar-precios {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
}
