/* ============================================================================ */
/* 🎨 CSS COMPLETO PARA SISTEMA DE CUENTAS CORRIENTES */
/* ============================================================================ */

/* Reset y configuración base para el contenedor */
.cuentas-corrientes-wrapper {
  width: 100%;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #1e293b;
}

.cuentas-corrientes-wrapper * {
  box-sizing: border-box;
}

.cuentas-corrientes-wrapper .app-container {
  display: flex;
  height: 100%;
  background: #f8fafc;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* ============================================================================ */
/* 📱 PANEL LATERAL IZQUIERDO */
/* ============================================================================ */

.cuentas-corrientes-wrapper .sidebar {
  height: calc(100vh - 200px);
  width: 350px;
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.cuentas-corrientes-wrapper .sidebar-header {
  padding: 24px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.cuentas-corrientes-wrapper .sidebar-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.cuentas-corrientes-wrapper .sidebar-subtitle {
  font-size: 14px;
  opacity: 0.9;
}

/* Filtros */
.cuentas-corrientes-wrapper .filters {
  padding: 20px;
  border-bottom: 1px solid #e2e8f0;
}

.cuentas-corrientes-wrapper .search-box {
  position: relative;
  margin-bottom: 16px;
}

.cuentas-corrientes-wrapper .search-input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
}

.cuentas-corrientes-wrapper .search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cuentas-corrientes-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6b7280;
  font-size: 14px;
}

.cuentas-corrientes-wrapper .filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.cuentas-corrientes-wrapper .filter-btn {
  padding: 6px 12px;
  border: 1px solid #d1d5db;
  background: white;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  color: #374151;
}

.cuentas-corrientes-wrapper .filter-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.cuentas-corrientes-wrapper .filter-btn:hover {
  border-color: #667eea;
}

/* Lista de clientes */
.cuentas-corrientes-wrapper .clients-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.cuentas-corrientes-wrapper .client-item {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  background: white;
}

.cuentas-corrientes-wrapper .client-item:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cuentas-corrientes-wrapper .client-item.active {
  background: #eff6ff;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.cuentas-corrientes-wrapper .client-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .client-balance {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 4px;
}

.cuentas-corrientes-wrapper .balance-positive {
  color: #dc2626;
}

.cuentas-corrientes-wrapper .balance-negative {
  color: #16a34a;
}

.cuentas-corrientes-wrapper .balance-zero {
  color: #6b7280;
}

.cuentas-corrientes-wrapper .client-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
}

.cuentas-corrientes-wrapper .status-deudor {
  background: #fef2f2;
  color: #dc2626;
}

.cuentas-corrientes-wrapper .status-favor {
  background: #f0fdf4;
  color: #16a34a;
}

.cuentas-corrientes-wrapper .status-al-dia {
  background: #f1f5f9;
  color: #64748b;
}

/* ============================================================================ */
/* 🖥️ VISTA PRINCIPAL */
/* ============================================================================ */

.cuentas-corrientes-wrapper .main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cuentas-corrientes-wrapper .main-header {
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 24px;
}

.cuentas-corrientes-wrapper .client-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: start;
}

.cuentas-corrientes-wrapper .client-info h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .client-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  font-size: 14px;
  color: #64748b;
}

.cuentas-corrientes-wrapper .detail-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cuentas-corrientes-wrapper .header-actions {
  display: flex;
  gap: 12px;
}

/* Botones */
.cuentas-corrientes-wrapper .btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.cuentas-corrientes-wrapper .btn-primary {
  background: #667eea;
  color: white;
}

.cuentas-corrientes-wrapper .btn-primary:hover {
  background: #5a67d8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.cuentas-corrientes-wrapper .btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #d1d5db;
}

.cuentas-corrientes-wrapper .btn-secondary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cuentas-corrientes-wrapper .btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.cuentas-corrientes-wrapper .btn-edit {
  background: #f59e0b;
  color: white;
}

.cuentas-corrientes-wrapper .btn-edit:hover {
  background: #d97706;
}

.cuentas-corrientes-wrapper .btn-delete {
  background: #ef4444;
  color: white;
}

.cuentas-corrientes-wrapper .btn-delete:hover {
  background: #dc2626;
}

/* ============================================================================ */
/* 📊 TARJETAS RESUMEN */
/* ============================================================================ */

