/* Shared form blocks: modal form grid, and small utilities */

.search-input {
  min-width: 200px;
}

.actions-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.actions-wrap.radio-group {
  justify-content: center;
  gap: 20px;
}

.label-text {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}

/* Modal Form Styles */
.modal-form {
  display: block;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.modal-form-grid .full-width {
  grid-column: 1 / -1;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--primary-50);
  border-radius: 10px;
  border: 1px solid var(--primary-100);
}

.form-section h3 {
  margin: 0 0 4px 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-600);
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-row.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-row.four-col {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-row.five-col {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.modal-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0;
}

.modal-form label span {
  display: block;
  font-weight: 600;
  color: #0f172a;
  font-size: 12px;
}

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: #fff;
  color: var(--gray-700);
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.modal-form .form-row textarea {
  min-height: 34px;
  resize: none;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus {
  outline: none;
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px var(--primary-100);
}

/* Input states */
.modal-form input.input-invalid,
.modal-form textarea.input-invalid {
  border-color: var(--error-500);
  box-shadow: 0 0 0 3px var(--error-100);
}

/* Numeric inputs */
.modal-form input.numeric,
.modal-form input[type="number"] {
  text-align: right;
  font-family: inherit;
}

.modal-form input.numeric::placeholder,
.modal-form input[type="number"]::placeholder {
  text-align: right;
  opacity: 0.6;
}

.role-options {
  display: flex;
  gap: 16px;
  margin-top: 8px;
}

/* Contact Popover Styles */
.contact-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.contact-toggle-btn:hover {
  background-color: rgba(0, 0, 0, 0.05);
}

.contact-popover {
  position: absolute;
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 12px 16px;
  min-width: 200px;
  max-width: 300px;
  z-index: 1000;
  font-size: 13px;
  color: #f9fafb;
}

.contact-popover.hide {
  display: none;
}

.contact-popover.show {
  display: block;
}

.contact-popover::before {
  content: '';
  position: absolute;
  top: var(--arrow-top, 50%);
  width: 0;
  height: 0;
  border-style: solid;
}

.contact-popover.arrow-left::before {
  left: -8px;
  margin-top: -6px;
  border-width: 6px 8px 6px 0;
  border-color: transparent #111827 transparent transparent;
}

.contact-popover.arrow-right::before {
  right: -8px;
  margin-top: -6px;
  border-width: 6px 0 6px 8px;
  border-color: transparent transparent transparent #111827;
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #374151;
}

.contact-line:last-child {
  border-bottom: none;
}

.contact-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.contact-icon img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.email-icon img {
  width: 20px;
  height: 20px;
}

.contact-value {
  color: #f3f4f6;
  word-break: break-word;
}

.contact-empty {
  color: #9ca3af;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
}

/* Checkbox grid (dùng trong modal chọn trường đồng bộ TikTok) */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  align-items: center;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.checkbox-item:hover {
  background-color: var(--primary-100);
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary-500);
  flex-shrink: 0;
}

.checkbox-item span {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkbox-all {
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: 8px;
  padding: 6px 10px;
}

.checkbox-all span {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary-700);
}

@media (max-width: 980px) {
  .modal-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .modal-form-grid .full-width {
    grid-column: auto;
  }

  .form-row.two-col,
  .form-row.three-col,
  .form-row.four-col,
  .form-row.five-col {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 12px;
  }

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

/* Inline edit form (dùng chung campaign detail + videos) */
.ve-input {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
}

.ve-input--date {
  width: 100%;
  padding: 2px 6px;
}

.ve-select {
  padding: 6px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 12px;
  min-width: 0;
}

.ve-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.ve-actions .btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
}

.ve-actions .btn-icon:hover {
  background: #f3f4f6;
}

/* Editable cell (click to edit trên bảng) */
.editable-cell {
  cursor: pointer;
  border-bottom: 1px dashed #d1d5db;
  transition: border-color 0.15s ease;
}

.editable-cell:hover {
  border-bottom-color: var(--primary-400);
}