/* css/styles.css */

/* ====== ESTILOS GENERALES ====== */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f4f6f9;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 20px;
}

/* ====== CONTENEDOR PRINCIPAL DEL FORMULARIO ====== */
.form-container {
  background: #fff;
  padding: 30px 40px;
  border-radius: 12px;
  box-shadow: 0px 6px 20px rgba(0, 0, 0, 0.1);
  width: 80%;
  max-width: 900px;
  margin: 0 auto;
}

/* ====== TÍTULOS ====== */
.form-container h1 {
  text-align: center;
  margin-bottom: 10px;
  color: #2c3e50;
  font-size: 1.6em;
}

/* Subtítulo del formulario */
.form-subtitle {
  text-align: center;
  color: #7f8c8d;
  font-size: 0.95em;
  margin-top: -5px;
  margin-bottom: 20px;
  font-weight: 500;
}

.form-container h2 {
  text-align: center;
  margin-top: 30px;
  color: #34495e;
  font-size: 1.3em;
  border-top: 1px solid #ecf0f1;
  padding-top: 15px;
}

/* ============================================ */
/* BARRA DE INFORMACIÓN DEL USUARIO */
/* ============================================ */
.user-info-bar {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(102, 126, 234, 0.3);
}

.user-left-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-name {
  color: white !important;
  font-weight: 600;
  font-size: 15px;
}

.btn-mi-perfil {
  background: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  padding: 7px 14px !important;
  border-radius: 6px !important;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-mi-perfil:hover {
  background: rgba(255, 255, 255, 0.4) !important;
  border-color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-logout {
  background: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
  border: 2px solid white !important;
  padding: 8px 16px !important;
  border-radius: 6px !important;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: white !important;
  color: #667eea !important;
  transform: translateY(-2px);
}

/* ============================================ */
/* FORMULARIO CON 3 COLUMNAS */
/* ============================================ */
form#clientForm {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  align-items: start;
}

/* ====== CADA BLOQUE DE CAMPO ====== */
.form-row {
  display: flex;
  flex-direction: column;
}

/* Etiquetas de campos */
.form-row label {
  margin-bottom: 6px;
  font-weight: 600;
  color: #34495e;
}

/* Indicador de campo requerido */
.required {
  color: #e74c3c;
  font-weight: bold;
  margin-left: 3px;
}

/* Campos de texto, select, textarea */
.form-row input,
.form-row select,
.form-row textarea {
  padding: 10px;
  border: 1px solid #dcdde1;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s, box-shadow 0.3s;
  background-color: #fdfdfd;
  width: 100%;
  box-sizing: border-box;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  border-color: #2980b9;
  outline: none;
  box-shadow: 0px 0px 6px rgba(41, 128, 185, 0.3);
}

textarea {
  resize: none;
  grid-column: span 3;
}

/* ============================================ */
/* ESTILOS PARA SELECT CON BÚSQUEDA */
/* ============================================ */
.searchable-select-wrapper {
  position: relative;
  width: 100%;
}

.searchable-select-trigger {
  position: relative;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.searchable-input {
  width: 100%;
  padding: 10px 35px 10px 10px;
  border: 1px solid #dcdde1;
  border-radius: 8px;
  font-size: 14px;
  background-color: #fdfdfd;
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.searchable-input[readonly] {
  cursor: pointer;
  background-color: #fdfdfd;
}

.searchable-input:not([readonly]) {
  cursor: text;
}

.searchable-input:focus {
  border-color: #2980b9;
  outline: none;
  box-shadow: 0px 0px 6px rgba(41, 128, 185, 0.3);
  cursor: text;
}

.searchable-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #7f8c8d;
  font-size: 12px;
  pointer-events: none;
  transition: transform 0.3s ease;
}

.searchable-select-trigger:hover .searchable-arrow {
  color: #2980b9;
}

.searchable-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: white;
  border: 1px solid #dcdde1;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  margin-top: -8px;
}

.searchable-option {
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 14px;
  color: #2c3e50;
}

.searchable-option:hover,
.searchable-option.highlighted {
  background-color: #e8f4f8;
  color: #2980b9;
}

.searchable-option.no-results {
  cursor: default;
  color: #95a5a6;
  font-style: italic;
  text-align: center;
}

.searchable-option.no-results:hover {
  background-color: transparent;
  color: #95a5a6;
}

/* Scrollbar personalizado para el dropdown */
.searchable-dropdown::-webkit-scrollbar {
  width: 8px;
}

.searchable-dropdown::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 0 0 8px 0;
}

