/**
 * Estilos Modernos para Sistema de Tags com IA
 * Design atual e responsivo
 */

/* ========== CONTAINER PRINCIPAL ========== */
.modern-tags-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ========== HEADER ========== */
.tags-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.tags-header-left {
  flex: 1;
  min-width: 250px;
}

.tags-title {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.tags-title .material-icons {
  font-size: 32px;
  color: #667eea;
}

.tags-subtitle {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.tags-header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ========== BOTÕES ========== */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

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

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-secondary:hover {
  background: #667eea;
  color: white;
}

.icon-btn {
  background: transparent;
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background: #f3f4f6;
  color: #667eea;
}

.icon-btn.danger:hover {
  background: #fee2e2;
  color: #ef4444;
}

.link-btn {
  background: none;
  border: none;
  color: #667eea;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 4px 0;
  transition: all 0.2s ease;
}

.link-btn:hover {
  color: #764ba2;
  text-decoration: underline;
}

.link-btn .material-icons {
  font-size: 16px;
}

/* ========== DASHBOARD DE ESTATÍSTICAS ========== */
.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: white;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons {
  font-size: 32px;
  color: white;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 14px;
  color: #6b7280;
  font-weight: 500;
}

/* Card de Top Tags (mais largo) */
.top-tags-card {
  grid-column: 1 / -1;
  flex-direction: column;
  align-items: stretch;
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 16px;
}

.stat-header .material-icons {
  color: #667eea;
}

.top-tags-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.top-tag-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.top-tag-item:hover {
  background: #f3f4f6;
}

.tag-rank {
  font-size: 18px;
  font-weight: 700;
  color: #667eea;
  min-width: 36px;
}

.tag-name {
  flex: 1;
  font-weight: 600;
  color: #1a1a1a;
}

.tag-count,
.tag-confidence {
  font-size: 13px;
  color: #6b7280;
  padding: 4px 10px;
  background: white;
  border-radius: 6px;
  font-weight: 500;
}

/* ========== FILTROS ========== */
.tags-filters {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  background: #f3f4f6;
  border: 2px solid transparent;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  background: #e5e7eb;
  color: #1a1a1a;
}

.filter-btn.active {
  background: #ede9fe;
  border-color: #667eea;
  color: #667eea;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f9fafb;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  min-width: 250px;
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: #667eea;
  background: white;
}

.search-box .material-icons {
  color: #9ca3af;
  font-size: 20px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  flex: 1;
  font-size: 14px;
  color: #1a1a1a;
}

.search-box input::placeholder {
  color: #9ca3af;
}

/* ========== GRID DE TAGS ========== */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.tag-card-modern {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  overflow: hidden;
}

.tag-card-modern:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.tag-card-header {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #f3f4f6;
}

.tag-badge {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-actions {
  display: flex;
  gap: 4px;
}

.tag-card-body {
  padding: 16px;
}

.tag-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f9fafb;
}

.tag-info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
}

.info-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-badge.clientes {
  background: #dbeafe;
  color: #1e40af;
}

.info-badge.nao_clientes {
  background: #fef3c7;
  color: #92400e;
}

.info-badge.ambos {
  background: #d1fae5;
  color: #065f46;
}

.tag-stats-mini {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
  display: flex;
  gap: 12px;
}

.stat-mini {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: #6b7280;
}

.stat-mini .material-icons {
  font-size: 16px;
  color: #667eea;
}

.tag-no-usage {
  margin-top: 12px;
  padding: 12px;
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* ========== ESTADOS VAZIOS ========== */
.empty-state {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 14px;
}

.empty-state-large {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-state-large .material-icons {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 16px;
}

.empty-state-large h3 {
  font-size: 20px;
  color: #1a1a1a;
  margin: 0 0 8px 0;
}

.empty-state-large p {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

.stats-card.loading {
  justify-content: center;
  align-items: center;
  color: #9ca3af;
  font-size: 14px;
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content-modern {
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlideIn 0.3s ease;
}

.modal-content-modern.small {
  max-width: 400px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  padding: 24px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.modal-header h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.2s ease;
  border-radius: 6px;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #1a1a1a;
}

#tagForm {
  padding: 24px;
}

/* Preview da Tag */
.tag-preview {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
  border-radius: 12px;
  margin-bottom: 24px;
}

#tagPreview {
  display: inline-flex;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Form Groups */
.form-group {
  margin-bottom: 20px;
}

.form-group.half {
  flex: 1;
  min-width: 150px;
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 8px;
}

.form-group label .material-icons {
  font-size: 18px;
  color: #667eea;
}

.label-help {
  font-size: 12px;
  font-weight: 400;
  color: #9ca3af;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-color {
  width: 100%;
  height: 50px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-color:hover {
  border-color: #667eea;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
}

.form-hint .material-icons {
  font-size: 16px;
  color: #667eea;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #f3f4f6;
}

/* Keywords Modal */
.keywords-list {
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.keyword-chip {
  padding: 6px 14px;
  background: #ede9fe;
  color: #667eea;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ========== RESPONSIVIDADE ========== */
@media (max-width: 768px) {
  .modern-tags-container {
    padding: 16px;
  }

  .tags-header {
    flex-direction: column;
    align-items: stretch;
  }

  .tags-header-right {
    justify-content: space-between;
  }

  .tags-title {
    font-size: 24px;
  }

  .stats-dashboard {
    grid-template-columns: 1fr;
  }

  .tags-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-buttons {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .search-box {
    width: 100%;
  }

  .tags-grid {
    grid-template-columns: 1fr;
  }

  .modal-content-modern {
    max-width: 100%;
    margin: 10px;
  }

  .form-row {
    flex-direction: column;
  }
}

/* ========== SCROLLBAR CUSTOMIZADO ========== */
.modal-content-modern::-webkit-scrollbar,
.keywords-list::-webkit-scrollbar {
  width: 8px;
}

.modal-content-modern::-webkit-scrollbar-track,
.keywords-list::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.modal-content-modern::-webkit-scrollbar-thumb,
.keywords-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.modal-content-modern::-webkit-scrollbar-thumb:hover,
.keywords-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}
