/**
 * BarghPro Product Questions Main Stylesheet
 * Primary Brand Color: #1A91DD
 * Digikala & WooCommerce Review-Matching Card Layout, High-Header Resistant Modals & RTL Support
 *
 * @package BarghPro_Product_Questions
 * @version 1.0.2
 */

/* ==========================================================================
   1. General Container & Action Bar
   ========================================================================== */

.barghpro-qa-container {
  font-family: inherit;
  direction: rtl;
  text-align: right;
  margin: 2.5rem 0;
  color: #1e293b;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  clear: both;
}

.barghpro-qa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.barghpro-qa-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: #0f172a;
}

.barghpro-qa-count {
  font-size: 0.875rem;
  color: #64748b;
}

/* Buttons using #1A91DD */
.barghpro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
}

.barghpro-btn-primary {
  background-color: #1A91DD !important;
  color: #ffffff !important;
  box-shadow: 0 2px 6px rgba(26, 145, 221, 0.25);
}

.barghpro-btn-primary:hover,
.barghpro-btn-primary:focus-visible {
  background-color: #147cbd !important;
  box-shadow: 0 4px 10px rgba(26, 145, 221, 0.35);
}

.barghpro-btn-outline {
  background-color: transparent;
  border: 1px solid #cbd5e1;
  color: #334155;
}

.barghpro-btn-outline:hover {
  background-color: #f8fafc;
  border-color: #94a3b8;
  color: #1A91DD;
}

/* ==========================================================================
   2. Search & Filter Bar
   ========================================================================== */

.barghpro-qa-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.barghpro-filter-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.barghpro-select {
  padding: 0.6rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.85rem;
  background-color: #ffffff;
  color: #334155;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.barghpro-select:focus {
  border-color: #1A91DD;
}

/* ==========================================================================
   3. Question Cards
   ========================================================================== */

.barghpro-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.barghpro-question-card {
  position: relative;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background-color: #ffffff;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.barghpro-question-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.barghpro-pinned-card {
  border-color: #1A91DD;
  background-color: #f0f7ff;
}

.barghpro-pinned-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background-color: #e0f2fe;
  color: #0369a1;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.barghpro-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.barghpro-author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.barghpro-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1A91DD, #0c6ab0);
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.barghpro-author-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.barghpro-author-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
}

/* Badges */
.barghpro-badges-wrapper {
  display: inline-flex;
  gap: 0.35rem;
}

.barghpro-badge {
  font-size: 0.725rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}

.barghpro-badge-buyer {
  background-color: #d1fae5;
  color: #065f46;
}

.barghpro-badge-admin {
  background-color: #fee2e2;
  color: #991b1b;
}

.barghpro-badge-support {
  background-color: #e0f2fe;
  color: #0369a1;
}

.barghpro-badge-vendor {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.barghpro-badge-user {
  background-color: #f1f5f9;
  color: #475569;
}

.barghpro-time-meta {
  font-size: 0.8rem;
  color: #94a3b8;
}

.barghpro-exact-date {
  margin-right: 0.25rem;
}

.barghpro-question-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #334155;
  margin: 0 0 1rem 0;
}

.barghpro-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  border-top: 1px dashed #f1f5f9;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.barghpro-action-btns {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.barghpro-btn-action {
  background: none;
  border: none;
  padding: 0;
  color: #64748b;
  font-size: 0.825rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: color 0.15s ease;
}

.barghpro-btn-action:hover {
  color: #1A91DD;
}

.barghpro-voting-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.barghpro-helpful-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-left: 0.25rem;
}

.barghpro-vote-btn {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.barghpro-vote-btn:hover {
  background-color: #f0f7ff;
  border-color: #bae6fd;
  color: #1A91DD;
}

/* Replies Section */
.barghpro-replies-wrapper {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.barghpro-replies-header {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.85rem;
}

.barghpro-replies-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.barghpro-reply-item {
  position: relative;
  background-color: #f8fafc;
  border-radius: 10px;
  padding: 1rem;
  border-right: 3px solid #1A91DD;
}

.barghpro-accepted-reply {
  border-right-color: #10b981;
  background-color: #f0fdf4;
}

.barghpro-accepted-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background-color: #dcfce7;
  color: #15803d;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.barghpro-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  background-color: #f8fafc;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}

.barghpro-load-more-wrapper {
  text-align: center;
  margin-top: 1.75rem;
}

/* ==========================================================================
   4. High-Header Resistant Modal Popup Component (#1A91DD)
   ========================================================================== */

.barghpro-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  /* Max safe z-index so no theme header (however tall or however it stacks) can render on top of the modal */
  z-index: 2147483647 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 2rem 1rem;
  overflow-y: auto;
  box-sizing: border-box;
}

.barghpro-modal-backdrop.barghpro-active {
  opacity: 1;
  visibility: visible;
}

.barghpro-modal-dialog {
  background-color: #ffffff;
  width: 100%;
  max-width: 540px;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transform: scale(0.95);
  transition: transform 0.25s ease;
  direction: rtl;
  text-align: right;
  margin: 0 auto;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  position: relative;
}

.barghpro-modal-backdrop.barghpro-active .barghpro-modal-dialog {
  transform: scale(1);
}

.barghpro-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e2e8f0;
  background-color: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 10;
}

.barghpro-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  color: #0f172a;
}

.barghpro-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.barghpro-modal-close:hover {
  color: #ef4444;
}

.barghpro-modal-form {
  padding: 1.5rem;
}

.barghpro-form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 480px) {
  .barghpro-form-row-2 {
    grid-template-columns: 1fr;
  }
}

.barghpro-form-group {
  margin-bottom: 1.25rem;
}

.barghpro-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #334155;
}

.barghpro-form-group input[type="text"],
.barghpro-form-group input[type="tel"],
.barghpro-form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.barghpro-form-group input:focus,
.barghpro-form-group textarea:focus {
  border-color: #1A91DD;
  box-shadow: 0 0 0 3px rgba(26, 145, 221, 0.15);
}

.barghpro-form-checkbox {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  color: #475569;
}

.barghpro-field-error {
  display: block;
  font-size: 0.775rem;
  color: #ef4444;
  margin-top: 0.25rem;
}

.barghpro-form-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1.25rem;
}

.barghpro-form-alert.barghpro-alert-error {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.barghpro-form-alert.barghpro-alert-success {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.barghpro-modal-footer {
  margin-top: 1rem;
  text-align: left;
}

/* ==========================================================================
   5. Admin Metrics
   ========================================================================== */

.barghpro-admin-wrap {
  margin-top: 1rem;
}

.barghpro-admin-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.barghpro-metric-card {
  background: #ffffff;
  border: 1px solid #c3c4c7;
  border-radius: 8px;
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.barghpro-metric-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1d2327;
}

.barghpro-metric-title {
  font-size: 0.85rem;
  color: #646970;
}

.barghpro-card-pending .barghpro-metric-num { color: #d97706; }
.barghpro-card-approved .barghpro-metric-num { color: #059669; }
.barghpro-card-unanswered .barghpro-metric-num { color: #1A91DD; }
.barghpro-card-rejected .barghpro-metric-num { color: #dc2626; }


.barghpro-action-btns:nth-child(3) .barghpro-report-btn {
    display: none !important;
}