.searchable-dropdown::-webkit-scrollbar-thumb {
  background: #bdc3c7;
  border-radius: 4px;
}

.searchable-dropdown::-webkit-scrollbar-thumb:hover {
  background: #95a5a6;
}

/* ============================================ */
/* ESTILOS PARA EL CAMPO CÉDULA CON BOTÓN */
/* ============================================ */
.cedula-row {
  position: relative;
}

.cedula-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cedula-input-group input {
  flex: 1;
}

.btn-search-cedula {
  background: #27ae60;
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  min-width: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-search-cedula:hover {
  background: #229954;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.btn-search-cedula:active {
  transform: translateY(0);
}

.btn-search-cedula:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
}

/* ============================================ */
/* ESTILOS PARA SELECT CON OPTGROUP */
/* ============================================ */
.form-row select optgroup {
  font-weight: 600;
  font-style: normal;
  color: #2980b9;
  background-color: #ecf0f1;
}

.form-row select option {
  padding: 8px;
  background-color: white;
  color: #2c3e50;
}

/* ============================================ */
/* BOTONES DE ACCIÓN DEL FORMULARIO */
/* ============================================ */
.form-actions {
  grid-column: span 3;
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 10px;
}

.btn-submit {
  background: linear-gradient(135deg, #2980b9, #3498db);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.btn-submit:hover {
  background: linear-gradient(135deg, #1f6691, #2471a3);
  transform: translateY(-2px);
}

.btn-ver-clientes {
  background: linear-gradient(135deg, #2980b9, #3498db);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  display: inline-block;
}

.btn-ver-clientes:hover {
  background: linear-gradient(135deg, #1f6691, #2471a3);
  transform: translateY(-2px);
}

.btn-cancel-edit {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
}

.btn-cancel-edit:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-2px);
}

.btn-cancel-edit:active {
  transform: translateY(0);
}

/* ============================================ */
/* BOTÓN MAPA DE SITIO (Agregar al final de styles.css) */
/* ============================================ */

.btn-sitemap {
  background: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  padding: 7px 14px !important;
  border-radius: 6px !important;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.btn-sitemap:hover {
  background: rgba(255, 255, 255, 0.4) !important;
  border-color: white !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ============================================ */
/* RESPONSIVE PARA BOTÓN MAPA DE SITIO */
/* ============================================ */

@media (max-width: 768px) {
  .btn-sitemap {
    font-size: 12px;
    padding: 6px 12px !important;
    width: fit-content;
  }
}

@media (max-width: 480px) {
  .btn-sitemap {
    font-size: 11px;
    padding: 5px 10px !important;
  }
}

/* ============================================ */
/* INDICADOR DE MODALIDAD SELECCIONADA */
/* ============================================ */
.modalidad-indicador {
  display: flex !important;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
  padding: 12px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 4px 10px rgba(86, 171, 47, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.modalidad-icon {
  font-size: 20px;
}

.modalidad-text {
  color: white;
  font-size: 15px;
  font-weight: 500;
}

.modalidad-text strong {
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ============================================ */
/* BOTÓN SELECCIONAR MODALIDAD */
/* ============================================ */
.form-actions-secondary {
  grid-column: span 3;
  display: flex;
  justify-content: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 2px solid #ecf0f1;
}

.btn-seleccionar-modalidad {
  background: linear-gradient(135deg, #8e44ad, #9b59b6);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  display: inline-block;
}

.btn-seleccionar-modalidad:hover {
  background: linear-gradient(135deg, #732d91, #8e44ad);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(142, 68, 173, 0.3);
}

/* ============================================ */
/* BOTÓN MODALIDAD EN LA BARRA SUPERIOR */
/* ============================================ */
.btn-modalidad-bar {
  background: rgba(255, 255, 255, 0.25) !important;
  color: white !important;
  border: 1.5px solid rgba(255, 255, 255, 0.8) !important;
  padding: 7px 14px !important;
  border-radius: 6px !important;
  cursor: default;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================ */
/* RESPONSIVE PARA INDICADOR DE MODALIDAD */
/* ============================================ */
@media (max-width: 768px) {
  .modalidad-indicador {
    padding: 10px 15px;
  }
  
  .modalidad-icon {
    font-size: 18px;
  }
  
  .modalidad-text {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .modalidad-indicador {
    padding: 8px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }
  
  .modalidad-icon {
    font-size: 16px;
  }
  
  .modalidad-text {
    font-size: 12px;
  }
}

/* ============================================ */
/* RESPONSIVE */
/* ============================================ */

/* Tablets */
@media (max-width: 1024px) {
  form#clientForm {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .form-container {
    width: 90%;
    padding: 25px 30px;
  }
}

/* Móviles grandes */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }
  
  .form-container {
    width: 100%;
    padding: 20px 15px;
  }
  
  .form-container h1 {
    font-size: 1.4em;
  }
  
  /* FORZAR 1 COLUMNA EN MÓVIL */
  form#clientForm {
    grid-template-columns: 1fr !important;
    gap: 15px;
    display: grid;
  }
  
  /* IMPORTANTE: Cada campo ocupa 1 fila completa */
  .form-row {
    grid-column: 1 / -1 !important;
    width: 100%;
  }
  
  /* Los botones también ocupan toda la fila */
  .form-actions {
    grid-column: 1 / -1 !important;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
  
  .user-info-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 15px;
  }
  
  .user-left-section {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .btn-mi-perfil {
    font-size: 12px;
    padding: 6px 12px !important;
    width: fit-content;
  }
  
  .btn-logout {
    width: 100%;
    text-align: center;
  }

  .btn-submit,
  .btn-ver-clientes,
  .btn-cancel-edit {
    width: 100% !important;
    max-width: 100% !important;
    text-align: center;
    box-sizing: border-box;
    display: block;
  }
  
  /* Ajustar el campo de cédula para que sea más grande */
  .cedula-input-group {
    width: 100%;
  }
  
  .cedula-input-group input {
    min-width: 0;
    flex: 1;
  }
  
  textarea {
    grid-column: 1 / -1 !important;
  }
  
  /* Ajustes para los dropdowns en móvil */
  .searchable-dropdown {
    max-height: 200px;
  }
}

/* Móviles pequeños */
@media (max-width: 480px) {
  body {
    padding: 5px;
  }
  
  .form-container {
    width: 100%;
    padding: 15px 12px;
    border-radius: 8px;
  }
  
  .form-container h1 {
    font-size: 1.25em;
    margin-bottom: 8px;
  }
  
  .form-subtitle {
    font-size: 0.85em;
  }
  
  .user-info-bar {
    padding: 12px;
  }
  
  .user-name {
    font-size: 13px;
  }
  
  .btn-mi-perfil {
    font-size: 11px;
    padding: 5px 10px !important;
  }
  
  .btn-logout {
    font-size: 12px;
    padding: 7px 14px !important;
  }
  
  .form-row label {
    font-size: 13px;
  }
  
  .form-row input,
  .form-row select,
  .form-row textarea,
  .searchable-input {
    font-size: 14px;
    padding: 10px 8px;
  }
  
  .cedula-input-group {
    gap: 6px;
  }
  
  .btn-search-cedula {
    min-width: 40px;
    padding: 10px;
    font-size: 14px;
  }
  
  .form-actions {
    gap: 8px;
    width: 100%;
  }
  
  .btn-submit,
  .btn-ver-clientes,
  .btn-cancel-edit {
    font-size: 14px;
    padding: 12px 16px;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    display: block;
  }
  
  .searchable-dropdown {
    max-height: 180px;
  }
  
  .searchable-option {
    padding: 8px 10px;
    font-size: 13px;
  }
}