/* ─── 디버그 메모 (페이지 핀 방식) ───────────────────── */

#debug-memo-toggle {
    position: fixed;
    bottom: 6rem;
    right: 1.5rem;
    z-index: 9998;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1f2937;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    border: none;
    font-size: 20px;
}

#debug-memo-toggle:hover {
    transform: translateY(-2px);
    background: #111827;
}

#debug-memo-toggle.active {
    background: #ef4444;
}

.debug-memo-pin {
    position: absolute;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    z-index: 9997;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -50%);
    transition: transform 0.15s;
}

.debug-memo-pin:hover {
    transform: translate(-50%, -50%) scale(1.2);
}

.debug-memo-bubble {
    position: absolute;
    z-index: 10001;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    padding: 14px;
    min-width: 280px;
    max-width: 360px;
    transform: translate(12px, -12px);
    font-size: 13px;
    color: #1f2937;
}

.debug-memo-bubble .dm-meta {
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
    word-break: break-all;
    line-height: 1.45;
}

.debug-memo-bubble .dm-meta strong {
    color: #374151;
}

.debug-memo-bubble textarea {
    width: 100%;
    min-height: 72px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.debug-memo-bubble textarea:focus {
    border-color: #4f46e5;
}

.debug-memo-bubble .dm-content {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 4px 0 10px;
    line-height: 1.5;
}

.debug-memo-bubble .dm-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.debug-memo-bubble .dm-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s;
}

.debug-memo-bubble .dm-btn-primary {
    background: #4f46e5;
    color: #fff;
}

.debug-memo-bubble .dm-btn-primary:hover {
    background: #4338ca;
}

.debug-memo-bubble .dm-btn-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.debug-memo-bubble .dm-btn-danger:hover {
    background: #fecaca;
}

.debug-memo-bubble .dm-btn-ghost {
    background: #f3f4f6;
    color: #374151;
}

.debug-memo-bubble .dm-btn-ghost:hover {
    background: #e5e7eb;
}

.debug-memo-highlight {
    outline: 2px dashed #ef4444 !important;
    outline-offset: 2px;
    background: rgba(239, 68, 68, 0.06) !important;
    cursor: crosshair !important;
}

/* ─── 드래그 헤더 ────────────────────────────────────── */

.debug-memo-bubble .dm-drag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: -14px -14px 8px;
    padding: 8px 12px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    border-radius: 12px 12px 0 0;
    cursor: move;
    user-select: none;
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    touch-action: none;
}

.debug-memo-bubble .dm-drag > span:first-child,
.debug-memo-bubble .dm-drag > span:first-child * {
    pointer-events: none;
}

.debug-memo-bubble .dm-drag-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    font-size: 16px;
}

.debug-memo-bubble .dm-drag-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.debug-memo-bubble.dragging {
    opacity: 0.85;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

/* ─── 목록 버튼/패널 ─────────────────────────────────── */

#debug-memo-list-btn {
    position: fixed;
    bottom: 10.5rem;
    right: 1.5rem;
    z-index: 9998;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #374151;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
    font-size: 18px;
}

#debug-memo-list-btn.visible {
    display: flex;
}

#debug-memo-list-btn:hover {
    transform: translateY(-2px);
}

#debug-memo-list-btn .dm-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#debug-memo-list-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 360px;
    max-width: 85vw;
    background: #fff;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

#debug-memo-list-panel.open {
    transform: translateX(0);
}

#debug-memo-list-panel .dm-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f9fafb;
}

#debug-memo-list-panel .dm-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
}

#debug-memo-list-panel .dm-panel-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 16px;
}

#debug-memo-list-panel .dm-panel-close:hover {
    background: #e5e7eb;
}

#debug-memo-list-panel .dm-panel-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#debug-memo-list-panel .dm-panel-terminal {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #111827;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}

#debug-memo-list-panel .dm-panel-terminal:hover {
    background: #000;
}

/* ─── 터미널 모달 ────────────────────────────────── */

#debug-memo-term-modal {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: dm-term-in 0.2s ease-out;
}

