/**
 * Estilos modernos para el Frontend de WP Portal de Oportunidades Perú
 * Arquitectura: BEM + CSS Custom Properties (Variables) + Grid & Flexbox
 *
 * @package WP_Oportunidades_Peru
 */

:root {
  --opp-primary: #dc2626;
  --opp-primary-hover: #b91c1c;
  --opp-primary-light: #fee2e2;
  --opp-secondary: #0f172a;
  --opp-secondary-hover: #1e293b;
  --opp-whatsapp: #16a34a;
  --opp-whatsapp-hover: #15803d;
  --opp-surface: #ffffff;
  --opp-surface-soft: #f8fafc;
  --opp-border: #e2e8f0;
  --opp-border-strong: #cbd5e1;
  --opp-text: #0f172a;
  --opp-text-muted: #64748b;
  --opp-text-light: #94a3b8;
  --opp-radius-sm: 6px;
  --opp-radius-md: 10px;
  --opp-radius-lg: 16px;
  --opp-radius-full: 9999px;
  --opp-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --opp-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --opp-shadow-hover: 0 12px 24px -4px rgba(15, 23, 42, 0.12);
  --opp-font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   1. HERO SEARCH BAR [opp_buscador]
   ========================================================================== */
.opp-hero-search {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 3rem 1.5rem;
  border-radius: var(--opp-radius-lg);
  color: #ffffff;
  margin-bottom: 2.5rem;
  box-shadow: var(--opp-shadow-md);
}

.opp-hero-search__container {
  max-width: 1040px;
  margin: 0 auto;
  text-align: center;
}

.opp-hero-search__title {
  font-size: clamp(1.5rem, 3.5vw, 2.25rem);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  margin: 0 0 0.75rem 0;
  letter-spacing: -0.02em;
}

.opp-hero-search__subtitle {
  font-size: 1rem;
  color: #94a3b8;
  margin: 0 0 2rem 0;
  line-height: 1.5;
}

.opp-hero-search__form {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr auto;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem;
  border-radius: var(--opp-radius-md);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

@media (max-width: 900px) {
  .opp-hero-search__form {
    grid-template-columns: 1fr;
  }
}

.opp-hero-search__field {
  position: relative;
  display: flex;
  align-items: center;
}

.opp-hero-search__icon {
  position: absolute;
  left: 14px;
  color: var(--opp-text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.opp-hero-search__input,
.opp-hero-search__select {
  width: 100%;
  height: 48px;
  background: var(--opp-surface);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-sm);
  padding: 0 14px;
  font-size: 0.9375rem;
  color: var(--opp-text);
  font-family: var(--opp-font-sans);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.opp-hero-search__field--keyword .opp-hero-search__input {
  padding-left: 42px;
}

.opp-hero-search__input:focus,
.opp-hero-search__select:focus {
  outline: none;
  border-color: var(--opp-primary);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}

.opp-hero-search__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--opp-primary);
  color: #ffffff;
  border: none;
  border-radius: var(--opp-radius-sm);
  padding: 0 1.5rem;
  height: 48px;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.opp-hero-search__submit:hover {
  background: var(--opp-primary-hover);
}

.opp-hero-search__submit:active {
  transform: scale(0.98);
}

/* ==========================================================================
   2. BANNER DE ESTADÍSTICAS [opp_estadisticas]
   ========================================================================== */
.opp-stats-banner {
  background: var(--opp-surface);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-md);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--opp-shadow-sm);
}

.opp-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .opp-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.opp-stat-card {
  text-align: center;
  padding: 0.75rem;
  border-right: 1px solid var(--opp-border);
}

.opp-stat-card:last-child {
  border-right: none;
}

@media (max-width: 768px) {
  .opp-stat-card:nth-child(2) {
    border-right: none;
  }
}

.opp-stat-card__number-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--opp-primary);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.opp-stat-card__plus {
  font-size: 1.5rem;
}

