/* Restore default WP margin inside .wrap for Theme Builder & Header Footer list pages */
.post-type-primekit_library .wrap {
  margin-top: 20px !important;
  margin-right: 20px !important;
}

/**************************\
  Basic Modal Styles
\**************************/

.modal {
  font-family: -apple-system, BlinkMacSystemFont, avenir next, avenir,
    helvetica neue, helvetica, ubuntu, roboto, noto, segoe ui, arial, sans-serif;
}

.modal__overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal__container {
  background-color: #fff;
  max-height: 100vh;
  border-radius: 4px;
  overflow-y: auto;
  box-sizing: border-box;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0d7a31;
  padding: 21px;
  color: #fff;
}

.modal__close {
  background: transparent;
  border: 0;
  cursor: pointer;
}

.modal__header .modal__close:before {
  content: "\2715";
}

.modal__content {
  margin-top: 2rem;
  margin-bottom: 2rem;
  line-height: 1.5;
  color: rgba(0, 0, 0, 0.8);
}

.modal__btn {
  font-size: 0.875rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  background-color: #e6e6e6;
  color: rgba(0, 0, 0, 0.8);
  border-radius: 0.25rem;
  border-style: none;
  border-width: 0;
  cursor: pointer;
  -webkit-appearance: button;
  text-transform: none;
  overflow: visible;
  line-height: 1.15;
  margin: 0;
  will-change: transform;
  -moz-osx-font-smoothing: grayscale;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  transition: -webkit-transform 0.25s ease-out;
  transition: transform 0.25s ease-out;
  transition: transform 0.25s ease-out, -webkit-transform 0.25s ease-out;
}

.modal__btn:focus,
.modal__btn:hover {
  -webkit-transform: scale(1.05);
  transform: scale(1.05);
}

.modal__btn-primary {
  background-color: #00449e;
  color: #fff;
}

/**************************\
  Demo Animation Style
\**************************/
@keyframes mmfadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes mmfadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes mmslideIn {
  from {
    transform: translateY(15%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes mmslideOut {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-10%);
  }
}

.micromodal-slide {
  display: none;
}

.micromodal-slide.is-open {
  display: block;
}

.micromodal-slide[aria-hidden="false"] .modal__overlay {
  animation: mmfadeIn 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide[aria-hidden="false"] .modal__container {
  animation: mmslideIn 0.3s cubic-bezier(0, 0, 0.2, 1);
  max-width: 1500px;
}

.micromodal-slide[aria-hidden="true"] .modal__overlay {
  animation: mmfadeOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide[aria-hidden="true"] .modal__container {
  animation: mmslideOut 0.3s cubic-bezier(0, 0, 0.2, 1);
}

.micromodal-slide .modal__container,
.micromodal-slide .modal__overlay {
  will-change: transform;
}
/* ================================
   Theme Builder Modal
   ================================ */

/* Container */
.primekit-theme-builder-modal-area .modal__container {
  max-width: 820px !important;
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22) !important;
}

/* Header — purple gradient matching HF modal */
.primekit-modal-header {
  background: linear-gradient(135deg, #5b21b6 0%, #1d4ed8 100%);
  padding: 20px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: none;
}

.primekit-modal-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.primekit-modal-heading img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.primekit-theme-builder-modal-area .modal__close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.primekit-theme-builder-modal-area .modal__close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Body wrapper — no extra padding */
.primekit-theme-builder-modal-content {
  padding: 0;
  margin: 0;
}

/* Two-column layout */
.primekit-tb-modal-content-area {
  display: flex;
  min-height: 380px;
  gap: 0;
  align-items: stretch;
}

/* Left decorative panel */
.primekit-tb-modal-content-left {
  width: 42%;
  background: linear-gradient(160deg, #4c1d95 0%, #312e81 55%, #1e3a8a 100%);
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Decorative circles */
.primekit-tb-modal-content-left::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.primekit-tb-modal-content-left::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: -30px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.primekit-tb-modal-content-left h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  margin: 0 0 14px;
  line-height: 1.35;
  position: relative;
}

.primekit-tb-modal-content-left p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
  padding: 0;
  line-height: 1.65;
  width: 100%;
  position: relative;
}

/* Right form panel */
.primekit-tb-modal-content-right {
  flex: 1;
  padding: 44px 40px;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: none;
  border-radius: 0;
}

.primekit-tb-modal-content-form-heading h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.primekit-tb-modal-content-form-heading p,
.primekit-tb-modal-content-form-note {
  margin: 0 0 24px;
  font-size: 13px;
  color: #6b7280;
}

.primekit-tb-modal-content-form-fields form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.primekit-tb-modal-single-field {
  display: flex;
  flex-direction: column;
}

.primekit-tb-modal-single-field label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.primekit-tb-modal-single-field select,
.primekit-tb-modal-single-field input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  font-size: 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
  box-sizing: border-box;
  background: #fafafa;
  color: #111827;
  min-height: unset;
  max-width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.primekit-tb-modal-single-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.primekit-tb-modal-single-field select:focus,
.primekit-tb-modal-single-field input[type="text"]:focus {
  border-color: #6d28d9;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.1);
}

.primekit-tb-modal-single-field input[type="text"]::placeholder {
  color: #9ca3af;
}

.primekit-tb-modal-content-form-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  background: linear-gradient(135deg, #5b21b6 0%, #1d4ed8 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(91, 33, 182, 0.35);
}

.primekit-tb-modal-content-form-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.4);
}

.primekit-tb-modal-content-form-submit:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ================================
   Header & Footer Modal
   ================================ */

.primekit-hf-modal-container {
  background: #fff;
  width: 100%;
  max-width: 680px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

/* ── Header ── */
.primekit-hf-modal-header {
  background: linear-gradient(135deg, #5b21b6 0%, #1d4ed8 100%);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.primekit-hf-modal-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.primekit-hf-modal-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  flex-shrink: 0;
}

.primekit-hf-modal-header-icon img {
  width: 26px;
  height: 26px;
}

.primekit-hf-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.primekit-hf-modal-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.primekit-hf-modal-close:hover {
  background: rgba(255, 255, 255, 0.32);
}

/* ── Body ── */
.primekit-hf-modal-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: calc(100vh - 180px);
  overflow-y: auto;
}

/* Title input */
.primekit-hf-modal-name-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: #111827;
  background: #fafafa;
}

.primekit-hf-modal-name-input::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.primekit-hf-modal-name-input:focus {
  border-color: #6d28d9;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(109, 40, 217, 0.1);
}

/* ── Options box ── */
.primekit-hf-modal-options-box {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.primekit-hf-modal-options-header {
  background: linear-gradient(to right, #f8f7ff, #f0f4ff);
  padding: 11px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.primekit-hf-modal-options-header span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #6d28d9;
}

/* Field rows inside options box */
.primekit-hf-modal-field-row {
  display: flex;
  align-items: flex-start;
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  gap: 16px;
}

.primekit-hf-modal-field-row:last-child {
  border-bottom: none;
}

.primekit-hf-modal-field-label {
  flex: 0 0 160px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  padding-top: 10px;
  line-height: 1.4;
}

.primekit-hf-modal-field-input {
  flex: 1;
  min-width: 0;
}

/* Select elements */
.primekit-hf-modal-select {
  width: 100%;
  padding: 9px 36px 9px 14px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b7280' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 12px center;
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 40px;
  box-sizing: border-box;
}

.primekit-hf-modal-select:focus {
  border-color: #6d28d9;
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.12);
}

/* ── Footer ── */
.primekit-hf-modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primekit-hf-modal-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: linear-gradient(135deg, #5b21b6 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(91, 33, 182, 0.35);
}

.primekit-hf-modal-submit:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.4);
}

