/* ============================================================================
   THOR LICITACIONES - CSS UNIFICADO PARA BÚSQUEDA
   Estilo: Apple minimalista, fondos claros, acentos naranja suave
   Reemplaza: search-pro.css, schedule-pro.css
   ============================================================================ */

:root {
  --thor-bg: #f5f5f7;
  --thor-bg-secondary: #ffffff;
  --thor-card: #ffffff;
  --thor-text: #1d1d1f;
  --thor-text-secondary: #6e6e73;
  --thor-text-muted: #aeaeb2;
  --thor-accent: #e88732;
  --thor-accent-hover: #d67826;
  --thor-accent-light: rgba(232, 135, 50, 0.08);
  --thor-accent-border: rgba(232, 135, 50, 0.25);
  --thor-border: rgba(0, 0, 0, 0.08);
  --thor-border-strong: rgba(0, 0, 0, 0.12);
  --thor-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --thor-shadow-md: 0 2px 8px rgba(0, 0, 0, 0.06);
  --thor-shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.08);
  --thor-radius-sm: 8px;
  --thor-radius-md: 12px;
  --thor-radius-lg: 16px;
  --thor-radius-full: 50px;
  --thor-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

/* ============================================================================
   SECCIÓN: BUSCAR LICITACIONES AHORA
   ============================================================================ */

#buscarAhora.section {
  background: var(--thor-bg) !important;
  border-radius: var(--thor-radius-lg);
  padding: 0;
  margin: 20px auto;
  max-width: 1000px;
  font-family: var(--thor-font);
  box-shadow: none !important;
  border: none !important;
}

/* Header */
.search-unified-header {
  background: transparent !important;
  padding: 40px 40px 24px;
  text-align: center;
  border: none !important;
}

.search-unified-header h2 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--thor-text) !important;
  margin: 0 0 8px 0;
  text-shadow: none !important;
}

.search-unified-header p {
  font-size: 16px;
  color: var(--thor-text-secondary) !important;
  margin: 0;
}

/* ===== BARRA DE BÚSQUEDA SPOTLIGHT ===== */
.search-spotlight-wrapper {
  padding: 0 40px 28px;
}

.search-spotlight {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-spotlight-input {
  width: 100%;
  padding: 14px 18px 14px 46px;
  font-family: var(--thor-font);
  font-size: 15px;
  color: var(--thor-text);
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-md);
  box-shadow: var(--thor-shadow-sm);
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.search-spotlight-input:focus {
  border-color: var(--thor-accent);
  box-shadow: 0 0 0 3px var(--thor-accent-light);
}

.search-spotlight-input::placeholder {
  color: var(--thor-text-muted);
}

.search-spotlight-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--thor-text-muted);
  pointer-events: none;
}

.search-spotlight-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: var(--thor-text-muted);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.search-spotlight-clear svg {
  width: 10px;
  height: 10px;
  color: white;
}

.search-spotlight-input:not(:placeholder-shown)~.search-spotlight-clear {
  opacity: 1;
}

/* ===== CATEGORÍAS (PILLS) ===== */
.search-categories {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 0 24px 24px;
  flex-wrap: wrap;
}

.search-category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-full);
  font-family: var(--thor-font);
  font-size: 14px;
  font-weight: 500;
  color: var(--thor-text);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--thor-shadow-sm);
}

.search-category-pill:hover {
  border-color: var(--thor-accent-border);
  background: var(--thor-accent-light);
  transform: translateY(-1px);
  box-shadow: var(--thor-shadow-md);
}

.search-category-pill.active {
  background: var(--thor-accent);
  color: white;
  border-color: var(--thor-accent);
  box-shadow: 0 2px 8px rgba(232, 135, 50, 0.3);
}

.search-category-pill.loading {
  opacity: 0.6;
  pointer-events: none;
}

.search-category-icon {
  font-size: 16px;
}

/* ===== ESTADÍSTICAS RÁPIDAS ===== */
.search-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  padding: 0 40px 24px;
}

.search-stat-card {
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-stat-card:hover {
  border-color: var(--thor-accent-border);
  box-shadow: var(--thor-shadow-md);
  transform: translateY(-2px);
}

.search-stat-card.active {
  border-color: var(--thor-accent);
  background: var(--thor-accent-light);
}

.search-stat-number {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--thor-text);
  letter-spacing: -0.02em;
}

.search-stat-label {
  display: block;
  font-size: 12px;
  color: var(--thor-text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== SECCIÓN CPV ===== */
.search-cpv-section {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  padding: 0 40px;
}

.search-cpv-section.visible {
  max-height: 800px;
  padding: 0 40px 24px;
}

.search-cpv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.search-cpv-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--thor-text);
  margin: 0;
}

.search-cpv-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-cpv-count {
  font-size: 13px;
  color: var(--thor-text-secondary);
}