.opp-stat-card__text {
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  font-weight: 800;
  color: var(--opp-secondary);
}

.opp-stat-card__label {
  display: block;
  font-size: 0.8125rem;
  color: var(--opp-text-muted);
  margin-top: 0.35rem;
  font-weight: 500;
}

/* ==========================================================================
   3. GRID DE TARJETAS Y TARJETA [opp_listado]
   ========================================================================== */
.opp-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.opp-card {
  background: var(--opp-surface);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-md);
  padding: 1.25rem;
  display: flex;
  flex-col: column;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.opp-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--opp-shadow-hover);
  border-color: var(--opp-border-strong);
}

/* Cabecera de la tarjeta */
.opp-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.opp-card__logo-wrap {
  width: 50px;
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--opp-radius-sm);
  background: #ffffff;
  border: 1px solid var(--opp-border);
  padding: 4px;
}

.opp-card__logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.opp-card__logo-placeholder {
  width: 100%;
  height: 100%;
  background: var(--opp-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.875rem;
  border-radius: 4px;
}

/* Título */
.opp-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 1rem 0;
}

.opp-card__title-link {
  color: var(--opp-text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.opp-card__title-link:hover {
  color: var(--opp-primary);
}

/* Lista de metadatos */
.opp-card__meta-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.opp-card__meta-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--opp-text-muted);
  line-height: 1.4;
}

.opp-card__meta-icon {
  color: var(--opp-primary);
  flex-shrink: 0;
  margin-top: 2px;
}

.opp-card__meta-text strong {
  color: var(--opp-text);
}

.opp-card__meta-text--salary {
  color: #15803d;
  font-weight: 600;
}

/* Bloque destacado inferior */
.opp-card__highlight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--opp-surface-soft);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-sm);
  padding: 8px 12px;
  margin-bottom: 1.25rem;
  font-size: 0.75rem;
}

.opp-card__tag-regimen {
  font-weight: 700;
  color: var(--opp-secondary);
}

.opp-card__tag-vacantes {
  font-weight: 600;
  color: var(--opp-primary);
  background: var(--opp-primary-light);
  padding: 2px 8px;
  border-radius: var(--opp-radius-full);
}

/* Footer de la tarjeta */
.opp-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--opp-border);
  padding-top: 1rem;
}

.opp-card__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Botones universales */
.opp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--opp-radius-sm);
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.opp-btn--primary {
  background: var(--opp-secondary);
  color: #ffffff;
}

.opp-btn--primary:hover {
  background: var(--opp-secondary-hover);
  color: #ffffff;
}

.opp-btn--whatsapp {
  background: var(--opp-whatsapp);
  color: #ffffff;
}

.opp-btn--whatsapp:hover {
  background: var(--opp-whatsapp-hover);
  color: #ffffff;
}

.opp-btn--secondary {
  background: #ffffff;
  color: var(--opp-secondary);
  border: 1px solid var(--opp-border-strong);
}

.opp-btn--secondary:hover {
  background: var(--opp-surface-soft);
}

.opp-btn--sm {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.opp-action-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--opp-radius-sm);
  border: 1px solid var(--opp-border);
  background: var(--opp-surface);
  color: var(--opp-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.opp-action-btn:hover {
  border-color: var(--opp-border-strong);
  color: var(--opp-text);
  background: var(--opp-surface-soft);
}

/* Botón favoritos activo */
.opp-fav-btn.is-favorited {
  color: var(--opp-primary);
  border-color: var(--opp-primary);
  background: var(--opp-primary-light);
}

.opp-fav-btn.is-favorited .opp-heart-icon {
  fill: var(--opp-primary);
}

/* Menú desplegable compartir */
.opp-share-dropdown {
  position: relative;
}

.opp-share-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  background: #ffffff;
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-sm);
  box-shadow: var(--opp-shadow-hover);
  padding: 6px;
  display: none;
  flex-direction: column;
  min-width: 130px;
  z-index: 20;
}

