.tig-admin {
  margin-top: 16px;
}

.tig-builder-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 20px;
  align-items: start;
}

.tig-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tig-controls {
  background: #ececec;
  border: 1px solid #dcdcde;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tig-controls h2 {
  margin-top: 0;
  font-size: 1rem;
}

.tig-controls .tig-controls-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.tig-controls label {
  display: block;
  font-weight: 600;
  margin: 0;
  font-size: 0.9rem;
}

.tig-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tig-date-range-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tig-date-parts {
  display: grid;
  grid-template-columns: 45px 1fr 1fr 1.5fr;
  gap: 0.35rem;
  align-items: center;
}

.tig-date-parts input {
  min-width: 0;
  text-align: center;
}

.tig-controls textarea {
  resize: none !important;
}



.tig-controls select,
.tig-save-modal select,
.tig-tributes-search select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%232271b1' d='M5.2 7.3a1 1 0 0 1 1.4 0L10 10.7l3.4-3.4a1 1 0 1 1 1.4 1.4l-4.1 4.1a1 1 0 0 1-1.4 0L5.2 8.7a1 1 0 0 1 0-1.4Z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 20px 20px !important;
}

.tig-file-input {
  display: none;
}

.tig-dropzone {
  border: 2px dashed #2271b1;
  border-radius: 8px;
  padding: 18px 14px;
  text-align: center;
  background: #f1f7fd;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tig-dropzone:hover {
  border-color: #1d5f94;
  background: #e6f0fa;
}

.tig-dropzone-active {
  border-color: #1b5a8b;
  background: #dceaf8;
}

.tig-dropzone-title {
  margin: 0;
  font-weight: 600;
  color: #1d2327;
  font-size: 0.9rem;
  margin-block-end: 0.5rem;
}

.tig-upload-preview {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tig-upload-thumb {
  width: 30px;
  height: 30px;
  border-radius: 3px;
  object-fit: cover;
  border: 1px solid #ccd0d4;
}

.tig-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.tig-crop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
}

.tig-actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tig-tool-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tig-tool-active {
  box-shadow: inset 0 0 0 2px #2271b1;
}

