/**
 * Description Editor and Manager Styles
 * Styled to match the webclient's sleek black input area
 */

/* ===== Description Editor ===== */

.desc-editor {
  border: 1px solid #D4C9B8;
  border-radius: 0.125rem;
  background: #F5F0E8;
  box-shadow: 0 2px 8px rgba(39, 34, 31, 0.08);
}

.desc-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-bottom: 1px solid #D4C9B8;
  background: rgba(232, 224, 212, 0.95);
  border-radius: 0.125rem 0.125rem 0 0;
}

.desc-editor-btn {
  padding: 6px 10px;
  border: 1px solid #D4C9B8;
  background: #F5F0E8;
  color: #27221F;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 14px;
}

.desc-editor-btn:hover {
  background: #E8E0D4;
  border-color: #C23B22;
  color: #C23B22;
}

.desc-editor-btn:active {
  background: #D4C9B8;
}

.desc-editor-separator {
  width: 1px;
  height: 20px;
  background: #D4C9B8;
  margin: 0 6px;
}

.desc-editor-color-picker {
  position: relative;
}

.desc-editor-color-btn .color-indicator {
  display: inline-block;
  width: 12px;
  height: 3px;
  margin-left: 2px;
  border-radius: 1px;
}

.desc-editor-color-popup {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;
  padding: 12px;
  background: #F5F0E8;
  border: 1px solid #D4C9B8;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(39, 34, 31, 0.15);
  margin-top: 4px;
  min-width: 180px;
}

.desc-editor-color-popup.show {
  display: block;
}

.color-section {
  margin-bottom: 10px;
}

.color-section:last-child {
  margin-bottom: 0;
}

.color-section-title {
  font-size: 10px;
  text-transform: uppercase;
  color: #5C5450;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-row input[type="color"] {
  flex: 1;
  height: 32px;
  padding: 0;
  border: 1px solid #D4C9B8;
  border-radius: 4px;
  cursor: pointer;
  background: #F5F0E8;
}

.color-apply-btn {
  padding: 6px 12px;
  border: 1px solid #D4C9B8;
  border-radius: 4px;
  background: #F5F0E8;
  color: #27221F;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.color-apply-btn:hover {
  background: #E8E0D4;
  border-color: #C23B22;
  color: #C23B22;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border: 2px solid #D4C9B8;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
  border-color: #C23B22;
  box-shadow: 0 0 8px rgba(194, 59, 34, 0.3);
}

.color-recent-section {
  padding-top: 8px;
  border-top: 1px solid #D4C9B8;
}

.color-recent-grid .color-swatch {
  width: 28px;
  height: 28px;
}

.desc-editor-content {
  min-height: 120px;
  max-height: 300px;
  overflow-y: auto;
  padding: 12px 14px;
  color: #27221F;
  line-height: 1.5;
  font-size: 14px;
  font-family: inherit;
  background: #FDFBF7;
  border-radius: 0 0 0.125rem 0.125rem;
  word-wrap: break-word;
}

.desc-editor-content:focus {
  outline: none;
  background: #FFFFFF;
}

.desc-editor-content:empty::before {
  content: attr(data-placeholder);
  color: #999;
  pointer-events: none;
}

.desc-editor-content strong, .desc-editor-content b {
  font-weight: bold;
  color: #27221F;
}

.desc-editor-content em, .desc-editor-content i {
  font-style: italic;
  color: #27221F;
}

.desc-editor-content u {
  text-decoration: underline;
  color: #27221F;
}

.desc-editor-content s, .desc-editor-content strike {
  text-decoration: line-through;
  color: #27221F;
}

.desc-editor-footer {
  padding: 6px 10px;
  text-align: right;
  background: rgba(232, 224, 212, 0.95);
  border-top: 1px solid #D4C9B8;
  border-radius: 0 0 0.125rem 0.125rem;
}

.char-count {
  font-size: 12px;
  color: #5C5450;
}

