/* Mori AI Search General Settings */
.card {
  width: 100%;
  max-width: 950px;
  background-color: #fff;
  padding: 30px 30px 30px 26px;
  border-left: 2px solid #05357f;
}
.card hr {
  margin: 10px 0 12px;
}
.card p {
  margin-top: 0;
  font-size: 14px;
}
.card p.description {
  margin-top: 3px;
  margin-bottom: 10px;
  font-size: 13px;
}
.card h2 {
  margin-top: 0;
  font-weight: 400;
  color: #04357f;
  font-size: 25px;
  line-height: 1.2em;
  margin-bottom: 15px;
}
.card h2 .mori-circle {
  display: inline-block;
  width: 40px;
  height: 40px;
  line-height: 40px;
  font-size: 20px;
  text-align: center;
  background-color: #ee562e;
  border-radius: 100px;
  color: #fff;
  margin-right: 10px;
}
.ai-welcome.card h2,
.ai-prompt-setup.card h2,
.ai-general-settings.card h2,
.ai-search-index-table.card h2 {
  position: relative;
  /* padding-left: 38px; */
}
.ai-search-index-table.card form + h2 {
  padding-left: 0;
}
.card h2 img {
  width: 32px;
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
.card h3,
.card h4 {
  font-weight: 500;
  color: #05357f;
  font-size: 18px;
}
.card h4 {
  font-size: 15px;
}
.card label {
  display: block;
  margin-bottom: 8px;
  color: #000;
  font-size: 14px;
}
.card input[type="text"],
.card input[type="password"],
.card textarea,
.ai-wizard input[type="text"],
.ai-wizard input[type="password"],
.ai-wizard textarea {
  width: 100%;
  margin: 0;
  border: 1px solid #05357f;
  border-radius: 0;
  padding: 3px 12px;
}
.card select {
  border: 1px solid #05357f;
  border-radius: 0;
  padding: 3px 12px;
}
.card textarea {
  min-height: 100px;
  padding: 7px 12px;
}
.card input[type=radio]:checked::before {
  margin: .21rem;
  background-color: #05357f;
}
.card .card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px 20px;
}
.card .card-grid > div {
  width: calc(50% - 10px);
}

#wpbody .card button,
#wpbody .card input[type="submit"],
#wpbody .ai-wizard button,
#wpbody .ai-wizard #submit_finish {
  background-color: #05357f;
  border: 1px solid #05357f;
  border-radius: 0;
  line-height: 1;
  vertical-align: middle;
  padding: 13px 15px;
  margin-right: 7px;
  color: #fff;
  text-transform: uppercase;
}
#wpbody .card button:last-of-type {
  margin-right: 0;
}
#wpbody .card input[name="aiws_search_reindex"] {
  background-color:#C6312D;
  border-color: #C6312D;
}
#wpbody .card #ai-manual-submit.ai-manual-submit.is-clean {
  background-color: #dfe5ef;
  border-color: #c1cbda;
  color: #516173;
  box-shadow: none;
  opacity: 1;
}
#wpbody .card #ai-manual-submit.ai-manual-submit.is-clean[disabled] {
  cursor: not-allowed;
}
#wpbody .card #ai-manual-submit.ai-manual-submit.is-dirty {
  background-color: #05357f;
  border-color: #05357f;
  color: #fff;
  box-shadow: 0 0 0 1px rgb(5 53 127 / 18%);
}
.card p.submit {
  padding-bottom: 0;
  margin-bottom: 0;
}

.card textarea[readonly] {
  background-color: rgb(5 53 127 / 10%);
}

#ai-system-prompt {
  margin-bottom: 10px;
  border: 1px solid #05357f;
}
#wpbody #ai-edit-manual,
#wpbody #ai-go-back {
  background-color: #fff;
  color: #05357f;
}
.ai-prompt-setup.card .card-grid {
  margin-bottom: 12px;
}


/* Custom tags management */
.ai-tag-select{display:none;}
.ai-manual-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 0;
  min-width: 150px;
}
.ai-manual-tags .ai-tag {
  background: #05357f1a;
  border: 1px solid #05357f;
  border-radius: 0;
  padding: 5px 8px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}
