/* ==========================================================================
   MEETINGS — Seletor de Requisitos (rss-*)
   Modal dedicado para seleção de requisitos do caderno.
   Compatível com meetings-requirements-selector.js
   ========================================================================== */

/* ── Container principal (rss-sheet) ─────────────────────────────────────── */
.rss-sheet {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  width: 95%;
  max-width: 600px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: rssSlideIn var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes rssSlideIn {
  from { transform: translateY(20px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.rss-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
  flex-shrink: 0;
}

.rss-header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.rss-header-icon {
  width: 38px;
  height: 38px;
  background: rgba(37, 99, 235, 0.1);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1rem;
  flex-shrink: 0;
}

.rss-header-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.rss-header-sub {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
  line-height: 1.2;
}

.rss-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border-color);
  background: var(--white);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9375rem;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.rss-close:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--white);
}

/* ── Barra de busca ──────────────────────────────────────────────────────── */
.rss-search-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
  flex-shrink: 0;
}

.rss-search-icon {
  color: var(--text-tertiary);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.rss-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 0.9375rem;
  color: var(--text-primary);
  outline: none;
  caret-color: var(--primary);
  min-width: 0;
  font-family: inherit;
}

.rss-search-input::placeholder {
  color: var(--text-tertiary);
}

.rss-search-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  font-size: 1rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
}

.rss-search-clear:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ── Body (scroll) ───────────────────────────────────────────────────────── */
.rss-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ── Estado vazio ────────────────────────────────────────────────────────── */
.rss-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-12) var(--space-6);
  text-align: center;
}

.rss-empty-icon {
  width: 56px;
  height: 56px;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.rss-empty-icon i {
  font-size: 1.5rem;
  color: var(--gray-400);
}

.rss-empty-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.rss-empty-sub {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--text-tertiary);
}

/* ── Grupos de tema ──────────────────────────────────────────────────────── */
.rss-group {
  border-bottom: 1px solid var(--border-color);
}

.rss-group:last-child {
  border-bottom: none;
}

.rss-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  background: var(--gray-50);
  cursor: pointer;
  user-select: none;
  gap: var(--space-3);
  transition: background var(--transition-fast);
}

.rss-group-header:hover {
  background: var(--gray-100);
}

.rss-group-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

/* Wrapper do checkbox de selecionar todos */
.rss-theme-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

