/* Admin Panel Styles */
:root {
    --primary-color: #D4A574;
    --gold-orange: #D4A574;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #ffffff;
    --bg-light: #f5f5f5;
    --bg-dark: #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

.admin-container {
    min-height: 100vh;
    padding-bottom: 40px;
}

/* Header */
.admin-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #B8824F 100%);
    color: var(--white);
    padding: 25px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 15px;
}

.btn-refresh,
.btn-back,
.btn-add {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--white);
    background: rgba(255, 255, 255, 0.2);
}

.btn-refresh:hover,
.btn-back:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-refresh:disabled,
.btn-back:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.1);
}

.btn-refresh:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: none;
}

.btn-refresh i.fa-spin {
    animation: spin 1s linear infinite;
}

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

/* Stats Dashboard */
.stats-dashboard {
    max-width: 1400px;
    margin: 0 auto 40px;
    padding: 0 30px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--white);
    font-size: 24px;
}

.stat-icon.icon-basica {
    background: #4CAF50;
}

.stat-icon.icon-amplia {
    background: #2196F3;
}

.stat-icon.icon-gps {
    background: #FF9800;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 14px;
    color: var(--text-light);
}

/* Filters Section */
.filters-section {
    max-width: 1400px;
    margin: 0 auto 30px;
    padding: 0 30px;
}

.filters-section h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group input,
.filter-group select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-clear-filters {
    padding: 12px 20px;
    background: #f44336;
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    margin-top: 20px;
}

.btn-clear-filters:hover {
    background: #d32f2f;
    transform: translateY(-2px);
}

/* Loading & Empty States */
.loading-indicator,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-indicator i {
    font-size: 48px;
    color: var(--primary-color);
}

.empty-state i {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--text-dark);
}

/* Table Section */
.registros-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 30px;
}

.table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
}

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

.registros-table thead {
    background: var(--primary-color);
    color: var(--white);
}

.registros-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
}

.registros-table th i {
    margin-right: 8px;
}

.registros-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.registros-table tbody tr:hover {
    background: #f9f9f9;
}

.registros-table tbody tr.selected-row {
    background: #e3f2fd;
    border-left: 4px solid var(--primary-color);
}

.registros-table tbody tr.selected-row:hover {
    background: #bbdefb;
}

.row-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin: 0;
    cursor: pointer;
}

.row-checkbox:hover {
    transform: scale(1.1);
}

#selectAll {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
    margin: 0;
}

.registros-table td:first-child {
    text-align: center;
    width: 50px;
    padding: 15px 10px;
}

.registros-table td {
    padding: 15px;
    font-size: 14px;
    color: var(--text-dark);
}