.search-cpv-clear {
  font-size: 13px;
  color: var(--thor-accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}

.search-cpv-clear:hover {
  text-decoration: underline;
}

.search-cpv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.search-cpv-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 13px;
}

.search-cpv-item:hover {
  border-color: var(--thor-accent-border);
  background: var(--thor-accent-light);
}

.search-cpv-item.selected {
  border-color: var(--thor-accent);
  background: var(--thor-accent-light);
}

.search-cpv-item input[type="checkbox"] {
  accent-color: var(--thor-accent);
  width: 16px;
  height: 16px;
}

.search-cpv-code {
  font-weight: 600;
  color: var(--thor-accent);
  font-size: 12px;
  white-space: nowrap;
}

.search-cpv-name {
  color: var(--thor-text-secondary);
  font-size: 12px;
}

.search-cpv-submit {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--thor-accent);
  color: white;
  border: none;
  border-radius: var(--thor-radius-sm);
  font-family: var(--thor-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.search-cpv-submit:hover {
  background: var(--thor-accent-hover);
}

/* ===== FILTROS COLAPSABLES ===== */
.search-filters-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 40px;
  margin-bottom: 8px;
}

.search-filters-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-full);
  font-family: var(--thor-font);
  font-size: 13px;
  color: var(--thor-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.search-filters-toggle:hover,
.search-filters-toggle.active {
  border-color: var(--thor-accent-border);
  color: var(--thor-accent);
}

.search-filters-toggle svg {
  transition: transform 0.3s ease;
}

.results-count {
  font-size: 13px;
  color: var(--thor-text-secondary);
  font-weight: 500;
}

.search-filters-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
  padding: 0 40px;
}

.search-filters-panel.open {
  max-height: 200px;
  padding: 12px 40px 20px;
}

.search-filters-panel {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.search-filter-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--thor-text-secondary);
  margin-bottom: 4px;
}

.search-filter-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
  font-family: var(--thor-font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.search-filter-group input:focus {
  border-color: var(--thor-accent);
}

.search-filter-actions {
  display: flex;
  gap: 8px;
}

.search-filter-btn {
  padding: 10px 16px;
  background: var(--thor-accent);
  color: white;
  border: none;
  border-radius: var(--thor-radius-sm);
  font-family: var(--thor-font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.search-filter-btn:hover {
  background: var(--thor-accent-hover);
}

.search-filter-btn.secondary {
  background: var(--thor-card);
  color: var(--thor-text);
  border: 1px solid var(--thor-border);
}

.search-filter-btn.secondary:hover {
  border-color: var(--thor-accent-border);
}

/* ===== RESULTADOS ===== */
.search-results-container {
  padding: 16px 40px 40px;
}

.search-empty-state {
  text-align: center;
  padding: 60px 20px;
}

.search-empty-icon {
  width: 64px;
  height: 64px;
  color: var(--thor-text-muted);
  margin: 0 auto 16px;
  display: block;
}

.search-empty-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--thor-text);
  margin: 0 0 8px 0;
}

.search-empty-text {
  font-size: 14px;
  color: var(--thor-text-secondary);
  margin: 0;
}

/* ============================================================================
   SECCIÓN: PROGRAMAR BÚSQUEDA
   ============================================================================ */

#programarBusqueda.section {
  background: var(--thor-bg) !important;
  border-radius: var(--thor-radius-lg);
  padding: 0;
  margin: 20px auto;
  max-width: 800px;
  font-family: var(--thor-font);
  box-shadow: none !important;
  border: none !important;
}

.schedule-unified-form {
  padding: 0 40px 40px;
}

/* User info badge */
.user-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--thor-accent-light);
  border: 1px solid var(--thor-accent-border);
  border-radius: var(--thor-radius-full);
  font-size: 13px;
  color: var(--thor-text-secondary);
  margin-bottom: 24px;
}

.user-info-badge strong {
  color: var(--thor-accent);
}

/* Schedule sections */
.schedule-section {
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-md);
  padding: 24px;
  margin-bottom: 16px;
}

.schedule-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--thor-text);
  margin: 0 0 20px 0;
}

.schedule-section-icon {
  font-size: 20px;
}

/* Schedule category cards */
.schedule-categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.schedule-category-card {
  position: relative;
  display: block;
  cursor: pointer;
}

.schedule-category-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.schedule-category-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: var(--thor-bg);
  border: 2px solid var(--thor-border);
  border-radius: var(--thor-radius-md);
  transition: all 0.2s ease;
}

.schedule-category-card:hover .schedule-category-content {
  border-color: var(--thor-accent-border);
  background: var(--thor-accent-light);
}

.schedule-category-card input:checked~.schedule-category-content {
  border-color: var(--thor-accent);
  background: var(--thor-accent-light);
  box-shadow: 0 0 0 3px rgba(232, 135, 50, 0.15);
}