.primekit-hf-modal-submit:disabled {
  background: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
  box-shadow: none;
}

.primekit-hf-modal-cancel {
  padding: 11px 20px;
  background: transparent;
  color: #6b7280;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.primekit-hf-modal-cancel:hover {
  background: #f3f4f6;
  color: #374151;
  border-color: #9ca3af;
}

.primekit-hf-modal-save-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  background: #fff;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  border: 1.5px solid #d1d5db;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.primekit-hf-modal-save-btn:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #6d28d9;
  color: #6d28d9;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.12);
}

.primekit-hf-modal-save-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Multi-row field (Display On, Exclusion Rules, User Roles) */
.primekit-hf-multirow {
  align-items: flex-start !important;
}

.primekit-hf-multirow .primekit-hf-modal-field-label {
  padding-top: 10px;
}

/* Rule rows container */
.primekit-hf-rule-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Single rule row: [× delete] [select] */
.primekit-hf-rule-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primekit-hf-rule-row .primekit-hf-modal-select {
  flex: 1;
}

/* Delete (×) button on each row */
.primekit-hf-rule-delete {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.primekit-hf-rule-delete:hover {
  background: #dc2626;
  color: #fff;
}

/* Hidden state (used when only one row exists) */
.primekit-hf-hidden {
  visibility: hidden;
  pointer-events: none;
}

/* Rule action buttons row (Add Rule / Add Exclusion Rule) */
.primekit-hf-rule-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* "Add Rule" / "Add Exclusion Rule" links */
.primekit-hf-add-rule-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #6d28d9;
  color: #6d28d9;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.primekit-hf-add-rule-btn:hover {
  background: #6d28d9;
  color: #fff;
  text-decoration: none;
}

.primekit-hf-exclude-btn {
  border-color: #dc2626;
  color: #dc2626;
}

.primekit-hf-exclude-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* Canvas checkbox row */
.primekit-hf-canvas-label {
  font-size: 12px !important;
  color: #6b7280;
  line-height: 1.4;
}

.primekit-hf-canvas-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #6d28d9;
}

/* Metabox: reuse same row classes, adjust select width */
.primekit-mb-select {
  min-width: 220px;
}

.primekit-mb-rule-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.primekit-mb-rule-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

/* Condition / role tags in the metabox */
.primekit-hf-rule-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.primekit-hf-tag-display {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #c4b5fd;
}

.primekit-hf-tag-exclusion {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}

.primekit-hf-tag-user {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

.primekit-hf-rule-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.6;
  color: inherit;
}

.primekit-hf-rule-tag-remove:hover {
  opacity: 1;
}
