/* ========== MATERIAIS DE APOIO — TAB ==========
   Estilos para a aba de Materiais de Apoio no dashboard de classes.
   Compatível com o design system do portal Antares Kids.
   ============================================== */

/* ── Wrapper principal ──────────────────────────────────────────────────── */
.materials-wrap {
  padding: 0;
}

/* ── Header da seção ────────────────────────────────────────────────────── */
.materials-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1rem 0.75rem;
  flex-wrap: wrap;
}

.materials-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
}

.materials-title i {
  color: var(--primary, #2563eb);
  font-size: 1.1rem;
}

.materials-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--gray-100, #f1f5f9);
  color: var(--text-muted, #64748b);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
}

/* ── Botão de upload ────────────────────────────────────────────────────── */
.btn-upload-material {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1rem;
  background: var(--primary, #2563eb);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn-upload-material:hover {
  background: var(--primary-dark, #1d4ed8);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-upload-material:active {
  transform: translateY(0);
}

/* ── Área de drag-and-drop ──────────────────────────────────────────────── */
.materials-drop-area {
  margin: 0 1rem 1rem;
  border: 2px dashed var(--border-color, #e2e8f0);
  border-radius: 12px;
  background: var(--gray-50, #f8fafc);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
  position: relative;
}

.materials-drop-area:hover,
.materials-drop-area.drag-over {
  border-color: var(--primary, #2563eb);
  background: rgba(37, 99, 235, 0.04);
}

.materials-drop-area input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.drop-area-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.drop-area-icon i {
  font-size: 1.5rem;
  color: var(--primary, #2563eb);
}

.drop-area-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  margin-bottom: 0.25rem;
}

.drop-area-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted, #64748b);
  margin-bottom: 0.75rem;
}

.drop-area-types {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted, #64748b);
}

.drop-area-types i {
  font-size: 0.9rem;
}

/* ── Campo de descrição (upload modal) ──────────────────────────────────── */
.material-desc-field {
  margin: 0 1rem 1rem;
  display: none;
}

.material-desc-field.visible {
  display: block;
}

.material-desc-field label {
  display: block;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-secondary, #475569);
  margin-bottom: 0.35rem;
}

.material-desc-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text-primary, #1e293b);
  background: #fff;
  transition: border-color 0.15s;
  box-sizing: border-box;
  resize: none;
}

.material-desc-input:focus {
  outline: none;
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ── Progresso de upload ────────────────────────────────────────────────── */
.material-upload-progress {
  margin: 0 1rem 0.75rem;
  display: none;
}

.material-upload-progress.visible {
  display: block;
}

.upload-progress-bar-wrap {
  height: 6px;
  background: var(--gray-200, #e2e8f0);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.upload-progress-bar-fill {
  height: 100%;
  background: var(--primary, #2563eb);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.upload-progress-label {
  font-size: 0.78rem;
  color: var(--text-muted, #64748b);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ── Lista de materiais ─────────────────────────────────────────────────── */
.materials-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 3rem 1rem;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
}

.materials-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-muted, #64748b);
}

.materials-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--gray-100, #f1f5f9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.materials-empty-icon i {
  font-size: 1.8rem;
  color: var(--text-muted, #94a3b8);
}

.materials-empty p {
  font-size: 0.95rem;
  color: var(--text-secondary, #64748b);
  font-weight: 500;
  margin: 0;
}

.materials-empty small {
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}

.materials-list {
  padding: 0 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Card individual de material ────────────────────────────────────────── */
.material-card {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  background: #fff;
  border: 1.5px solid var(--border-color, #e2e8f0);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}

.material-card:hover {
  border-color: var(--primary-light, #bfdbfe);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.07);
}

/* ── Ícone do arquivo ───────────────────────────────────────────────────── */
.material-file-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.material-file-icon.icon-pdf    { background: #fef2f2; color: #dc2626; }
.material-file-icon.icon-word   { background: #eff6ff; color: #2563eb; }
.material-file-icon.icon-excel  { background: #f0fdf4; color: #16a34a; }
.material-file-icon.icon-ppt    { background: #fff7ed; color: #ea580c; }
.material-file-icon.icon-image  { background: #fdf4ff; color: #9333ea; }
.material-file-icon.icon-video  { background: #fef3c7; color: #d97706; }
.material-file-icon.icon-text   { background: #f8fafc; color: #64748b; }
.material-file-icon.icon-other  { background: #f8fafc; color: #64748b; }

/* ── Informações do arquivo ─────────────────────────────────────────────── */
.material-info {
  flex: 1;
  min-width: 0;
}

.material-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary, #1e293b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.material-description {
  font-size: 0.78rem;
  color: var(--text-secondary, #475569);
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.material-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.material-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.73rem;
  color: var(--text-muted, #94a3b8);
}

.material-meta-item i {
  font-size: 0.7rem;
}

/* ── Ações do card ──────────────────────────────────────────────────────── */
.material-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn-material-download,
.btn-material-delete {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.btn-material-download {
  background: var(--gray-100, #f1f5f9);
  color: var(--primary, #2563eb);
}

.btn-material-download:hover {
  background: var(--primary, #2563eb);
  color: #fff;
  transform: translateY(-1px);
}

.btn-material-delete {
  background: var(--gray-100, #f1f5f9);
  color: var(--error, #dc2626);
}

.btn-material-delete:hover {
  background: #fef2f2;
  color: #dc2626;
  transform: translateY(-1px);
}

/* ── Separador de upload ────────────────────────────────────────────────── */
.materials-divider {
  height: 1px;
  background: var(--border-color, #e2e8f0);
  margin: 0 1rem 0.75rem;
}

/* ── Estado de upload ativo no card ─────────────────────────────────────── */
.material-card.uploading {
  opacity: 0.7;
  pointer-events: none;
}

/* ── Botão de upload desabilitado (durante envio) ───────────────────────── */
.btn-upload-material:disabled {
  background: var(--gray-400, #94a3b8);
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  transform: none;
}

/* ── Drop area durante upload (bloqueada) ───────────────────────────────── */
.materials-drop-area.uploading-active {
  opacity: 0.5;
  pointer-events: none;
  border-color: var(--gray-300, #cbd5e1);
  background: var(--gray-100, #f1f5f9);
}

/* ── Responsividade ─────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .materials-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }

  .material-card {
    gap: 0.7rem;
    padding: 0.75rem;
  }

  .material-file-icon {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
  }

  .material-name {
    font-size: 0.85rem;
  }

  .material-meta {
    gap: 0.4rem;
  }

  .drop-area-types {
    display: none;
  }
}
