/* Xstoreindia External Product Photo & Video Integration UI */
.xem-panel {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 16px;
  margin-top: 12px;
  color: #0f172a;
}

.xem-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.xem-header h3, .xem-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.xem-toolbar, .xem-filter-row, .xem-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.xem-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.xem-btn:hover:not(:disabled) {
  background: #eff6ff;
  border-color: #3b82f6;
}

.xem-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.xem-btn-primary {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.xem-btn-primary:hover:not(:disabled) {
  background: #1e40af;
}

.xem-btn-danger {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.xem-btn-success {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
}

.xem-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.xem-pill[data-tone="ok"], .xem-pill[data-status="APPROVED"], .xem-pill[data-status="ACTIVE"], .xem-pill[data-status="CLEAN"] {
  background: #dcfce7;
  color: #166534;
}

.xem-pill[data-tone="warn"], .xem-pill[data-status="PENDING_REVIEW"], .xem-pill[data-status="PENDING_CONFIG"], .xem-pill[data-status="PROCESSING"] {
  background: #fef3c7;
  color: #92400e;
}

.xem-pill[data-tone="danger"], .xem-pill[data-status="REJECTED"], .xem-pill[data-status="BLOCKED"], .xem-pill[data-status="INFECTED"], .xem-pill[data-status="DISABLED"] {
  background: #fee2e2;
  color: #991b1b;
}

.xem-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.xem-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.xem-card-media {
  position: relative;
  height: 156px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.xem-card-media img, .xem-card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.xem-card-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  flex: 1;
}

.xem-card-title {
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xem-meta {
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.35;
}

.xem-status-msg {
  margin: 8px 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 0.85rem;
}

.xem-status-msg[data-error="true"] {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.xem-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.xem-modal {
  background: #ffffff;
  border-radius: 14px;
  width: min(980px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
}

.xem-modal-sm {
  width: min(560px, 100%);
}

.xem-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.xem-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
}

.xem-field input, .xem-field select, .xem-field textarea {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.85rem;
  color: #0f172a;
  background: #ffffff;
}

.xem-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.xem-kpi-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.xem-kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
}

.xem-kpi-label {
  font-size: 0.75rem;
  color: #475569;
  font-weight: 600;
}

.xem-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
  margin-bottom: 12px;
}

.xem-tab[aria-selected="true"] {
  background: #1d4ed8;
  color: #ffffff;
  border-color: #1d4ed8;
}

.xem-dropzone {
  border: 2px dashed #94a3b8;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
}

.xem-dropzone[data-over="true"] {
  border-color: #2563eb;
  background: #eff6ff;
}

.xem-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.xem-gallery-slot {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #ffffff;
}

.xem-gallery-slot img, .xem-gallery-slot video {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 6px;
  background: #f1f5f9;
}

@media (max-width: 640px) {
  .xem-modal {
    padding: 14px;
  }
  .xem-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
