/**
 * WhatsApp Cloud FAQ Styles
 * Modern, responsive design with clean aesthetics
 */

.faq-module {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Header */
.faq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e5e7eb;
}

.faq-header-left h2 {
  margin: 0 0 5px 0;
  font-size: 28px;
  font-weight: 600;
  color: #111827;
}

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

.faq-header-right {
  display: flex;
  gap: 10px;
}

/* Statistics */
.faq-statistics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e5e7eb;
  transition: transform 0.2s, box-shadow 0.2s;
}

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

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #f3f4f6;
  color: #6b7280;
}

.stat-success .stat-icon {
  background: #d1fae5;
  color: #059669;
}

.stat-warning .stat-icon {
  background: #fef3c7;
  color: #d97706;
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.stat-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 5px;
}

/* Filters */
.faq-filters {
  display: flex;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.filter-group select,
.filter-group input[type="text"] {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.filter-group select:focus,
.filter-group input[type="text"]:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* FAQ List */
.faq-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.faq-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.faq-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.faq-inactive {
  opacity: 0.6;
}

.faq-card-header {
  padding: 15px 20px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.faq-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.faq-emoji {
  font-size: 24px;
  line-height: 1;
}

.faq-question {
  font-weight: 600;
  color: #111827;
  font-size: 15px;
  line-height: 1.4;
}

.faq-card-actions {
  display: flex;
  gap: 5px;
}

.btn-icon {
  background: none;
  border: none;
  padding: 5px 8px;
  cursor: pointer;
  color: #6b7280;
  border-radius: 6px;
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover {
  background: #e5e7eb;
  color: #111827;
}

.btn-icon.text-success {
  color: #059669;
}

.btn-icon.text-danger {
  color: #dc2626;
}

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

.faq-card-body {
  padding: 20px;
}

.faq-answer {
  color: #374151;
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 15px 0;
}

.faq-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #6b7280;
}

.faq-keyword {
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  color: #4b5563;
}

.faq-card-footer {
  padding: 12px 20px;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #6b7280;
}

.faq-category,
.faq-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Empty State */
.faq-empty {
  text-align: center;
  padding: 60px 20px;
  background: white;
  border-radius: 12px;
  border: 2px dashed #d1d5db;
}

.faq-empty i {
  font-size: 64px;
  color: #d1d5db;
  margin-bottom: 20px;
}

.faq-empty h3 {
  margin: 0 0 10px 0;
  color: #374151;
  font-size: 20px;
}

.faq-empty p {
  margin: 0 0 25px 0;
  color: #6b7280;
}

/* Loading State */
.faq-loading {
  text-align: center;
  padding: 60px 20px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f4f6;
  border-top-color: #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-large {
  max-width: 800px;
}

.modal-header {
  padding: 20px 25px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s;
}

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

.modal-body {
  padding: 25px;
}

.modal-footer {
  padding: 20px 25px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

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

.form-group small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  color: #6b7280;
}

.form-group input[type="checkbox"] {
  margin-right: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #10b981;
  color: white;
}

.btn-primary:hover {
  background: #059669;
}

.btn-secondary {
  background: #f3f4f6;
  color: #374151;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

/* Responsive */
@media (max-width: 768px) {
  .faq-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .faq-header-right {
    width: 100%;
  }

  .faq-header-right .btn {
    flex: 1;
  }

  .faq-list {
    grid-template-columns: 1fr;
  }

  .faq-statistics {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
/* Enhanced FAQ Features */

/* Enhanced Statistics */
.stat-card.stat-info .stat-icon {
  background: #dbeafe;
  color: #2563eb;
}

.stat-card.stat-primary .stat-icon {
  background: #ede9fe;
  color: #7c3aed;
}

/* FAQ Metrics */
.faq-metrics {
  display: flex;
  gap: 15px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e5e7eb;
  flex-wrap: wrap;
}

.metric-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 80px;
}

.metric-label {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.metric-value {
  font-weight: 600;
  font-size: 13px;
  color: #111827;
}

.metric-value.text-success { color: #059669; }
.metric-value.text-warning { color: #d97706; }
.metric-value.text-danger { color: #dc2626; }

.faq-last-used {
  font-size: 11px;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-icon.text-info {
  color: #2563eb;
}

.btn-icon.text-info:hover {
  background: #dbeafe;
}

/* Settings Sections */
.settings-section {
  margin-bottom: 30px;
  padding-bottom: 25px;
  border-bottom: 1px solid #e5e7eb;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.settings-section h4 {
  color: #111827;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
}

.settings-section h4 i {
  color: #6b7280;
  font-size: 18px;
}

/* Analytics Modal */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.analytics-card {
  background: #f9fafb;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  border: 1px solid #e5e7eb;
}

.analytics-icon {
  font-size: 28px;
  color: #6b7280;
  min-width: 50px;
  text-align: center;
}

.analytics-content {
  flex: 1;
}

.analytics-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  line-height: 1;
}

.analytics-label {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}

.analytics-section {
  margin-bottom: 30px;
}

.analytics-section h4 {
  color: #111827;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
}

/* Usage Timeline */
.usage-timeline {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: white;
}

.usage-item {
  padding: 15px;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  gap: 15px;
}

.usage-item:last-child {
  border-bottom: none;
}

.usage-date {
  font-size: 13px;
  color: #6b7280;
  min-width: 100px;
  font-weight: 500;
}

.usage-details {
  flex: 1;
}

.usage-message {
  font-size: 14px;
  color: #111827;
  margin-bottom: 8px;
  font-style: italic;
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #e5e7eb;
}

.usage-meta {
  display: flex;
  gap: 15px;
  font-size: 12px;
}

.usage-confidence {
  color: #059669;
  font-weight: 600;
  background: #d1fae5;
  padding: 2px 8px;
  border-radius: 12px;
}

.usage-algorithm {
  color: #6b7280;
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

/* Failed Searches */
.failed-searches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.failed-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #fef3c7;
  border-radius: 8px;
  border-left: 4px solid #f59e0b;
}

.search-query {
  font-size: 14px;
  color: #92400e;
  font-weight: 500;
}

.search-count {
  font-size: 12px;
  color: #78350f;
  background: #fbbf24;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .faq-metrics {
    justify-content: center;
  }
  
  .usage-item {
    flex-direction: column;
    gap: 8px;
  }
  
  .usage-date {
    min-width: auto;
    font-weight: 600;
  }
  
  .failed-search-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .usage-meta {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .faq-metrics {
    flex-direction: column;
    align-items: center;
  }
  
  .metric-item {
    min-width: 120px;
  }
}