.tig-btn {
  appearance: none;
  border: 1px solid #375fd1;
  background: #ffffff;
  color: #375fd1;
  border-radius: 8px;
  min-height: 35px;
  padding: 0 14px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tig-btn:hover,
.tig-btn:focus {
  background: #f2f6ff;
  border-color: #2f53bb;
  color: #2f53bb;
  outline: none;
}

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

.tig-btn-primary {
  background: #375fd1;
  border-color: #375fd1;
  color: #ffffff;
}

.tig-btn-primary:hover,
.tig-btn-primary:focus {
  background: #2f53bb;
  border-color: #2f53bb;
  color: #ffffff;
}

.tig-btn-safe {
  background: #1f9d55;
  border-color: #1f9d55;
  color: #ffffff;
}

.tig-btn-safe:hover,
.tig-btn-safe:focus {
  background: #188447;
  border-color: #188447;
  color: #ffffff;
}

.tig-btn-warning {
  background: #ffffff;
  border-color: #d63638;
  color: #d63638;
}

.tig-btn-warning:hover,
.tig-btn-warning:focus {
  background: #fef2f2;
  border-color: #b32d2e;
  color: #b32d2e;
}

.tig-btn-save-download,
.tig-btn-download {
  background: #1f9d55;
  border-color: #1f9d55;
  color: #ffffff;
}

.tig-btn-save-download {
  font-size: 1.1rem;
  min-height: 42px;
  padding: 0 22px;
  line-height: normal;
}

.tig-btn-save-download:hover,
.tig-btn-save-download:focus,
.tig-btn-download:hover,
.tig-btn-download:focus {
  background: #188447;
  border-color: #188447;
  color: #ffffff;
}

.wp-core-ui .button.tig-button-safe {
  background: #1f9d55;
  border-color: #1b8a4a;
  color: #ffffff;
}

.wp-core-ui .button.tig-button-safe:hover,
.wp-core-ui .button.tig-button-safe:focus {
  background: #178a49;
  border-color: #157c42;
  color: #ffffff;
}

.wp-core-ui .button.tig-button-warning {
  background: #ffffff;
  border-color: #d63638;
  color: #d63638;
}

.wp-core-ui .button.tig-button-warning:hover,
.wp-core-ui .button.tig-button-warning:focus {
  background: #fef2f2;
  border-color: #b32d2e;
  color: #b32d2e;
}

.wp-core-ui .button.button-save-and-download {
  background: #1f9d55;
  border-color: #1b8a4a;
  color: #ffffff;
  width: 100%;
  font-size: 1rem;
}

.tig-scale-control {
  margin-top: 10px;
}

.tig-scale-control label {
  margin-top: 0;
}

.tig-preview {
  padding: 0;
  overflow: auto;
}

.tig-preview canvas {
  max-width: 100%;
  height: auto;
  display: block;
}

.tig-editor-stage {
  position: relative;
  overflow: hidden;
}

.tig-preview-actions {
  margin: 12px 0 0;
  display: flex;
  justify-content: flex-end;
}

.tig-editor-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tig-editor-overlay .tig-crop-selection,
.tig-editor-overlay .tig-scale-selection {
  pointer-events: auto;
}

.tig-logo-spinner {
  position: absolute;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #ffffff;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
  animation: tig-spin 0.8s linear infinite;
}

@keyframes tig-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.tig-status {
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.tig-status-info {
  background: #eef6ff;
  border: 1px solid #c3ddff;
}

.tig-status-success {
  background: #ecf9ed;
  border: 1px solid #a7d8ac;
}

.tig-status-error {
  background: #fdecec;
  border: 1px solid #e8acac;
}

.tig-thumb {
  width: 120px;
  height: auto;
  border: 1px solid #ccd0d4;
}

.tig-tributes-search {
  margin: 0 0 12px;
}

.tig-tributes-search input[type="search"] {
  width: 100%;
  max-width: 420px;
}

.tig-table-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.tig-tributes .wp-list-table td,
.tig-tributes .wp-list-table th {
  vertical-align: middle;
}

.tig-tributes .wp-list-table tbody tr:hover {
  background-color: #e5edf6;
}

.tig-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.tig-pagination span {
  color: #1d2327;
  font-weight: 600;
}

.tig-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.tig-modal {
  background: #ffffff;
  width: min(980px, 96vw);
  max-height: 92vh;
  border-radius: 8px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tig-modal h3 {
  margin: 0;
}

.tig-save-modal {
  width: min(480px, 96vw);
}

.tig-save-modal label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

.tig-inline-warning {
  margin: 8px 0 0;
  color: #d63638;
  font-size: 13px;
}

.tig-crop-stage {
  position: relative;
  overflow: auto;
  background: #0f0f10;
  border-radius: 6px;
  min-height: 280px;
  max-height: 70vh;
}

.tig-crop-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}

.tig-crop-selection {
  position: absolute;
  border: 2px solid #49a3ff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.25);
  cursor: move;
  box-sizing: border-box;
}

.tig-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  background: #49a3ff;
  border-radius: 2px;
}

.tig-crop-handle-nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.tig-crop-handle-n {
  top: -8px;
  left: calc(50% - 6px);
  cursor: ns-resize;
}

.tig-crop-handle-ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.tig-crop-handle-e {
  top: calc(50% - 6px);
  right: -8px;
  cursor: ew-resize;
}

.tig-crop-handle-se {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.tig-crop-handle-s {
  left: calc(50% - 6px);
  bottom: -8px;
  cursor: ns-resize;
}

.tig-crop-handle-sw {
  left: -8px;
  bottom: -8px;
  cursor: nesw-resize;
}

.tig-crop-handle-w {
  left: -8px;
  top: calc(50% - 6px);
  cursor: ew-resize;
}

/* Frontend template overrides to prevent theme style collisions */
body.tig-frontend-template {
  margin: 0 !important;
  background: #cdd1da !important;
}

body.tig-frontend-template .tig-frontend-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  box-sizing: border-box;
}

body.tig-frontend-template .tig-frontend-page {
  width: min(1440px, 100%);
  margin: 0 auto;
}

.tig-frontend-page .tig-admin {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: #1f2937;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  border: 1px solid #dcdcde;
  border-radius: 8px;
  padding: 18px;
  box-sizing: border-box;
  box-shadow: rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
}

.tig-frontend-page .tig-admin h1,
.tig-frontend-page .tig-admin h2,
.tig-frontend-page .tig-admin h3,
.tig-frontend-page .tig-admin label {
  font-family: "Inter", "Segoe UI", Arial, sans-serif !important;
  line-height: 1.25;
}

.tig-frontend-page .tig-admin h2 {
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.tig-frontend-page .tig-controls .tig-controls-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.25;
}

.tig-frontend-page .tig-controls input[type="text"],
.tig-frontend-page .tig-controls input[type="number"],
.tig-frontend-page .tig-controls textarea,
.tig-frontend-page .tig-controls select,
.tig-frontend-page .tig-save-modal input[type="text"],
.tig-frontend-page .tig-tributes-search input[type="search"] {
  border: 1px solid #b1b1b1 !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  color: #111827 !important;
  padding: 10px 12px !important;
  font-size: 0.85rem !important;

  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.tig-frontend-page .tig-controls select {
  background-color: #ffffff !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath fill='%232271b1' d='M5.2 7.3a1 1 0 0 1 1.4 0L10 10.7l3.4-3.4a1 1 0 1 1 1.4 1.4l-4.1 4.1a1 1 0 0 1-1.4 0L5.2 8.7a1 1 0 0 1 0-1.4Z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 20px 20px !important;
  padding-right: 38px !important;
}

.tig-frontend-page .tig-controls input[type="text"]:focus,
.tig-frontend-page .tig-controls input[type="number"]:focus,
.tig-frontend-page .tig-controls textarea:focus,
.tig-frontend-page .tig-controls select:focus,
.tig-frontend-page .tig-save-modal input[type="text"]:focus,
.tig-frontend-page .tig-tributes-search input[type="search"]:focus {
  border-color: #375fd1 !important;
  /* box-shadow: 0 0 0 3px rgba(55, 95, 209, 0.18) !important; */
  outline: none !important;
}



.tig-frontend-page .tig-controls input[type="text"]:hover,
.tig-frontend-page .tig-controls input[type="number"]:hover,
.tig-frontend-page .tig-controls textarea:hover,
.tig-frontend-page .tig-controls select:hover,
.tig-frontend-page .tig-save-modal input[type="text"]:hover,
.tig-frontend-page .tig-tributes-search input[type="search"]:hover {
  border-color: #375fd1 !important;
  /* box-shadow: 0 0 0 3px rgba(55, 95, 209, 0.18) !important; */
  outline: none !important;
}



body.wp-core-ui .tig-frontend-page .tig-admin .button,
body.wp-core-ui .tig-frontend-page .tig-admin button.button,
body.wp-core-ui .tig-frontend-page .tig-admin a.button,
.tig-frontend-page .tig-admin .button,
.tig-frontend-page .tig-admin button.button,
.tig-frontend-page .tig-admin a.button {
  border-radius: 8px !important;
  min-height: 40px !important;
  padding: 0 14px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  border-color: #375fd1 !important;
  color: #375fd1 !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.tig-frontend-page .tig-admin .button.button-primary {
  background: #375fd1 !important;
  border-color: #375fd1 !important;
  color: #ffffff !important;
}

.tig-frontend-page .tig-admin .button.button-primary:hover,
.tig-frontend-page .tig-admin .button.button-primary:focus {
  background: #2f53bb !important;
  border-color: #2f53bb !important;
  color: #ffffff !important;
}

.tig-frontend-page .tig-admin .button.button-save-and-download,
.tig-frontend-page .tig-admin .button.tig-button-download {
  background: #1f9d55 !important;
  border-color: #1f9d55 !important;
  color: #ffffff !important;
}

.tig-frontend-page .tig-admin .button.button-save-and-download:hover,
.tig-frontend-page .tig-admin .button.button-save-and-download:focus,
.tig-frontend-page .tig-admin .button.tig-button-download:hover,
.tig-frontend-page .tig-admin .button.tig-button-download:focus {
  background: #188447 !important;
  border-color: #188447 !important;
  color: #ffffff !important;
}

.tig-frontend-page .tig-admin .button.tig-button-warning,
.tig-frontend-page .tig-admin button.button.tig-button-warning,
.tig-frontend-page .tig-admin a.button.tig-button-warning {
  background: #ffffff !important;
  border-color: #d63638 !important;
  color: #d63638 !important;
}

.tig-frontend-page .tig-admin .button.tig-button-warning:hover,
.tig-frontend-page .tig-admin .button.tig-button-warning:focus,
.tig-frontend-page .tig-admin button.button.tig-button-warning:hover,
.tig-frontend-page .tig-admin button.button.tig-button-warning:focus,
.tig-frontend-page .tig-admin a.button.tig-button-warning:hover,
.tig-frontend-page .tig-admin a.button.tig-button-warning:focus {
  background: #fef2f2 !important;
  border-color: #b32d2e !important;
  color: #b32d2e !important;
}

.tig-scale-selection {
  position: absolute;
  border: 2px dashed #24a148;
  box-sizing: border-box;
}

.tig-scale-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  background: #24a148;
  border-radius: 2px;
}

.tig-scale-handle-nw {
  top: -8px;
  left: -8px;
  cursor: nwse-resize;
}

.tig-scale-handle-ne {
  top: -8px;
  right: -8px;
  cursor: nesw-resize;
}

.tig-scale-handle-se {
  right: -8px;
  bottom: -8px;
  cursor: nwse-resize;
}

.tig-scale-handle-sw {
  left: -8px;
  bottom: -8px;
  cursor: nesw-resize;
}

.tig-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1100px) {
  .tig-builder-grid {
    grid-template-columns: 1fr;
  }
}

.tig-reset-box {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

.tig-reset-box .description {
  margin: 0 0 8px;
}

.tig-crop-help {
  margin: 0;
  font-size: 12px;
}