.phone-link,
.email-link {
    color: var(--primary-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.phone-link:hover,
.email-link:hover {
    color: #B8824F;
    text-decoration: underline;
}

.plan-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.plan-badge.plan-basica {
    background: #E8F5E9;
    color: #2E7D32;
}

.plan-badge.plan-amplia {
    background: #E3F2FD;
    color: #1565C0;
}

.plan-badge.plan-gps {
    background: #FFF3E0;
    color: #E65100;
}

/* Action Buttons */
.btn-action {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 5px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-view {
    background: #2196F3;
    color: var(--white);
}

.btn-view:hover {
    background: #1976D2;
    transform: scale(1.05);
}

.btn-whatsapp {
    background: #25D366;
    color: var(--white);
}

.btn-whatsapp:hover {
    background: #128C7E;
    transform: scale(1.05);
}

.btn-payments {
    background: #4CAF50;
    color: var(--white);
}

.btn-payments:hover {
    background: #45a049;
    transform: scale(1.05);
}

.btn-delete {
    background: #f44336;
    color: var(--white);
}

.btn-delete:hover {
    background: #d32f2f;
    transform: scale(1.05);
}

.btn-edit {
    background: #FF9800;
    color: var(--white);
}

.btn-edit:hover {
    background: #F57C00;
    transform: scale(1.05);
}

/* Pagination */
.pagination-container {
    max-width: 1400px;
    margin: 30px auto 0;
    padding: 0 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.pagination-info {
    color: var(--text-light);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-pagination {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-pagination:hover:not(:disabled) {
    background: #B8824F;
    transform: translateY(-2px);
}

.btn-pagination:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

#currentPageInfo {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    transition: transform 0.3s;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-body {
    padding: 25px;
}

.detail-item {
    margin-bottom: 20px;
}

.detail-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 8px;
}

.detail-item p {
    font-size: 16px;
    color: var(--text-dark);
}

.detail-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.detail-item a:hover {
    text-decoration: underline;
}

.detail-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-detail {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
    color: var(--white);
}

.btn-call {
    background: #4CAF50;
}

.btn-call:hover {
    background: #45a049;
}

.btn-email {
    background: #2196F3;
}

.btn-email:hover {
    background: #1976D2;
}

.btn-whatsapp-modal {
    background: #25D366;
}

.btn-whatsapp-modal:hover {
    background: #128C7E;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input::placeholder {
    color: #999;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-submit,
.btn-cancel {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    font-family: inherit;
}

.btn-submit {
    background: var(--primary-color);
    color: var(--white);
}

.btn-submit:hover:not(:disabled) {
    background: #B8824F;
    transform: translateY(-2px);
}

.btn-submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-cancel {
    background: #f5f5f5;
    color: var(--text-dark);
    border: 2px solid #ddd;
}

.btn-cancel:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

/* Responsive Design - Admin Panel */
@media (max-width: 1024px) {
    .header-actions {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .admin-container {
        padding: 0;
    }
    
    .admin-header {
        padding: 15px 0;
    }
    
    .header-content {
        padding: 0 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .admin-header h1 {
        font-size: 20px;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .header-actions .btn-refresh,
    .header-actions .btn-back {
        width: 100%;
        justify-content: center;
    }
    
    .stats-dashboard {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 0 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .filters-section {
        padding: 0 15px;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .registros-section {
        padding: 0 15px;
    }
    
    .registros-table {
        min-width: 800px;
        font-size: 12px;
    }
    
    .registros-table th,
    .registros-table td {
        padding: 8px 5px;
    }
    
    .modal-content {
        width: 95%;
        max-width: 100%;
        margin: 20px auto;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .pagination-container {
        padding: 0 15px;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .detail-actions {
        flex-direction: column;
    }
    
    .btn-detail {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive para móviles pequeños */
@media (max-width: 480px) {
    .admin-header h1 {
        font-size: 18px;
    }
    
    .stats-dashboard {
        padding: 0 10px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-info h3 {
        font-size: 20px;
    }
    
    .filters-section {
        padding: 0 10px;
    }
    
    .registros-section {
        padding: 0 10px;
    }
    
    .modal-content {
        width: calc(100% - 20px);
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .registros-table {
        font-size: 11px;
        min-width: 700px;
    }
    
    .pagination-container {
        padding: 0 10px;
    }
}

/* ============================================
   ESTILOS PARA SISTEMA DE PAGOS
   ============================================ */

.modal-large {
    max-width: 900px;
    width: 95%;
}

.pagos-cliente-info {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.cliente-card {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 8px;
}

.cliente-card h3 {
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 20px;
}

.cliente-card p {
    margin: 5px 0;
    color: var(--text-light);
    font-size: 14px;
}

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

.pagos-header h3 {
    font-size: 20px;
    color: var(--text-dark);
}

.btn-add-pago {
    padding: 10px 20px;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.btn-add-pago:hover {
    background: #B8824F;
    transform: translateY(-2px);
}

.pagos-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 600;
    text-transform: uppercase;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-pendiente {
    color: #FF9800;
}

.pagos-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.pagos-table thead {
    background: var(--primary-color);
    color: var(--white);
}

.pagos-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
}

.pagos-table tbody tr {
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.pagos-table tbody tr:hover {
    background: #f9f9f9;
}

.pagos-table td {
    padding: 12px;
    font-size: 13px;
    color: var(--text-dark);
}

.estado-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.estado-completado {
    background: #E8F5E9;
    color: #2E7D32;
}

.estado-pendiente {
    background: #FFF3E0;
    color: #E65100;
}

.estado-cancelado {
    background: #FFEBEE;
    color: #C62828;
}

.pagos-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive para pagos */
@media (max-width: 768px) {
    .modal-large {
        width: 98%;
        max-height: 95vh;
    }
    
    .pagos-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .pagos-stats {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagos-table {
        font-size: 11px;
    }
    
    .pagos-table th,
    .pagos-table td {
        padding: 8px 4px;
    }
}