.ai-manual-tags .ai-remove-tag {
  margin-left: 4px;
  cursor: pointer;
  text-decoration: none;
  color: #555;
}
.ai-manual-tag-input {
  border: none;
  min-width: 80px;
  flex: 1;
  line-height: 1;
  padding: 2px 4px;
}

.ai-star-toggle .dashicons-star-filled {
  color: #ccc;
  font-size: 18px;
}
.ai-star-toggle input:checked + .dashicons-star-filled {
  color: #ffb900;
}

/* Generic switch toggle */
.ai-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}
.ai-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.ai-switch .ai-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #fff;
  border: 1px solid #05357f;
  border-radius: 18px;
  transition: background-color 0.25s;
}
.ai-switch .ai-slider:before {
  content: "";
  position: absolute;
  height: 10px;
  width: 10px;
  left: 2px;
  top: 50%;
  transform: translateY(-50%);
  background-color: #05357f;
  border: 1px solid #05357f;
  border-radius: 50%;
  transition: transform 0.25s;
}
.ai-switch input:checked + .ai-slider {
  background-color: #ffc8c8;
  border-color: #C6312D;
}
.ai-switch input:checked + .ai-slider:before {
  transform: translate(16px, -50%);
  background-color: #fff;
  border: 1px solid #b63e35;
}

/* Star toggle */
.ai-star-toggle input[type="checkbox"]{
  display:none;
}

/* Welcome Card */
.ai-welcome.card label {
  font-weight: 700;
}
#submit_api_key {
  margin-bottom: 10px;
}

/* Wizard overlay styles */
.ai-wizard-overlay{
  position:fixed;
  top:0;left:0;right:0;bottom:0;
  /* background:rgba(0,0,0,0.6); */
  background: #fff;
  z-index:100000;
  overflow-y: auto;
  display:none;
}
.ai-wizard{
  background:#fff;
  max-width:600px;
  margin:15vh auto;
  padding:30px;
  position:relative;
}
.wizard-progress{
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:8px;
  background-color:#05357f1a;
}
.wizard-progress-bar{
  height:100%;
  width:0;
  background-color:#05357f;
}
.ai-wizard h2 {
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 10px;
}
.ai-wizard p.description {
  margin-bottom: 15px;
}
#wpbody .ai-wizard #ai-wizard-close{
  position:absolute;
  top:10px;
  right:10px;
  border:none;
  background:none;
  font-size:20px;
  cursor:pointer;
  padding: 0;
  border: none;
  background-color: #fff;
  color: #05357f;
  font-size: 22px;
}
.wizard-slide{display:none;}
.wizard-slide.active{display:block;}
.wizard-nav{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin-top:20px;
  margin-bottom: 0;
}
#wpbody .ai-wizard .wizard-nav button.wizard-prev {
  background-color: #fff;
  border: none;
  padding: 0;
  color: #787878;
  line-height: 1;
  min-height: initial;
}

#aiws_search_header_subtitle {
  margin-bottom: 10px;
}

/* API key input */
.ai-key-wrap {
  display: flex;
  gap: 5px;
}
.ai-key-wrap + p {
  margin-bottom: 30px;
}
.ai-key-wrap .ai-toggle-key{
  margin-left:4px;
}

/* Exclude table tabs */
.ai-tab-content{display:none;margin-top:10px;}
.ai-tab-content.active{display:block;}

.ai-filter-controls{
  display:flex;
  gap: 5px;
  margin:10px 0;
}
.ai-filter-controls label{
  margin-right:10px;
}
.ai-index-search {
  flex-grow: 1;
}

.ai-manual-tags .ai-tag.ai-auto {
  background: #e0f7faa1;
  border-color: #26c6da;
}
.ai-manual-tags .ai-tag.ai-auto::before {
  content: '\1F916';
  margin-right: 2px;
}