.schedule-category-card.selected .schedule-category-content {
  border-color: var(--thor-accent);
  background: var(--thor-accent-light);
  box-shadow: 0 0 0 3px rgba(232, 135, 50, 0.15);
}

.schedule-category-icon {
  font-size: 28px;
}

.schedule-category-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--thor-text);
}

/* CPV container for schedule */
.schedule-cpv-container {
  margin-top: 16px;
  padding: 16px;
  background: var(--thor-bg);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
}

.schedule-cpv-container label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--thor-text-secondary);
  margin-bottom: 8px;
}

.multi-select-modern {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
  font-family: var(--thor-font);
  font-size: 13px;
  background: var(--thor-card);
}

.multi-select-modern:focus {
  border-color: var(--thor-accent);
  outline: none;
}

/* Days selector */
.days-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-select-all {
  padding: 8px 16px;
  background: var(--thor-accent-light);
  border: 1px solid var(--thor-accent-border);
  border-radius: var(--thor-radius-full);
  font-family: var(--thor-font);
  font-size: 13px;
  color: var(--thor-accent);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.btn-select-all:hover {
  background: var(--thor-accent);
  color: white;
}

.schedule-day-chip {
  position: relative;
}

.schedule-day-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.schedule-day-chip label {
  display: block;
  padding: 8px 16px;
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--thor-text);
  cursor: pointer;
  transition: all 0.2s;
}

.schedule-day-chip input:checked+label {
  background: var(--thor-accent);
  color: white;
  border-color: var(--thor-accent);
}

.schedule-day-chip label:hover {
  border-color: var(--thor-accent-border);
}

/* Day chips fallback (old structure) */
.day-chip {
  position: relative;
}

.day-chip .form-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.day-chip-label {
  display: block;
  padding: 8px 16px;
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--thor-text);
  cursor: pointer;
  transition: all 0.2s;
}

.day-chip .form-checkbox:checked+.day-chip-label {
  background: var(--thor-accent);
  color: white;
  border-color: var(--thor-accent);
}

/* Time inputs */
.time-input-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.form-control-modern label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--thor-text-secondary);
  margin-bottom: 6px;
}

.form-control-modern input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
  font-family: var(--thor-font);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-control-modern input:focus {
  border-color: var(--thor-accent);
}

.form-help {
  display: block;
  font-size: 12px;
  color: var(--thor-text-muted);
  margin-top: 4px;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--thor-text);
  margin-bottom: 12px;
}

/* Submit section */
.submit-section {
  text-align: center;
  margin-top: 24px;
}

.btn-schedule-pro {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--thor-accent);
  color: white;
  border: none;
  border-radius: var(--thor-radius-full);
  font-family: var(--thor-font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(232, 135, 50, 0.3);
}

.btn-schedule-pro:hover {
  background: var(--thor-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(232, 135, 50, 0.4);
}

/* Scheduled list */
.scheduled-list-container {
  margin-top: 24px;
}

.schedule-list-empty {
  text-align: center;
  padding: 32px;
  color: var(--thor-text-muted);
  font-size: 14px;
}

.schedule-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--thor-card);
  border: 1px solid var(--thor-border);
  border-radius: var(--thor-radius-sm);
  margin-bottom: 8px;
  transition: border-color 0.2s;
}

.schedule-list-item:hover {
  border-color: var(--thor-accent-border);
}

.schedule-list-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.schedule-list-icon {
  font-size: 24px;
}

.schedule-list-details h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--thor-text);
  margin: 0 0 2px 0;
}

.schedule-list-details p {
  font-size: 12px;
  color: var(--thor-text-secondary);
  margin: 0;
}

.schedule-list-btn.delete {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid #ef4444;
  border-radius: var(--thor-radius-sm);
  color: #ef4444;
  font-family: var(--thor-font);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.schedule-list-btn.delete:hover {
  background: #ef4444;
  color: white;
}

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

@media (max-width: 768px) {
  .search-unified-header {
    padding: 24px 20px 16px;
  }

  .search-unified-header h2 {
    font-size: 24px;
  }

  .search-spotlight-wrapper {
    padding: 0 20px 20px;
  }

  .search-categories {
    padding: 0 16px 16px;
    gap: 8px;
  }

  .search-category-pill {
    padding: 8px 14px;
    font-size: 13px;
  }

  .search-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 20px 16px;
  }

  .search-filters-bar {
    padding: 0 20px;
  }

  .search-filters-panel {
    grid-template-columns: 1fr;
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  .search-filters-panel.open {
    max-height: 400px;
  }

  .search-results-container {
    padding: 16px 20px;
  }

  .schedule-unified-form {
    padding: 0 20px 20px;
  }

  .schedule-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .time-input-group {
    grid-template-columns: 1fr;
  }

  .search-cpv-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .search-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .search-stat-number {
    font-size: 22px;
  }

  .schedule-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}