/* ============================================
   DECK GUIDE  (free-form written guide)
   Version: 1.0
   ============================================ */

.deck-guide-section {
  margin-top: 1.5rem;
}

/* === Header === */
.deck-guide-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.deck-guide-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #daa520;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.deck-guide-header .deck-guide-icon {
  font-size: 18px;
  color: #daa520;
}

.deck-guide-edit-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid #555;
  color: #daa520;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.deck-guide-edit-btn:hover {
  border-color: #daa520;
  background: rgba(218, 165, 32, 0.08);
}

/* State-driven visibility:
   - while editing, hide the read-only view + the header edit button
   - when empty, hide the header button so only the central CTA shows */
.deck-guide-section.is-editing .deck-guide-view,
.deck-guide-section.is-editing .deck-guide-header .deck-guide-edit-btn {
  display: none;
}
.deck-guide-section.is-empty-guide .deck-guide-header .deck-guide-edit-btn {
  display: none;
}

/* === Empty State === */
/* Read-only guide container — matches the Matchups card styling. */
.deck-guide-view {
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  padding: 24px 28px;
}

/* Empty state overrides the container with a dashed placeholder look. */
.deck-guide-view.is-empty,
.deck-guide-empty {
  text-align: center;
  padding: 40px 20px;
  border: 2px dashed #333;
  border-radius: 12px;
  background: transparent;
  color: #777;
}

.deck-guide-empty-title {
  font-size: 16px;
  font-weight: 700;
  color: #aaa;
  margin-bottom: 6px;
}

.deck-guide-empty-sub {
  font-size: 13px;
  color: #777;
}

/* Prominent call-to-action inside the empty state (mirrors Matchups' Add btn). */
.deck-guide-empty-btn {
  margin: 16px auto 0;
  background: transparent;
  border: 2px dashed #555;
  color: #daa520;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.deck-guide-empty-btn:hover {
  border-color: #daa520;
  background: rgba(218, 165, 32, 0.06);
}

/* === Rendered (read-only) prose === */
.deck-guide-content {
  color: #d8d8d8;
  font-size: 15px;
  line-height: 1.7;
}

.deck-guide-content > *:first-child { margin-top: 0; }
.deck-guide-content > *:last-child { margin-bottom: 0; }