.char-count.over-limit {
  color: #ff6b6b;
  font-weight: bold;
}

/* ===== Description Manager ===== */

.desc-manager {
  background: rgba(39, 34, 31, 0.03);
  border-radius: 0.5rem;
  padding: 1rem;
}

.desc-manager-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.desc-manager-header h5 {
  margin: 0;
}

/* Region filter tabs - DaisyUI tabs */
.desc-region-tabs {
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.desc-region-tabs .tab {
  gap: 0.25rem;
}

.desc-region-tabs .badge {
  font-size: 0.7rem;
}

.desc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 100px;
}

.desc-empty-state {
  text-align: center;
  padding: 2rem;
  color: #888;
}

/* Description Cards */

.desc-card {
  background: rgba(39, 34, 31, 0.03);
  border: 1px solid rgba(39, 34, 31, 0.1);
  border-radius: 0.375rem;
  transition: all 0.15s ease;
}

.desc-card:hover {
  border-color: rgba(39, 34, 31, 0.2);
}

.desc-card.dragging {
  opacity: 0.5;
  border-color: oklch(var(--p));
}

.desc-card-inactive {
  opacity: 0.6;
}

.desc-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid rgba(39, 34, 31, 0.05);
  background: rgba(39, 34, 31, 0.03);
  border-radius: 0.375rem 0.375rem 0 0;
}

.desc-card-drag-handle {
  cursor: grab;
  color: #999;
}

.desc-card-drag-handle:hover {
  color: #5C5450;
}

.desc-card-position {
  font-weight: 500;
  color: #27221F;
}

.desc-card-region {
  font-size: 0.7rem;
}

/* Clickable suffix badge */
.desc-card-suffix.clickable-suffix {
  cursor: pointer;
  transition: all 0.15s ease;
}

.desc-card-suffix.clickable-suffix:hover {
  background-color: oklch(var(--p)) !important;
  transform: scale(1.05);
}

/* Clickable prefix badge */
.desc-card-prefix.clickable-prefix {
  cursor: pointer;
  transition: all 0.15s ease;
}

.desc-card-prefix.clickable-prefix:hover {
  background-color: oklch(var(--p)) !important;
  transform: scale(1.05);
}

/* ===== Inline Suffix Picker ===== */

.suffix-picker {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #F5F0E8;
  border: 1px solid rgba(39, 34, 31, 0.15);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(39, 34, 31, 0.1);
  z-index: 1000;
}

.suffix-option {
  padding: 4px 10px;
  border: 1px solid rgba(39, 34, 31, 0.1);
  background: rgba(39, 34, 31, 0.03);
  color: #27221F;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: monospace;
  transition: all 0.15s ease;
  min-width: 32px;
  text-align: center;
}

.suffix-option:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: oklch(var(--p));
  color: #27221F;
}

.suffix-option.active {
  background: oklch(var(--p));
  border-color: oklch(var(--p));
  color: #27221F;
}

/* ===== Inline Prefix Picker ===== */

.prefix-picker {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #F5F0E8;
  border: 1px solid rgba(39, 34, 31, 0.15);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(39, 34, 31, 0.1);
  z-index: 1000;
}

.prefix-option {
  padding: 4px 10px;
  border: 1px solid rgba(39, 34, 31, 0.1);
  background: rgba(39, 34, 31, 0.03);
  color: #27221F;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.15s ease;
  min-width: 50px;
  text-align: center;
  white-space: nowrap;
}

.prefix-option:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: oklch(var(--a));
  color: #27221F;
}

.prefix-option.active {
  background: oklch(var(--a));
  border-color: oklch(var(--a));
  color: #27221F;
}

/* Legacy separator classes for backwards compatibility */
.separator-picker {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  background: #F5F0E8;
  border: 1px solid rgba(39, 34, 31, 0.15);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(39, 34, 31, 0.1);
  z-index: 1000;
}