/* Checkbox base */
.rss-cb {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

/* Ícone + nome do grupo */
.rss-group-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.rss-group-icon {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-md);
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.75rem;
  flex-shrink: 0;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rss-group-icon--active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.rss-group-name {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rss-group-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Badge de contagem do grupo */
.rss-group-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 600;
  white-space: nowrap;
}

.rss-group-count--active {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* Chevron de colapso */
.rss-chevron {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-base);
  flex-shrink: 0;
}

.rss-chevron--closed {
  transform: rotate(-90deg);
}

/* ── Itens de requisito ───────────────────────────────────────────────────── */
.rss-group-items {
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rss-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  cursor: pointer;
  user-select: none;
  border: 1.5px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.rss-item:hover {
  background: rgba(37, 99, 235, 0.04);
}

/* ── Toggle de Instrutor (novo) ──────────────────────────────────────────── */
.rss-instructor-toggle {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200, #e5e7eb);
  background: var(--gray-50, #f9fafb);
  color: var(--text-muted, #9ca3af);
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
  white-space: nowrap;
  line-height: 1;
}
.rss-item--sel .rss-instructor-toggle { display: flex; }
.rss-instructor-toggle:hover          { border-color: #fbbf24; color: #92400e; background: #fef3c7; }
.rss-instructor-toggle.rss-instructor--active { border-color: #f59e0b; color: #92400e; background: #fef3c7; }
.rss-item--instructor {
  background: linear-gradient(90deg, #fffbeb 0%, transparent 100%);
  border-left: 3px solid #f59e0b;
}

.rss-item--sel {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.2);
}

.rss-item input[type="checkbox"].rss-cb {
  margin-top: 2px;
}

/* Corpo do item */
.rss-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rss-item-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  word-break: break-word;
}

.rss-item-desc {
  font-size: 0.775rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  word-break: break-word;
}

/* Ícone de check no lado direito do item */
.rss-item-check {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.65rem;
  opacity: 0;
  transition: opacity var(--transition-fast), background var(--transition-fast);
  flex-shrink: 0;
  margin-top: 2px;
}

.rss-item-check--visible {
  opacity: 1;
  background: rgba(37, 99, 235, 0.12);
}

/* ── Footer do seletor ───────────────────────────────────────────────────── */
.rss-footer-area {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1.5px solid var(--border-color);
  background: var(--white);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.rss-footer-left {
  flex-shrink: 0;
}

.rss-footer-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Indicador de seleção */
.rss-sel-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

.rss-sel-info i {
  font-size: 1rem;
}

.rss-sel-info--empty {
  color: var(--text-tertiary);
}

/* ── Botões do footer ────────────────────────────────────────────────────── */
.rss-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1.5px solid;
  font-family: inherit;
}

.rss-btn--clear {
  background: var(--white);
  color: var(--text-tertiary);
  border-color: var(--border-color);
}

.rss-btn--clear:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.05);
}

.rss-btn--cancel {
  background: var(--white);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.rss-btn--cancel:hover {
  background: var(--gray-100);
  border-color: var(--border-hover);
}

.rss-btn--confirm {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
  padding: var(--space-2) var(--space-5);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.rss-btn--confirm:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

/* ────────────────────────────────────────────────────────────────────────────
   LEGACY — classes antigas mantidas para compatibilidade com código antigo
   ──────────────────────────────────────────────────────────────────────────── */

/* Container antigo do modal */
.rss-content {
  max-width: 580px !important;
  width: 95% !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  max-height: 88vh !important;
  padding: 0 !important;
}

/* Header antigo */
.rss-header-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}

.rss-header-title i { color: var(--primary); }

/* Search bar antiga */
.rss-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  background: var(--white);
  flex-shrink: 0;
}

/* Badges antigos */
.rss-badge-sel {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--white);
  background: var(--primary);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.rss-badge-neutral {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 600;
}

/* Items antigos */
.rss-items {
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rss-item-text {
  flex: 1;
  min-width: 0;
}

.rss-item.sel {
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.2);
}

.rss-check-icon {
  font-size: 0.75rem;
  color: var(--primary);
  opacity: 0;
  transition: opacity var(--transition-fast);
  flex-shrink: 0;
  margin-top: 4px;
}

.rss-item.sel .rss-check-icon { opacity: 1; }

/* Footer antigo */
.rss-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1.5px solid var(--border-color);
  background: var(--white);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.rss-footer-count {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-tertiary);
}

.rss-footer-count.active { color: var(--primary); }

.rss-footer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* ── Tags de requisitos legados ──────────────────────────────────────────── */
.req-tags-area          { margin-top: var(--space-3); }
.req-tags-area.has-tags {
  padding: var(--space-3) var(--space-4);
  background: rgba(37, 99, 235, 0.03);
  border: 1.5px solid rgba(37, 99, 235, 0.15);
  border-radius: var(--radius-lg);
}
.req-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}
.req-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(37, 99, 235, 0.09);
  border: 1.5px solid rgba(37, 99, 235, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  max-width: 260px;
}
.req-tag-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}
.req-empty-state {
  text-align: center;
  padding: var(--space-5) var(--space-4);
  color: var(--text-tertiary);
  background: var(--gray-50);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}
.req-empty-state i { font-size: 1.75rem; display: block; margin-bottom: var(--space-2); color: var(--gray-300); }
.req-empty-state p { margin: 0; font-size: 0.875rem; }
.req-empty-hint { font-size: 0.775rem !important; margin-top: var(--space-1) !important; opacity: 0.75; }
.section-title-optional { font-size: 0.75rem; font-weight: 400; color: var(--text-tertiary); margin-left: var(--space-1); }
.btn-select-reqs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: var(--white);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}
.btn-select-reqs:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.03);
}
.btn-select-reqs.has-selection {
  border-style: solid;
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--primary);
  background: rgba(37, 99, 235, 0.04);
}

/* ── Responsividade do seletor ───────────────────────────────────────────── */
@media (max-width: 640px) {
  .rss-sheet {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90dvh !important;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
  }

  /* Legacy */
  .rss-content {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 90dvh !important;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0 !important;
    margin: 0 !important;
  }

  .rss-footer-area {
    flex-direction: column;
    gap: var(--space-2);
  }

  .rss-footer-right {
    width: 100%;
    justify-content: stretch;
  }

  .rss-btn--confirm {
    flex: 1;
  }

  .rss-footer {
    flex-direction: column;
    border-radius: 0;
    gap: var(--space-2);
  }

  .rss-footer-actions {
    justify-content: stretch;
    width: 100%;
  }
}
