/* General layout */
body {
  font-family: "Segoe UI", sans-serif;
  background-color: #1e1e1e;
  color: #eee;
  max-width: 800px;
  margin: 2em auto;
  padding: 1em;
  line-height: 1.6;
}

/* Headings */
h1 {
  text-align: center;
  color: #f8f8f8;
  margin-bottom: 1em;
}

/* Form labels and inputs */
label {
  display: block;
  margin-top: 1em;
  font-weight: bold;
  color: #ccc;
}

input, select {
  width: 100%;
  padding: 0.5em;
  margin-top: 0.25em;
  background-color: #2c2c2c;
  border: 1px solid #444;
  color: #eee;
  border-radius: 6px;
  box-sizing: border-box;
}

.tag-autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.tag-suggestion-box {
  position: absolute;
  top: calc(100% + 0.35em);
  left: 0;
  right: 0;
  background: rgba(26, 34, 48, 0.96);
  border: 1px solid #333;
  border-radius: 6px;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
  z-index: 20;
  backdrop-filter: blur(6px);
}

.tag-suggestion-box.hidden {
  display: none;
}

.tag-suggestion-item {
  display: flex;
  align-items: center;
  padding: 0.45em 0.6em;
  cursor: pointer;
  font-size: 0.95em;
}

.tag-suggestion-item:hover,
.tag-suggestion-item.active {
  background-color: #2f4770;
}

.tag-suggestion-item .tag-name {
  flex: 1 1 auto;
  color: #f1f1f1;
  min-width: 0;
  margin-right: 1.25em;
}

.tag-suggestion-item .match {
  color: #fff;
  background: rgba(0, 133, 255, 0.35);
  padding: 0 0.15em;
  border-radius: 3px;
}

.tag-suggestion-item .tag-count {
  margin-left: auto;
  padding-left: 1.25em;
  color: #9aa3b1;
  font-variant-numeric: tabular-nums;
  font-size: 0.85em;
  min-width: 3.5em;
  text-align: right;
}

.sfw-toggle {
  display: block;
  margin-top: 1em;
  font-weight: 600;
  color: #d2e0ff;
  user-select: none;
}

.sfw-toggle .sfw-label {
  display: block;
  margin-bottom: 0.25em;
}

.sfw-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.sfw-guard-warning {
  margin-top: 0.35em;
  padding: 0.55em 0.75em;
  background: rgba(116, 42, 42, 0.35);
  border: 1px solid #8a4444;
  color: #ffc9c9;
  border-radius: 6px;
  font-size: 0.9em;
}

.sfw-guard-warning.hidden {
  display: none;
}

/* Checkbox and inline fields */
.inline-group {
  display: flex;
  align-items: center;
  gap: 1em;
  margin-top: 1em;
}

.inline-group input[type="number"] {
  width: 100px;
}

.slider-value {
  font-weight: 600;
  color: #ffec99;
  cursor: text;
  border-bottom: 1px dashed transparent;
  padding: 0 0.15em;
  border-radius: 4px;
}

.slider-value:hover,
.slider-value:focus {
  border-bottom-color: #ffec99;
  outline: none;
}

.slider-value.slider-value-disabled {
  cursor: not-allowed;
  color: #777;
  border-bottom-color: transparent;
}

.slider-inline-editor {
  width: 80px;
  font: inherit;
  color: #eee;
  background: #1d1d1d;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.random-tag-panel {
  margin-top: 0.75em;
  padding: 0.85em;
  border: 1px solid #333;
  border-radius: 8px;
  background: rgba(30, 30, 30, 0.6);
}

.random-tag-panel label {
  margin-top: 0;
}

.random-tag-controls {
  display: flex;
  gap: 0.75em;
  align-items: center;
  margin-top: 0.5em;
}

.random-tag-controls input {
  max-width: 110px;
}

.random-tag-hint {
  margin: 0.45em 0 0;
  font-size: 0.85em;
  color: #9ea7ba;
}

button.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.55em 1.1em;
  background-color: #444;
  border: 1px solid #666;
  font-size: 0.95em;
}

/* Navigation highlighting */
.nav-link {
  color: #09f;
  text-decoration: none;
  transition: color 0.15s ease;
}

.nav-link:visited {
  color: #09f;
}

.nav-link:hover {
  color: #7ad0ff;
}

.nav-link.active {
  color: #0f0;
}

.nav-link.active:visited,
.nav-link.active:hover {
  color: #0f0;
}

.nav-link.logout {
  color: #ff6b8b;
}