.separator-option {
  padding: 4px 10px;
  border: 1px solid rgba(39, 34, 31, 0.1);
  background: rgba(39, 34, 31, 0.03);
  color: #27221F;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: monospace;
  transition: all 0.15s ease;
  min-width: 32px;
  text-align: center;
}

.separator-option:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: oklch(var(--p));
  color: #27221F;
}

.separator-option.active {
  background: oklch(var(--p));
  border-color: oklch(var(--p));
  color: #27221F;
}

.desc-card-content {
  padding: 0.75rem;
  display: flex;
  gap: 0.75rem;
}

.desc-card-image {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 0.25rem;
}

.desc-card-image.desc-thumbnail-clickable {
  cursor: pointer;
  transition: all 0.15s ease;
}

.desc-card-image.desc-thumbnail-clickable:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(194, 59, 34, 0.3);
}

.desc-card-text {
  flex: 1;
  font-size: 1rem;
  line-height: 1.4;
  color: #5C5450;
}

.desc-card-actions {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-top: 1px solid rgba(39, 34, 31, 0.05);
  justify-content: flex-end;
}

.desc-card-actions .btn {
  padding: 0.25rem 0.5rem;
}

/* Inactive Section */

.desc-inactive-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(39, 34, 31, 0.1);
}

.desc-inactive-section h6 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.desc-inactive-list {
  margin-top: 0.5rem;
}

/* Preview Section */

.desc-preview-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(39, 34, 31, 0.1);
}

.desc-preview-content {
  background: rgba(39, 34, 31, 0.03);
  padding: 1rem;
  border-radius: 0.125rem;
  line-height: 1.6;
  color: #27221F;
}

.preview-region {
  margin-bottom: 0.5rem;
}

.preview-image {
  display: inline-block;
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 0.25rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.preview-image.preview-thumbnail-clickable,
.preview-image[data-full-url] {
  cursor: pointer;
  transition: all 0.15s ease;
}

.preview-image.preview-thumbnail-clickable:hover,
.preview-image[data-full-url]:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(194, 59, 34, 0.3);
}

/* Thumbnails container - horizontal flex layout */
.preview-thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 1rem;
  clear: both;  /* Ensure below floated profile pic */
}

.preview-thumbnails .preview-image {
  width: 60px;
  height: 60px;
  margin-right: 0;  /* Use gap instead */
}

/* Modal Styles (DaisyUI dialog) */

#descriptionModal .modal-box {
  max-height: calc(100vh - 5em);
}

#descriptionModal .modal-body {
  max-height: calc(100vh - 250px);
  overflow-y: auto;
}

.desc-image-preview {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.desc-image-preview img {
  max-width: 200px;
  max-height: 150px;
  border-radius: 0.375rem;
  object-fit: cover;
}

/* ===== Character Creator Integration ===== */

.appearance-preview {
  background: rgba(39, 34, 31, 0.03);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.appearance-preview h6 {
  margin-bottom: 0.75rem;
  color: #5C5450;
}

.appearance-preview-content {
  min-height: 100px;
  color: #27221F;
  line-height: 1.6;
}

/* Float profile picture left in preview */
.appearance-preview-content .portrait-container {
  float: left;
  margin-right: 1rem;
  margin-bottom: 0.5rem;
}

.appearance-preview-content .preview-profile-pic {
  max-width: 180px;
  max-height: 270px;  /* 2:3 ratio = 180 * 1.5 = 270 */
  object-fit: contain;  /* Don't crop taller/narrower images */
}

/* Clearfix for floated content */
.appearance-preview-content::after {
  content: '';
  display: table;
  clear: both;
}

/* ===== Responsive Adjustments ===== */

@media (max-width: 768px) {
  .desc-manager-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }

  .desc-region-tabs {
    flex-wrap: wrap;
  }

  .desc-region-tabs .tab {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
  }

  .desc-card-content {
    flex-direction: column;
  }

  .desc-card-image {
    width: 100%;
    height: auto;
    max-height: 150px;
  }
}

/* Image lightbox styles moved to /css/lightbox.css */
