/**
 * ESTILOS: Reportes de Retenciones en la Fuente (RFT)
 */

:root {
  --rft-primary: #4ECDC4;
  --rft-secondary: #45B7D1;
  --rft-warning: #FF6B6B;
  --rft-success: #6BCB77;
  --rft-danger: #FFD93D;
  --rft-bg: #f5f6fa;
  --rft-border: #e0e0e0;
  --rft-text: #333;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* CONTENEDOR PRINCIPAL */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  background: var(--rft-bg);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--rft-text);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* HEADER */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px;
  background: linear-gradient(135deg, var(--rft-primary), var(--rft-secondary));
  border-radius: 8px;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.rft-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
}

.rft-info-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid white;
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.rft-info-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* SECCIONES */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--rft-border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rft-section h3 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 20px;
  color: var(--rft-primary);
  border-bottom: 2px solid var(--rft-primary);
  padding-bottom: 10px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* KPIs */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.rft-kpi {
  background: linear-gradient(135deg, #f5f6fa, white);
  border: 2px solid var(--rft-border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.rft-kpi:hover {
  border-color: var(--rft-primary);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.2);
  transform: translateY(-2px);
}

.rft-kpi.warning {
  border-color: var(--rft-warning);
}

.rft-kpi.warning .kpi-label {
  color: var(--rft-warning);
}

.kpi-label {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--rft-primary);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* FILTROS */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-filtro-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  align-items: flex-end;
}

.filtro-grupo {
  display: flex;
  flex-direction: column;
}

.filtro-grupo label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--rft-text);
}

.filtro-grupo input,
.filtro-grupo select {
  padding: 8px 12px;
  border: 1px solid var(--rft-border);
  border-radius: 4px;
  font-size: 14px;
  min-width: 140px;
}

.filtro-grupo input:focus,
.filtro-grupo select:focus {
  outline: none;
  border-color: var(--rft-primary);
  box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* BOTONES */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-btn-primary,
.rft-btn-secondary {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

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

.rft-btn-primary:hover {
  background: #3eb8a9;
  box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

.rft-btn-secondary {
  background: var(--rft-border);
  color: var(--rft-text);
}

.rft-btn-secondary:hover {
  background: #d0d0d0;
}

.rft-btn-small {
  padding: 5px 10px;
  background: var(--rft-secondary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s ease;
}

.rft-btn-small:hover {
  background: #3b9fb5;
  transform: scale(1.05);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* GRÁFICOS */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-graficos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.rft-grafico-card {
  background: white;
  border: 1px solid var(--rft-border);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.rft-grafico-card h4 {
  margin: 0 0 15px 0;
  color: var(--rft-primary);
  font-size: 16px;
}

.rft-grafico-card canvas {
  max-height: 300px;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* TABLAS */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rft-table thead {
  background: linear-gradient(135deg, var(--rft-primary), var(--rft-secondary));
  color: white;
}

.rft-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border: none;
}

.rft-table tbody tr {
  border-bottom: 1px solid var(--rft-border);
  transition: background 0.2s ease;
}

.rft-table tbody tr:hover {
  background: #f9fafb;
}

.rft-table td {
  padding: 12px;
}

.deuda-warning {
  color: var(--rft-warning);
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* BADGES */
/* ═══════════════════════════════════════════════════════════════════ */

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

.badge-generado {
  background: #FFE5E5;
  color: #CC0000;
}

.badge-enviado {
  background: #E5F5E5;
  color: #00CC00;
}

.badge-pendiente_liquidacion {
  background: #FFF5E5;
  color: #CC6600;
}

.badge-liquidado {
  background: #E5E5FF;
  color: #0000CC;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* BOTONES DE EXPORTACIÓN */
/* ═══════════════════════════════════════════════════════════════════ */

.rft-export-btns {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.rft-btn-export {
  flex: 1;
  min-width: 150px;
  padding: 15px 20px;
  border: 2px solid var(--rft-border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.rft-btn-export.csv {
  border-color: #FFB700;
  color: #FFB700;
}

.rft-btn-export.csv:hover {
  background: #FFF5E5;
  box-shadow: 0 4px 12px rgba(255, 183, 0, 0.2);
}

.rft-btn-export.pdf {
  border-color: #FF6B6B;
  color: #FF6B6B;
}

.rft-btn-export.pdf:hover {
  background: #FFE5E5;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
}

.rft-btn-export.siigo {
  border-color: var(--rft-primary);
  color: var(--rft-primary);
}

.rft-btn-export.siigo:hover {
  background: rgba(78, 205, 196, 0.1);
  box-shadow: 0 4px 12px rgba(78, 205, 196, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════ */
/* MODAL */
/* ═══════════════════════════════════════════════════════════════════ */

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

.rft-modal-content {
  background: white;
  padding: 30px;
  border-radius: 8px;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.rft-modal-close {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #999;
  cursor: pointer;
  transition: color 0.2s ease;
}

.rft-modal-close:hover {
  color: var(--rft-primary);
}

.rft-modal-content h3 {
  margin-top: 0;
  color: var(--rft-primary);
  border-bottom: 2px solid var(--rft-primary);
  padding-bottom: 10px;
}

.rft-info-section {
  margin: 20px 0;
}

.rft-info-section h4 {
  margin: 15px 0 10px 0;
  color: var(--rft-secondary);
  font-size: 15px;
}

.rft-info-section p,
.rft-info-section ul {
  margin: 8px 0;
  line-height: 1.6;
  color: #666;
}

.rft-info-section ul {
  margin-left: 20px;
}

.rft-info-section li {
  margin: 8px 0;
}

.rft-info-section code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', monospace;
  color: #d73a49;
}

/* ═══════════════════════════════════════════════════════════════════ */
/* RESPONSIVE */
/* ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  .rft-container {
    padding: 10px;
  }

  .rft-header {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .rft-header h2 {
    font-size: 22px;
  }

  .rft-kpi-row {
    grid-template-columns: 1fr 1fr;
  }

  .rft-filtro-row {
    flex-direction: column;
  }

  .filtro-grupo {
    width: 100%;
  }

  .filtro-grupo input,
  .filtro-grupo select {
    min-width: 100%;
  }

  .rft-graficos-grid {
    grid-template-columns: 1fr;
  }

  .rft-table {
    font-size: 12px;
  }

  .rft-table th,
  .rft-table td {
    padding: 8px;
  }

  .rft-export-btns {
    flex-direction: column;
  }

  .rft-btn-export {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .rft-kpi-row {
    grid-template-columns: 1fr;
  }

  .rft-modal-content {
    width: 95%;
    padding: 20px;
  }
}