@keyframes dm-term-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#debug-memo-term-modal .dm-term-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(3px);
}

#debug-memo-term-modal .dm-term-window {
    position: relative;
    width: 92vw;
    height: 86vh;
    max-width: 1400px;
    background: #0b1020;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#debug-memo-term-modal .dm-term-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #1f2937;
    color: #e5e7eb;
    border-bottom: 1px solid #374151;
}

#debug-memo-term-modal .dm-term-title {
    font-size: 13px;
    font-weight: 700;
    color: #f3f4f6;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#debug-memo-term-modal .dm-term-tools {
    display: flex;
    gap: 6px;
}

#debug-memo-term-modal .dm-term-close,
#debug-memo-term-modal .dm-term-newtab {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    line-height: 1;
    font-size: 16px;
}

#debug-memo-term-modal .dm-term-close:hover,
#debug-memo-term-modal .dm-term-newtab:hover {
    background: #374151;
    color: #fff;
}

#debug-memo-term-modal .dm-term-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #0b1020;
}

#debug-memo-list-panel .dm-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

#debug-memo-list-panel .dm-item {
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

#debug-memo-list-panel .dm-item:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

#debug-memo-list-panel .dm-item-header {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

#debug-memo-list-panel .dm-tag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
}

#debug-memo-list-panel .dm-tag-open {
    background: #fee2e2;
    color: #b91c1c;
}

#debug-memo-list-panel .dm-tag-resolved {
    background: #d1fae5;
    color: #065f46;
}

#debug-memo-list-panel .dm-tag-url {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    font-family: monospace;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#debug-memo-list-panel .dm-tag-url.current {
    background: #eef2ff;
    color: #4338ca;
}

#debug-memo-list-panel .dm-item-comp {
    font-size: 11px;
    color: #6b7280;
    font-weight: 600;
    margin-top: 6px;
}

#debug-memo-list-panel .dm-item-text {
    font-size: 13px;
    color: #1f2937;
    margin-top: 4px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#debug-memo-list-panel .dm-empty {
    text-align: center;
    color: #9ca3af;
    font-size: 13px;
    padding: 40px 20px;
}

#debug-memo-list-panel .dm-item.resolved {
    background: #f9fafb;
    border-color: #e5e7eb;
    opacity: 0.75;
}

#debug-memo-list-panel .dm-item.resolved .dm-item-text {
    text-decoration: line-through;
    color: #6b7280;
}

.debug-memo-bubble .dm-resolved-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #d1fae5;
    color: #065f46;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.debug-memo-bubble .dm-content.resolved {
    text-decoration: line-through;
    color: #6b7280;
}

/* ─── 첨부 파일 (편집 모드) ────────────────────────── */

.debug-memo-bubble .dm-file-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.debug-memo-bubble .dm-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #f3f4f6;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    transition: background 0.15s;
}

.debug-memo-bubble .dm-file-btn:hover {
    background: #e5e7eb;
}

.debug-memo-bubble .dm-file-btn input[type="file"] {
    display: none;
}

.debug-memo-bubble .dm-file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.debug-memo-bubble .dm-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    font-size: 11.5px;
    border-radius: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.debug-memo-bubble .dm-file-chip.saved {
    background: #eef2ff;
    color: #4338ca;
}

.debug-memo-bubble .dm-file-chip.new {
    background: #dcfce7;
    color: #166534;
}

.debug-memo-bubble .dm-chip-rm {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.debug-memo-bubble .dm-chip-rm:hover {
    opacity: 1;
}

/* ─── 첨부 파일 (뷰 모드) ──────────────────────────── */

.debug-memo-bubble .dm-view-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0 8px;
}

.debug-memo-bubble .dm-view-file {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: #f3f4f6;
    color: #374151;
    border-radius: 4px;
    font-size: 12px;
    text-decoration: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.debug-memo-bubble .dm-view-file:hover {
    background: #e5e7eb;
}

.debug-memo-bubble .dm-view-img-link {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    line-height: 0;
}

.debug-memo-bubble .dm-view-img {
    display: block;
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    background: #f9fafb;
}