.deck-guide-content .deck-guide-h {
  color: #f0f0f0;
  font-weight: 700;
  line-height: 1.3;
  margin: 1.4em 0 0.5em;
}
.deck-guide-content h2.deck-guide-h { font-size: 1.4em; color: #daa520; }
.deck-guide-content h3.deck-guide-h { font-size: 1.2em; }
.deck-guide-content h4.deck-guide-h { font-size: 1.05em; }

.deck-guide-content .deck-guide-p { margin: 0 0 1em; }

.deck-guide-content .deck-guide-list {
  margin: 0 0 1em;
  padding-left: 1.4em;
}
.deck-guide-content .deck-guide-list li { margin: 0.25em 0; }

.deck-guide-content a {
  color: #daa520;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.deck-guide-content a:hover { color: #f2c94c; }

.deck-guide-content code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

.deck-guide-content .deck-guide-quote {
  margin: 1.2em 0;
  padding: 10px 18px;
  border-left: 3px solid #daa520;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 0 8px 8px 0;
  color: #c8c8c8;
}
.deck-guide-content .deck-guide-quote cite {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #888;
  font-style: normal;
}

.deck-guide-content .deck-guide-delimiter {
  border: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, #444, transparent);
  margin: 1.6em 0;
}

/* === Embedded card tiles ===
   (grid wrapping + per-card width are defined in the card-block section below) */
.deck-guide-card-embed {
  margin: 1.2em 0;
}
.deck-guide-card-embed .card-image {
  width: 100%;
  height: auto;
  border-radius: 10px;
  cursor: pointer;
}

/* === Editor wrap === */
.deck-guide-editor-wrap {
  border: 1px solid #333;
  border-radius: 12px;
  background: #1a1a1a;
  padding: 8px 18px 14px;
}

.deck-guide-editor {
  min-height: 140px;
}

.deck-guide-editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid #2a2a2a;
}

.deck-guide-save-btn {
  background: #daa520;
  color: #1a1a1a;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.deck-guide-save-btn:hover { background: #e8b73a; }
.deck-guide-save-btn:disabled { opacity: 0.6; cursor: default; }

.deck-guide-cancel-btn {
  background: transparent;
  color: #999;
  border: 1px solid #3a3a3a;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.deck-guide-cancel-btn:hover { border-color: #666; color: #ddd; }

.deck-guide-editor-status {
  font-size: 13px;
  color: #999;
  margin-left: auto;
}

/* === Editor.js dark theme overrides === */
.deck-guide-editor .codex-editor { color: #e0e0e0; }

/* Use the full available width instead of Editor.js's default narrow,
   centered ~650px column. Keep a left gutter so the +/drag handles show. */
.deck-guide-editor .ce-block__content,
.deck-guide-editor .ce-toolbar__content {
  max-width: none;
  margin-left: 44px;
  margin-right: 12px;
}
/* Trim the large default bottom padding that left a tall empty area. */
.deck-guide-editor .codex-editor__redactor {
  padding-bottom: 50px !important;
}

.deck-guide-editor .cdx-block { padding: 0.35em 0; }
.deck-guide-editor .ce-paragraph[data-placeholder]:empty::before,
.deck-guide-editor .codex-editor--empty .ce-block:first-child .ce-paragraph[data-placeholder]:empty::before {
  color: #6a6a6a;
}
.deck-guide-editor .ce-header { color: #f0f0f0; }
.deck-guide-editor a { color: #daa520; }

/* Toolbar / plus & settings buttons */
.deck-guide-editor .ce-toolbar__plus,
.deck-guide-editor .ce-toolbar__settings-btn {
  color: #ddd;
  background: #262626;
  border: 1px solid #3a3a3a;
}
.deck-guide-editor .ce-toolbar__plus:hover,
.deck-guide-editor .ce-toolbar__settings-btn:hover {
  background: #333;
  color: #daa520;
}

/* Popover (slash menu / block menu). Editor.js 2.30 ships light defaults with
   high specificity, so these need !important to win and stay readable. */
.ce-popover,
.ce-popover__container,
.ce-popover--opened > .ce-popover__container {
  background: #232323 !important;
  border: 1px solid #3a3a3a !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55) !important;
  color: #ececec !important;
}
.ce-popover-item__title,
.ce-popover-item__description { color: #ececec !important; }
.ce-popover-item__icon,
.ce-popover-item__icon svg { color: #ececec !important; }
.ce-popover-item__icon {
  background: #2d2d2d !important;
  border: 1px solid #3a3a3a !important;
  box-shadow: none !important;
}
.ce-popover-item:hover,
.ce-popover-item--focused {
  background: #daa520 !important;
}
.ce-popover-item:hover .ce-popover-item__title,
.ce-popover-item--focused .ce-popover-item__title,
.ce-popover-item:hover .ce-popover-item__icon,
.ce-popover-item--focused .ce-popover-item__icon,
.ce-popover-item:hover .ce-popover-item__icon svg,
.ce-popover-item--focused .ce-popover-item__icon svg {
  color: #1a1a1a !important;
  background: transparent;
}
.ce-popover-item:hover .ce-popover-item__icon,
.ce-popover-item--focused .ce-popover-item__icon { background: #f0d488 !important; }

/* Popover search field */
.ce-popover__search,
.cdx-search-field {
  background: #1a1a1a !important;
  border: 1px solid #3a3a3a !important;
  color: #ececec !important;
}
.cdx-search-field__input { color: #ececec !important; }
.cdx-search-field__icon svg { color: #888 !important; }

/* Inline formatting toolbar + conversion menu */
.ce-inline-toolbar,
.ce-conversion-toolbar {
  background: #232323 !important;
  border: 1px solid #3a3a3a !important;
  color: #ececec !important;
}
.ce-inline-toolbar__dropdown,
.ce-inline-tool,
.ce-conversion-tool__icon,
.ce-conversion-tool { color: #ececec !important; }
.ce-inline-tool:hover,
.ce-conversion-tool:hover { background: #333 !important; }
.ce-inline-tool--active { color: #daa520 !important; }

/* === Card block inside the editor === */
.deck-guide-card-block {
  padding: 6px 0;
}

.deck-guide-card-search {
  border: 1px dashed #444;
  border-radius: 10px;
  padding: 12px;
  background: #161616;
}
.deck-guide-card-search-input {
  width: 100%;
  box-sizing: border-box;
  background: #1f1f1f;
  border: 1px solid #3a3a3a;
  color: #e0e0e0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
}
/* Override Blocksy's global input:focus (blue border + box-shadow). */
.deck-guide-card-search-input:focus,
.deck-guide-section .deck-guide-card-search-input:focus {
  outline: none !important;
  border-color: #daa520 !important;
  box-shadow: 0 0 0 1px rgba(218, 165, 32, 0.4) !important;
}
.deck-guide-card-search-status {
  color: #888;
  font-size: 13px;
  padding: 10px 2px;
}
.deck-guide-card-search-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(78px, 1fr));
  gap: 8px;
  margin-top: 10px;
  max-height: 280px;
  overflow-y: auto;
}
.deck-guide-card-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
}
.deck-guide-card-result:hover {
  border-color: #daa520;
  background: rgba(218, 165, 32, 0.06);
}
.deck-guide-card-result img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  display: block;
}
.deck-guide-card-result-name {
  font-size: 10px;
  color: #bbb;
  text-align: center;
  line-height: 1.2;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.deck-guide-card-back {
  margin-top: 10px;
  background: #daa520;
  color: #1a1a1a;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.deck-guide-card-back:hover { background: #e8b73a; }

/* Selected-cards gallery inside the editor */
.deck-guide-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.deck-guide-card-cell {
  position: relative;
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.deck-guide-card-cell img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}
.deck-guide-card-cell-name {
  font-size: 12px;
  color: #aaa;
  text-align: center;
  line-height: 1.25;
}
.deck-guide-card-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: #c0392b;
  color: #fff;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.deck-guide-card-remove:hover { background: #e04b3a; }

.deck-guide-card-add {
  display: block;
  margin: 12px auto 0;
  background: transparent;
  border: 1px dashed #555;
  color: #daa520;
  padding: 7px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.deck-guide-card-add:hover { border-color: #daa520; background: rgba(218, 165, 32, 0.06); }

/* Read-only embedded cards: wrap several per row */
.deck-guide-card-embed .cards-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.deck-guide-card-embed .card { width: 170px; max-width: 170px; }

@media (max-width: 600px) {
  .deck-guide-card-embed .card { width: 130px; max-width: 130px; }
  .deck-guide-card-cell { width: 120px; }
}