.aiws-remove-include-index {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4%;
  margin-top: 20px;
  margin-bottom: 20px;
} 
.aiws-index-card {
  border-top: 1px solid #dcdcde;
  border-bottom: 1px solid #dcdcde;
  padding: 20px 0 15px;
  min-width: 350px;
  width: 48%;
  flex-grow: 1;
}

/* Progress bar for reindexing */
.ai-index-empty-state {
  max-width: 420px;
  padding: 20px;
  border: 1px solid #d0dbe8;
  border-radius: 12px;
  background: #f8fbff;
}

.ai-index-empty-state h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.ai-index-empty-state p {
  margin: 0 0 16px;
  color: #50575e;
}

.ai-index-empty-state--hidden {
  display: none;
}

.ai-search-index-controls .ai-index-empty-state {
  margin-bottom: 24px;
}

#ai-reindex-status {
  margin-top: 1em;
}

#ai-reindex-bar {
  width: 100%;
  background: #ecf5f2;
  border: 1px solid #05357f;
  height: 7px;
  border-radius: 3px;
  overflow: hidden;
}

#ai-reindex-bar-inner {
  height: 100%;
  width: 0;
  background: #05357f;
}

/* Progress bars for prune excluded and index missing */
#ai-prune-status,
#ai-index-missing-status {
  margin-top: 1em;
}

#ai-prune-bar, #ai-index-missing-bar {
  width: 100%;
  background: #ecf5f2;
  border: 1px solid #05357f;
  height: 7px;
  border-radius: 3px;
  overflow: hidden;
}

#ai-prune-bar-inner, #ai-index-missing-bar-inner {
  height: 100%;
  width: 0;
  background: #05357f;
}

.prompt-editing {
  display: none;
  margin-top: 10px;
}

/* Settings Card */
.ais-theme-selector-container {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.ais-theme-selector-container label {
  display: inline-block;
  max-width: 280px;
  padding: 12px;
  text-align: center;
  border-radius: 3px;
  border: 1px solid #fff;
}
.ais-theme-selector-container label img {
  width: 100%;
}
.ais-theme-selector-container label span {
  display: block;
  font-weight: bold;
  margin: 5px 0;
}
.ais-theme-selector.active {
  border: 1px solid #05357f;
}

#ai-priority-settings,
#wiz_ai-priority-settings {
  display:flex;
  gap:20px;
  align-items:flex-start;
}
#ai-priority-settings h4,
#wiz_ai-priority-settings h4 {
  margin: 5px 0 15px;
}
#ai-priority-settings ul,
#wiz_ai-priority-settings ul {
  list-style:none;
  margin:0;
  padding:0;
}
#ai-priority-settings li,
#wiz_ai-priority-settings li {
  position: relative;
  border-radius: 0;
  padding: 9px 12px;
  margin: 0 0 10px;
  cursor:move;
  background-color: rgb(5 53 127 / 10%);
  border: 1px solid #05357f;
  color: #05357f;
  font-weight: 600;
}
#ai-included-list,
#wiz_ai-included-list {
  min-width: 170px;
  margin-left: 17px;
  margin-right: 30px;
}
#ai-included-list li::marker,
#wiz_ai-included-list li::marker {
  color: #000;
  font-weight: 700;
}
#ai-included-list li span,
#wiz_ai-included-list li span {
  position: absolute;
  right: -6px;
  transform: translateX(100%);
}
#ai-included-list li:before,
#wiz_ai-included-list li:before {
  content: "⠿";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  font-weight: 100;
  color: #05357f;
}
#ai-excluded-list li,
#wiz_ai-excluded-list li {
  background-color: #ffffff;
  color: #232323;
}
#wpbody #ai-excluded-list li button,
#wpbody #wiz_ai-excluded-list li button {
  position: absolute;
  top: 50%;
  right: -9px;
  transform: translate(100%, -50%);
  padding: 0;
  line-height: 1;
  background-color: #fff;
  border: none;
  color: #05357f;
}
#ai-excluded-list li button:before,
#wiz_ai-excluded-list li button:before {
  content: "+";
  padding-right: 4px;
}

#ai-priority-settings .remove-type{margin-left:6px;cursor:pointer;}
#ai-priority-settings .add-type{margin-left:6px;}