.opp-share-menu.is-open {
  display: flex;
}

.opp-share-menu__item {
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--opp-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.1s ease;
}

.opp-share-menu__item:hover {
  background: var(--opp-surface-soft);
  color: var(--opp-primary);
}

/* ==========================================================================
   4. SECCIÓN CANALES Y MODALES [opp_canales_alertas]
   ========================================================================== */
.opp-alerts-cta {
  margin: 3rem 0;
}

.opp-alerts-cta__box {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-radius: var(--opp-radius-lg);
  padding: 2.5rem 1.5rem;
  color: #ffffff;
  text-align: center;
}

.opp-alerts-cta__content {
  max-width: 720px;
  margin: 0 auto;
}

.opp-alerts-cta__badge {
  display: inline-block;
  background: rgba(22, 163, 74, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
  padding: 4px 12px;
  border-radius: var(--opp-radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.opp-alerts-cta__title {
  font-size: clamp(1.35rem, 2.5vw, 1.875rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.75rem 0;
  line-height: 1.3;
}

.opp-alerts-cta__text {
  font-size: 0.9375rem;
  color: #94a3b8;
  margin: 0 0 1.75rem 0;
  line-height: 1.6;
}

.opp-alerts-cta__buttons {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Modales */
.opp-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.opp-modal[hidden] {
  display: none !important;
}

.opp-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
}

.opp-modal__dialog {
  position: relative;
  background: #ffffff;
  border-radius: var(--opp-radius-md);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  z-index: 10;
}

.opp-modal__header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--opp-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.opp-modal__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--opp-text);
  margin: 0;
}

.opp-modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--opp-text-muted);
  cursor: pointer;
  line-height: 1;
}

.opp-modal__search-wrap {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--opp-border);
  background: var(--opp-surface-soft);
}

.opp-modal__search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--opp-border-strong);
  border-radius: var(--opp-radius-sm);
  font-size: 0.875rem;
}

.opp-modal__body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
}

.opp-modal__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.opp-modal__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--opp-surface-soft);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-sm);
}

.opp-modal__item-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--opp-text);
}

/* ==========================================================================
   5. CONTENEDOR DE FAVORITOS [opp_favoritos_usuario]
   ========================================================================== */
.opp-favoritos-container {
  background: var(--opp-surface);
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-md);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.opp-favoritos-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--opp-border);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.opp-favoritos-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--opp-text);
}

.opp-favoritos-count {
  font-size: 0.875rem;
  color: var(--opp-primary);
  font-weight: 700;
}

.opp-favoritos-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--opp-text-muted);
}

.opp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--opp-border);
  border-top-color: var(--opp-primary);
  border-radius: 50%;
  animation: opp-spin 0.8s linear infinite;
  margin: 0 auto 1rem auto;
}

@keyframes opp-spin {
  to { transform: rotate(360deg); }
}

.opp-no-results {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--opp-surface-soft);
  border: 1px dashed var(--opp-border-strong);
  border-radius: var(--opp-radius-md);
}

.opp-no-results__icon {
  color: var(--opp-text-muted);
  margin-bottom: 1rem;
}

.opp-no-results__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--opp-text);
  margin: 0 0 0.5rem 0;
}

.opp-no-results__text {
  font-size: 0.875rem;
  color: var(--opp-text-muted);
  margin: 0;
}

/* Paginación */
.opp-pagination {
  margin-top: 2rem;
  text-align: center;
}

.opp-pagination ul {
  display: inline-flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
}

.opp-pagination a,
.opp-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--opp-border);
  border-radius: var(--opp-radius-sm);
  background: #ffffff;
  color: var(--opp-text);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
}

.opp-pagination .current {
  background: var(--opp-primary);
  color: #ffffff;
  border-color: var(--opp-primary);
}