.cuentas-corrientes-wrapper .summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  padding: 24px;
  background: #f8fafc;
}

.cuentas-corrientes-wrapper .summary-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}

.cuentas-corrientes-wrapper .summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
}

.cuentas-corrientes-wrapper .summary-card:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}

.cuentas-corrientes-wrapper .card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cuentas-corrientes-wrapper .card-icon {
  font-size: 20px;
}

.cuentas-corrientes-wrapper .card-title {
  font-size: 14px;
  color: #64748b;
  font-weight: 500;
}

.cuentas-corrientes-wrapper .card-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .card-subtitle {
  font-size: 12px;
  color: #94a3b8;
}

/* ============================================================================ */
/* 📋 SECCIÓN DE MOVIMIENTOS */
/* ============================================================================ */

.cuentas-corrientes-wrapper .movements-section {
  flex: 1;
  background: white;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cuentas-corrientes-wrapper .movements-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: #fafbfc;
}

.cuentas-corrientes-wrapper .movements-title {
  font-size: 18px;
  font-weight: 600;
  flex: 1;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .filters-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.cuentas-corrientes-wrapper .date-filter {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: white;
  color: #374151;
}

.cuentas-corrientes-wrapper .date-filter:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Tabla de movimientos */
.cuentas-corrientes-wrapper .movements-table-container {
  flex: 1;
  overflow: auto;
}

.cuentas-corrientes-wrapper .movements-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cuentas-corrientes-wrapper .movements-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.cuentas-corrientes-wrapper .movements-table td {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
  color: #374151;
}

.cuentas-corrientes-wrapper .movements-table tr:hover {
  background: #f8fafc;
}

.cuentas-corrientes-wrapper .movement-type {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.cuentas-corrientes-wrapper .type-factura {
  background: #fef3c7;
  color: #92400e;
}

.cuentas-corrientes-wrapper .type-pago {
  background: #d1fae5;
  color: #166534;
}

.cuentas-corrientes-wrapper .type-nota-credito {
  background: #dbeafe;
  color: #1e40af;
}

.cuentas-corrientes-wrapper .type-ajuste {
  background: #f3e8ff;
  color: #7c3aed;
}

.cuentas-corrientes-wrapper .amount-debit {
  color: #dc2626;
  font-weight: 600;
}

.cuentas-corrientes-wrapper .amount-credit {
  color: #16a34a;
  font-weight: 600;
}

.cuentas-corrientes-wrapper .amount-balance {
  font-weight: 700;
}

.cuentas-corrientes-wrapper .actions-cell {
  display: flex;
  gap: 8px;
}

/* ============================================================================ */
/* 🪟 MODAL */
/* ============================================================================ */

.cuentas-corrientes-wrapper .modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.cuentas-corrientes-wrapper .modal-content {
  background: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cuentas-corrientes-wrapper .modal-header {
  padding: 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fafbfc;
}

.cuentas-corrientes-wrapper .modal-title {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #64748b;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cuentas-corrientes-wrapper .close:hover {
  background: #f1f5f9;
  color: #1e293b;
}

.cuentas-corrientes-wrapper .modal-body {
  padding: 24px;
  overflow-y: auto;
}

/* ============================================================================ */
/* 📝 FORMULARIOS */
/* ============================================================================ */

.cuentas-corrientes-wrapper .form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cuentas-corrientes-wrapper .form-group {
  margin-bottom: 16px;
}

.cuentas-corrientes-wrapper .form-group.full-width {
  grid-column: 1 / -1;
}

.cuentas-corrientes-wrapper .form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: #374151;
}

.cuentas-corrientes-wrapper .form-input, 
.cuentas-corrientes-wrapper .form-select, 
.cuentas-corrientes-wrapper .form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: white;
  color: #374151;
}

.cuentas-corrientes-wrapper .form-input:focus, 
.cuentas-corrientes-wrapper .form-select:focus, 
.cuentas-corrientes-wrapper .form-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cuentas-corrientes-wrapper .form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* ============================================================================ */
/* 🔍 ESTADO VACÍO */
/* ============================================================================ */

.cuentas-corrientes-wrapper .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #64748b;
}

.cuentas-corrientes-wrapper .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.cuentas-corrientes-wrapper .empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #374151;
}