/* Feedback */
.ai-search-feedback {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}
.ai-search-feedback label {
  display: inline-block;
}

/* Mori AI Search Index*/
#ai-cat-filter {
  min-width: 160px;
}
.ai-search-index-table {
  max-width: 100%;
}
.search-index-form > form:first-of-type {
  margin-bottom: 35px;
}
.search-index-form > .ai-index-empty-state:first-of-type {
  margin-bottom: 0;
}
.ai-tab-content {
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border: 1.5px solid #DBDBDB;
}
.ai-tab-content table {
  border: none;
}
.ai-tab-content table thead {
  position: sticky;
  top: 0;
  width: 100%;
  background-color: #fff;
  z-index: 1;
}
.ai-tab-content table thead th {
  font-weight: bold;
}
.ai-tab-content table thead th:nth-of-type(1),
.ai-tab-content table thead th:nth-of-type(2) {
  width: 100px;
}

/* Custom tags management */
#custom-tags-wrap {
  display: flex;
  margin-top: 10px;
  gap: 10px;
}
#add-tag-btn .dashicons {
  font-size: 12px;
  line-height: 11px;
  height: initial;
  width: initial;
  transform: translateY(2.5px);
}
#new-tag-input {
  margin-bottom: 0;
}

#custom-tags-list {
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
#custom-tags-list .ai-tag {
  background: #05357f1a;
  border: 1px solid #05357f;
  border-radius: 0;
  padding: 5px 12px;
  padding-right: 9px;
  color: #05357f;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
}
#custom-tags-list .remove-custom-tag {
  margin-left: 4px;
  cursor: pointer;
  text-decoration: none;
  color: #555;
}

/* Setup Wizard */
.ai-wizard [data-step="0"] h2 {
  max-width: 430px;
  margin: 10px auto 15px;
  font-size: 26px;
  line-height: 1.2em;
  text-align: center;
}
.ai-wizard [data-step="0"] .wizard-nav {
  align-items: center;
}
.ai-wizard [data-step="9"] h2 {
  line-height: 1.2em;
  text-align: center;
}
.ai-wizard [data-step="9"] p.description {
  text-align: center;
}

/* Loader for wizard prompt generation */
.ai-wizard .loader {
  width: 35px;
  margin: 35px auto 20px;
  aspect-ratio: 1;
  --_g1: no-repeat radial-gradient(circle closest-side, #05357f 90%, #0000);
  --_g2: no-repeat radial-gradient(circle closest-side, #05357fbf 90%, #0000);
  --_g3: no-repeat radial-gradient(circle closest-side, #05357f80 90%, #0000);
  background:
    var(--_g1) 0 0,
    var(--_g2) 0 100%,
    var(--_g3) 100% 100%;
  background-size: 40% 40%;
  animation: l11 1s infinite linear;
}

@keyframes l11 {
  25% { background-position: 100% 0, 0 100%, 100% 100%; }
  50% { background-position: 100% 0, 0 0, 100% 100%; }
  75% { background-position: 100% 0, 0 0, 0 100%; }
  100% { background-position: 100% 100%, 0 0, 0 100%; }
}

.card.ai-disabled { opacity: 0.5; pointer-events: none; }

.aiws-reindex-modal-open {
  overflow: hidden;
}

.aiws-reindex-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.aiws-reindex-modal {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
  padding: 24px;
}

.aiws-reindex-modal h2 {
  margin-top: 0;
  font-size: 18px;
  line-height: 1.5;
}

.aiws-reindex-modal input {
  width: 100%;
  margin: 12px 0;
}

.aiws-reindex-modal-error {
  color: #b32d2e;
  margin: 0 0 12px;
}

.aiws-reindex-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ai-refresh-prompt-status {
  display: inline-block;
  margin-left: 15px;
  vertical-align: middle;
}

.ai-refresh-prompt-status.is-error {
  color: #b32d2e;
}

.ai-refresh-prompt-status.is-success {
  color: #008a20;
}

.ai-refresh-prompt-status.is-warning {
  color: #996800;
}
