/* Composer side panels: properties editor, MyStyle template panel/modal, attachment and bookmark cards, version controls. Loads after shared-editor.css. */

.rt-properties-editor {
  display: grid;
  gap: 4px;
  margin: -2px 32px 10px;
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.reader-edit-form .rt-properties-editor {
  margin: -4px 0 4px;
}

.rt-properties-title {
  display: block;
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 760;
  line-height: 1.35;
}

.rt-property-list {
  display: grid;
  gap: 2px;
}

.rt-property-row {
  display: grid;
  grid-template-columns: 18px minmax(100px, 0.32fr) minmax(180px, 1fr) 76px 28px;
  gap: 8px;
  align-items: center;
  min-height: 32px;
}

.rt-property-handle {
  width: 14px;
  height: 14px;
  opacity: 0.62;
  background:
    linear-gradient(var(--muted) 0 0) 0 2px / 14px 1.5px no-repeat,
    linear-gradient(var(--muted) 0 0) 0 6.5px / 14px 1.5px no-repeat,
    linear-gradient(var(--muted) 0 0) 0 11px / 14px 1.5px no-repeat;
}

.rt-property-row select,
.rt-property-row input {
  min-width: 0;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  padding: 0 8px;
  font: inherit;
  font-size: 13px;
}

.rt-property-row select {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.rt-property-key-input {
  color: var(--muted) !important;
  font-weight: 760;
}

.rt-property-row:hover input,
.rt-property-row:hover select,
.rt-property-row select:focus,
.rt-property-row input:focus {
  border-color: var(--line);
  background: #ffffff;
  outline: none;
}

.rt-property-remove {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.rt-property-remove:hover,
.rt-property-remove:focus-visible {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  outline: none;
}

.rt-property-add-row {
  width: fit-content;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px 0 0;
  font-size: 13px;
  font-weight: 760;
}

.rt-property-add-row:hover,
.rt-property-add-row:focus-visible {
  background: var(--soft);
  color: var(--ink);
  outline: none;
}

@media (max-width: 680px) {
  .rt-properties-editor {
    margin-right: 18px;
    margin-left: 18px;
  }

  .rt-property-row {
    grid-template-columns: 16px minmax(0, 1fr) 28px;
  }

  .rt-property-key-input,
  .rt-property-row [data-property-value] {
    grid-column: 2 / 3;
  }

  .rt-property-row select {
    grid-column: 2 / 3;
  }

  .rt-property-remove {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
  }
}

.my-style-panel {
  margin: 0 0 10px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  width: fit-content;
}

.my-style-panel[hidden] {
  display: none;
}

.my-style-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.my-style-panel-title {
  margin: 0 0 8px;
  color: #536471;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
}

.my-style-slots {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.my-style-empty-slot,
.my-style-placeholder-slot,
.my-style-template-slot {
  width: 96px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px dashed #ccd6dd;
  border-radius: 8px;
  background: #f8fafb;
}

.my-style-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.my-style-empty-slot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8899a6;
  cursor: pointer;
}

.my-style-placeholder-slot {
  display: inline-block;
  pointer-events: none;
}

.my-style-empty-slot:hover,
.my-style-empty-slot:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.my-style-plus {
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}

.my-style-empty-slot::after {
  content: "현재 양식 저장";
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 9px;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 5;
}

.my-style-empty-slot:hover::after,
.my-style-empty-slot:focus-visible::after {
  opacity: 1;
}

.my-style-more-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: #8899a6;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 1px;
}

.my-style-more-button:hover,
.my-style-more-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.my-style-template-slot {
  border-style: solid;
  background: #ffffff;
  color: var(--ink);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-style-template-slot:hover,
.my-style-template-slot:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.my-style-preview-popover {
  position: fixed;
  z-index: 80;
  width: min(320px, calc(100vw - 20px));
  max-height: min(320px, calc(100vh - 20px));
  overflow: auto;
  padding: 12px 14px;
  border: 1px solid #cfd9e2;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(15, 20, 25, 0.18);
  pointer-events: none;
}

.my-style-preview-popover[hidden] {
  display: none;
}

.my-style-preview-title {
  margin-bottom: 8px;
  color: #536471;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.my-style-preview-popover pre {
  margin: 0;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.my-style-preview-meta {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: #6f7d87;
  font-size: 12px;
  font-weight: 700;
}

.my-style-create-button {
  min-height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.my-style-create-button:hover,
.my-style-create-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.attachment-chip {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
}

.attachment-chip strong {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.attachment-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

/* Notion-style link/gif bookmark cards (composer attachment tray) */
.attachment-card {
  display: inline-flex;
  align-items: stretch;
  max-width: 380px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.05);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.attachment-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 6px 18px -10px rgba(15, 20, 25, 0.28);
}

.attachment-card-main {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 9px 12px;
  color: var(--ink);
  text-decoration: none;
}

.attachment-card-favicon {
  position: relative;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--soft);
  overflow: hidden;
}

.attachment-card-favicon::before {
  content: "🌐";
  font-size: 14px;
  opacity: 0.5;
}

.attachment-card-favicon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.attachment-card-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.attachment-card-title {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card-url {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card-remove {
  flex: 0 0 auto;
  border: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 0 11px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.attachment-card-remove:hover,
.attachment-card-remove:focus-visible {
  background: var(--soft);
  color: var(--ink);
  outline: none;
}

.attachment-card-gif .attachment-card-main {
  padding: 0;
}

.attachment-card-thumb {
  display: block;
  max-width: 200px;
  max-height: 128px;
  object-fit: cover;
}

/* Published-view (feed/reader) bookmark cards — reuse composer card classes */
.feed-attachment.feed-attachment-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  min-width: 0;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(15, 20, 25, 0.05);
}

.feed-attachment.feed-attachment-card:hover {
  border-color: var(--line-strong);
}

.feed-attachment.feed-attachment-gif {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.feed-attachment.feed-attachment-gif .attachment-card-thumb {
  border-radius: 8px;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
  padding: 10px 14px;
}

.tool-row {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #6b7682;
  padding: 0;
}

.tool-button .app-icon {
  --icon-size: 19px;
  opacity: 0.6;
}

.tool-mark {
  min-width: 19px;
  color: currentColor;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  opacity: 0.72;
}

.tool-button:hover,
.tool-button:focus-visible {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent);
  outline: none;
}

.tool-button:hover .app-icon,
.tool-button:focus-visible .app-icon {
  opacity: 0.9;
}

.my-style-tool-button {
  width: auto;
  min-width: 54px;
  padding: 0 10px;
}

.my-style-record-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: #fff1f2;
  padding: 0;
}

.my-style-record-button[hidden] {
  display: none;
}

.my-style-record-button span {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #f4212e;
  box-shadow: 0 0 0 4px rgba(244, 33, 46, 0.14);
}

.my-style-list-modal {
  width: min(100%, 420px);
  text-align: left;
}

.my-style-list-modal h2 {
  margin-bottom: 16px;
  font-size: 16px;
}

.my-style-list-count {
  margin-left: 6px;
  color: #8899a6;
  font-size: 13px;
  font-weight: 600;
}

.my-style-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
  margin-bottom: 18px;
}

.my-style-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.my-style-list-apply {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.my-style-list-overwrite {
  flex: 0 0 auto;
  min-width: 74px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.my-style-list-overwrite:hover,
.my-style-list-overwrite:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.my-style-list-delete {
  flex: 0 0 auto;
  width: 36px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  color: #8899a6;
  font-size: 18px;
  line-height: 1;
}

.my-style-list-delete:hover,
.my-style-list-delete:focus-visible {
  border-color: #c4314b;
  color: #c4314b;
  outline: none;
}

.my-style-list-apply:hover,
.my-style-list-apply:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  outline: none;
}

.my-style-list-empty {
  margin: 0;
  padding: 22px 0;
  color: #8899a6;
  font-size: 13px;
  text-align: center;
}

.my-style-save-modal {
  width: min(100%, 360px);
}

.my-style-save-modal h2 {
  margin-bottom: 22px;
  text-align: center;
  font-size: 18px;
}

.save-cluster {
  display: grid;
  justify-items: end;
  gap: 8px;
  flex: 0 0 auto;
}

.applied-template-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 5px 9px;
  font-size: 12px;
  margin-bottom: 10px;
}

.applied-template-row[hidden] {
  display: none;
}

.applied-template-label {
  color: var(--muted);
}

.applied-template-tag {
  font-weight: 800;
  color: var(--ink);
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

.applied-template-clear {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.applied-template-clear:hover {
  color: var(--ink);
}

.save-primary-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.version-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.version-controls[hidden] {
  display: none;
}

.version-title-input {
  width: min(210px, 28vw);
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 13px;
  font-size: 13px;
  line-height: 1.3;
  outline: none;
}

.version-title-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.status-line {
  max-width: 100px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-line.is-error {
  color: var(--danger);
}

.save-button,
.push-button,
.modal-button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  padding: 8px 18px;
  font-weight: 800;
  white-space: nowrap;
}

.save-button:hover,
.push-button:hover,
.modal-button:hover,
.save-button:focus-visible,
.push-button:focus-visible,
.modal-button:focus-visible {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
  outline: none;
}

.save-button:disabled,
.push-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.hidden-input {
  display: none;
}