.cuentas-corrientes-wrapper .empty-state p {
  font-size: 14px;
  color: #6b7280;
}

/* ============================================================================ */
/* 📱 RESPONSIVE DESIGN */
/* ============================================================================ */

@media (max-width: 1024px) {
  .cuentas-corrientes-wrapper .sidebar {
    width: 300px;
  }
  
  .cuentas-corrientes-wrapper .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .cuentas-corrientes-wrapper .movements-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .cuentas-corrientes-wrapper .filters-row {
    justify-content: space-between;
  }
}

@media (max-width: 768px) {
  .cuentas-corrientes-wrapper {
    height: calc(100vh - 150px);
  }
  
  .cuentas-corrientes-wrapper .app-container {
    flex-direction: column;
  }
  
  .cuentas-corrientes-wrapper .sidebar {
    width: 100%;
    height: 300px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .cuentas-corrientes-wrapper .client-header {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .cuentas-corrientes-wrapper .summary-cards {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .form-grid {
    grid-template-columns: 1fr;
  }
  
  .cuentas-corrientes-wrapper .movements-table-container {
    overflow-x: auto;
  }
  
  .cuentas-corrientes-wrapper .movements-table {
    min-width: 800px;
  }
  
  .cuentas-corrientes-wrapper .modal-content {
    width: 95%;
    margin: 2% auto;
  }
  
  .cuentas-corrientes-wrapper .actions-cell {
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 480px) {
  .cuentas-corrientes-wrapper .sidebar {
    height: 250px;
  }
  
  .cuentas-corrientes-wrapper .sidebar-header {
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .filters {
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .main-header {
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .summary-cards {
    padding: 12px;
    gap: 12px;
  }
  
  .cuentas-corrientes-wrapper .summary-card {
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .movements-header {
    padding: 16px;
  }
  
  .cuentas-corrientes-wrapper .modal-content {
    margin: 5% auto;
  }
  
  .cuentas-corrientes-wrapper .modal-body {
    padding: 16px;
  }
}

/* ============================================================================ */
/* 🎨 ANIMACIONES Y TRANSICIONES */
/* ============================================================================ */

.cuentas-corrientes-wrapper .client-item,
.cuentas-corrientes-wrapper .summary-card,
.cuentas-corrientes-wrapper .btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.cuentas-corrientes-wrapper .movements-table tr {
  transition: background-color 0.2s ease;
}

.cuentas-corrientes-wrapper .filter-btn,
.cuentas-corrientes-wrapper .form-input,
.cuentas-corrientes-wrapper .form-select,
.cuentas-corrientes-wrapper .form-textarea {
  transition: all 0.2s ease;
}

/* ============================================================================ */
/* 🎯 SCROLLBARS PERSONALIZADOS */
/* ============================================================================ */

.cuentas-corrientes-wrapper .clients-list::-webkit-scrollbar,
.cuentas-corrientes-wrapper .movements-table-container::-webkit-scrollbar {
  width: 6px;
}

.cuentas-corrientes-wrapper .clients-list::-webkit-scrollbar-track,
.cuentas-corrientes-wrapper .movements-table-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 3px;
}

.cuentas-corrientes-wrapper .clients-list::-webkit-scrollbar-thumb,
.cuentas-corrientes-wrapper .movements-table-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.cuentas-corrientes-wrapper .clients-list::-webkit-scrollbar-thumb:hover,
.cuentas-corrientes-wrapper .movements-table-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ============================================================================ */
/* 🌟 EFECTOS ESPECIALES */
/* ============================================================================ */

.cuentas-corrientes-wrapper .summary-card:nth-child(1) .card-icon {
  color: #ef4444;
}

.cuentas-corrientes-wrapper .summary-card:nth-child(2) .card-icon {
  color: #f59e0b;
}

.cuentas-corrientes-wrapper .summary-card:nth-child(3) .card-icon {
  color: #10b981;
}

.cuentas-corrientes-wrapper .summary-card:nth-child(4) .card-icon {
  color: #3b82f6;
}

.cuentas-corrientes-wrapper .summary-card:nth-child(5) .card-icon {
  color: #8b5cf6;
}

/* Indicador de carga */
.cuentas-corrientes-wrapper .loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: #6b7280;
}

.cuentas-corrientes-wrapper .loading::after {
  content: '⏳';
  margin-left: 8px;
  animation: spin 2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}