.nav-link.logout:visited,
.nav-link.logout:hover {
  color: #ff6b8b;
}

.progress-panel {
  margin-top: 0.5em;
  padding: 0.65em 0.75em;
  background: linear-gradient(135deg, rgba(0, 136, 255, 0.1), rgba(0, 255, 209, 0.08));
  border: 1px solid #2e3f5c;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.progress-panel.hidden {
  display: none;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #d9e7ff;
  font-size: 0.95em;
  margin-bottom: 0.45em;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 12px;
  background: #1a1f2a;
  border: 1px solid #2f3c55;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #27c6ff, #2ef3c4);
  box-shadow: 0 0 10px rgba(46, 243, 196, 0.5);
  transition: width 0.25s ease, background 0.3s ease;
}

.progress-panel.progress-done .progress-bar {
  background: linear-gradient(90deg, #3ed598, #7dffcb);
}

.progress-panel.progress-error .progress-bar {
  background: linear-gradient(90deg, #ff6b6b, #f95f89);
}

button.secondary-btn:hover {
  background-color: #555;
}

.ghost-random-btn {
  opacity: 0;
  width: 42px;
  height: 40px;
  padding: 0;
  border-color: transparent;
  background: none;
}

.ghost-random-btn:focus {
  outline: none;
}

/* Buttons */
button {
  display: block;
  margin: 2em auto;
  padding: 0.75em 2em;
  background-color: #007acc;
  color: white;
  font-size: 1em;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

button:hover {
  background-color: #005ea3;
}

button:disabled {
  background-color: #4a4a4a;
  color: #b8b8b8;
  cursor: not-allowed;
  border: 1px solid #5a5a5a;
  box-shadow: none;
}

button.secondary-btn:disabled {
  background-color: #3a3a3a;
  border-color: #4d4d4d;
  color: #9a9a9a;
}

/* Status text */
#status {
  text-align: center;
  font-weight: bold;
  margin-top: 1.5em;
}

/* Image preview */
#resultImage {
  display: block;
  margin: 2em auto;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

details {
  margin-top: 1.5em;
  padding: 1em;
  border: 1px solid #444;
  border-radius: 8px;
  background-color: #2a2a2a;
}

details[open] {
  background-color: #333;
}

summary {
  font-weight: bold;
  font-size: 1.1em;
  cursor: pointer;
  margin-bottom: 1em;
}

/* Dim and disable interactions for inactive controls */
select:disabled,
input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.size-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}

.size-row label {
  color: #aaa;
  font-weight: bold;
}

.sizePreset.selected {
  background-color: #222;
  border-color: #888;
  font-weight: bold;
}
/* Inpainting */
#mainColumn {
  max-width: 800px;
  margin: 0 auto;
  padding: 1em;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

/* Center the canvas */
#canvasContainer {
  display: block;
  text-align: center;
  margin: 1em 0;
}

#imageCanvas {
  display: block;
  margin: 2em auto;
  border: 1px solid #444;
  box-shadow: 0 0 10px rgba(0,0,0,0.5);
  max-width: 100%;
  height: auto;
}


#canvasContainer canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  background-color: transparent;
}

/* ChatBot */
#chatbotSidebar {
  position: fixed;
  right: 0;
  top: 0;
  height: 100%;
  width: 450px;
  background-color: #2a2a2a;
  border-left: 1px solid #444;
  transition: transform 0.3s ease;
  transform: translateX(100%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

#chatbotSidebar.chatbot-visible {
  transform: translateX(0);
}

#toggleChatbot {
  position: absolute;
  left: -90px;
  top: 20px;
  transform: rotate(-90deg);
  background-color: #007acc;
  color: white;
  border: none;
  padding: 0.5em 1em;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
}

#chatInterface {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1em;
}

#chatLog {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 1em;
  background: #1e1e1e;
  padding: 0.5em;
  border-radius: 6px;
  border: 1px solid #444;
}

#chatLog div {
  margin-bottom: 0.5em;
}

#chatInput {
  padding: 0.5em;
  border: 1px solid #444;
  background-color: #2c2c2c;
  color: #eee;
  border-radius: 6px;
  margin-bottom: 0.5em;
}

#sendChat {
  padding: 0.5em;
  background-color: #007acc;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
/*  manga */
.page-canvas {
  background: #fff;
  padding: 12px;           /* width of the white gutter */
  box-sizing: border-box;
}

.panel {
  border: 4px solid #000;  /* black frame */
  background: #fff;        /* keeps the gutter white when images don’t fill */
  box-sizing: border-box;
}

.panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
