/* =============================================
   Memo Panel Styles - 글래스모피즘 디자인
   ============================================= */

/* 메모 패널 (사이드 패널) - 세련된 디자인 */
.memo-panel {
    position: fixed;
    top: 20px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 20px);
    height: calc(100vh - 40px);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    
    /* 흰색 배경 + 둥근 모서리 */
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.99) 0%, rgba(250, 251, 253, 1) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-right: none;
    border-radius: 16px 0 0 16px;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.12),
                0 8px 32px rgba(0, 0, 0, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    
    /* 애니메이션 */
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 오버플로우 처리 */
    overflow: hidden;
}

.memo-panel:not(.hidden) {
    transform: translateX(0);
}

.memo-panel.hidden {
    pointer-events: none;
}

/* 리사이즈 핸들 */
.memo-resize-handle {
    position: absolute;
    left: 0;
    top: 16px;
    width: 8px;
    height: calc(100% - 32px);
    cursor: ew-resize;
    background: transparent;
    z-index: 20;
    transition: background 0.2s ease;
    border-radius: 16px 0 0 16px;
}

.memo-resize-handle:hover,
.memo-resize-handle.active {
    background: rgba(74, 158, 255, 0.3);
}

.memo-resize-handle::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 50px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.memo-resize-handle:hover::before,
.memo-resize-handle.active::before {
    opacity: 1;
}

/* 리사이즈 중 선택 방지 */
.memo-panel.resizing {
    user-select: none;
}

.memo-panel.resizing * {
    pointer-events: none;
}

/* 헤더 */
.memo-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 251, 253, 1) 100%);
    border-radius: 16px 0 0 0;
}

.memo-panel-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: #1a1a1a;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.memo-panel-subtitle {
    font-size: 17px;
    font-weight: 400;
    color: #5a6a7a;
}

.memo-header-actions {
    display: flex;
    gap: 8px;
}

/* 아이콘 버튼 - 흰색 배경용 */
.memo-icon-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.05);
    color: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

.memo-icon-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
    transform: scale(1.05);
}

.memo-icon-btn:active {
    transform: scale(0.95);
}

.memo-icon-btn.active {
    background: rgba(74, 158, 255, 0.2);
    color: #2080e0;
}

.memo-icon-btn-small {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.2s ease;
}

.memo-icon-btn-small:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

/* 검색 바 - 흰색 배경용 */
.memo-search-bar {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
}

.memo-search-bar.hidden {
    display: none;
}

.memo-search-bar input {
    flex: 1;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 14px;
    color: #1a1a1a;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.memo-search-bar input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

/* 정렬 바 */
.memo-sort-bar {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    gap: 8px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(0, 0, 0, 0.01);
    font-size: 12px;
}

.memo-sort-bar.hidden {
    display: none;
}

.memo-sort-label {
    color: #666;
    white-space: nowrap;
}

.memo-sort-select {
    flex: 1;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 6px 10px;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    max-width: 120px;
}

.memo-sort-select:focus {
    border-color: rgba(74, 158, 255, 0.5);
}

.memo-sort-order-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
}

.memo-sort-order-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.memo-sort-order-btn[data-order="asc"] i {
    transform: scaleY(-1);
}

.memo-search-bar input:focus {
    border-color: rgba(74, 158, 255, 0.5);
    background: rgba(0, 0, 0, 0.02);
}

/* 폴더 목록 - 흰색 배경용 */
.memo-folder-list {
    padding: 12px;
    padding-bottom: 16px;
    border-bottom: none;
    background: rgba(0, 0, 0, 0.02);
    min-height: 100px;
    max-height: 50vh;
    overflow-y: auto;
    position: relative;
    flex-shrink: 0;
}

.memo-folder-list.hidden {
    display: none;
}

/* 폴더/메모 목록 리사이즈 핸들 */
.memo-folder-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    background: transparent;
    z-index: 5;
    transition: background 0.2s ease;
}

.memo-folder-resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.memo-folder-resize-handle:hover,
.memo-folder-resize-handle.active {
    background: rgba(74, 158, 255, 0.3);
}

.memo-folder-resize-handle:hover::before,
.memo-folder-resize-handle.active::before {
    opacity: 1;
}

/* 리사이즈 중 선택 방지 */
.memo-folder-list.resizing {
    user-select: none;
}

.memo-folder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(0, 0, 0, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.memo-folder-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.memo-folder-item.active {
    background: rgba(74, 158, 255, 0.15);
    color: #2080e0;
    font-weight: 600;
    border-left: 3px solid #4a9eff;
    padding-left: 9px;
}

.memo-folder-item i {
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.memo-folder-item span:first-of-type {
    flex: 1;
}

.memo-folder-count {
    background: rgba(0, 0, 0, 0.08);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    color: rgba(0, 0, 0, 0.5);
}

/* 폴더 편집/삭제 버튼 */
.memo-folder-edit,
.memo-folder-delete {
    opacity: 0;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: all 0.15s ease;
    margin-left: 2px;
}

.memo-folder-item:hover .memo-folder-edit,
.memo-folder-item:hover .memo-folder-delete {
    opacity: 1;
}

.memo-folder-edit:hover {
    background: rgba(74, 158, 255, 0.15);
    color: #2080e0;
}

.memo-folder-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

/* 폴더 이름 */
.memo-folder-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.memo-add-folder-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    margin-top: 8px;
    border: 1px dashed rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    background: transparent;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.memo-add-folder-btn:hover {
    border-color: rgba(74, 158, 255, 0.5);
    color: #2080e0;
    background: rgba(74, 158, 255, 0.1);
}

/* 메모 목록 */
.memo-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.memo-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: rgba(0, 0, 0, 0.4);
    text-align: center;
    padding: 40px 20px;
}

.memo-list-empty i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.memo-list-empty p {
    margin: 4px 0;
    font-size: 14px;
}

.memo-list-empty p:first-of-type {
    font-size: 16px;
    color: rgba(0, 0, 0, 0.6);
}

/* 메모 아이템 - 세련된 카드 스타일 */
.memo-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.memo-item:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(74, 158, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.memo-item.pinned {
    border-left: 3px solid #f59e0b;
    background: rgba(255, 251, 235, 0.5);
}

/* 드래그 앤 드롭 스타일 */
.memo-item[draggable="true"] {
    cursor: grab;
}

.memo-item[draggable="true"]:active {
    cursor: grabbing;
}

.memo-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.memo-folder-list.drag-active .memo-folder-item {
    transition: all 0.2s;
}

.memo-folder-item.drag-over {
    background: rgba(74, 158, 255, 0.15) !important;
    border-color: rgba(74, 158, 255, 0.5) !important;
    transform: scale(1.02);
}

/* 검색 하이라이트 */
.memo-highlight {
    background: linear-gradient(120deg, #fef08a 0%, #fde047 100%);
    color: #1a1a1a;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 500;
}

.memo-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.memo-item-title {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memo-item-icons {
    display: flex;
    align-items: center;
    gap: 6px;
}

.memo-item-pin {
    color: #f59e0b;
    font-size: 12px;
}

.memo-item-share {
    color: #4a9eff;
    font-size: 12px;
}

.memo-item-attachment {
    color: #6b7280;
    font-size: 12px;
}

.memo-item.shared {
    border-left: 3px solid #4a9eff;
}

/* 공유 버튼 활성화 상태 */
.memo-menu-item.memo-menu-active {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.memo-menu-item.memo-menu-active i {
    color: #4a9eff;
}

.memo-item-preview {
    font-size: 13px;
    color: rgba(0, 0, 0, 0.5);
    line-height: 1.4;
    max-height: 40px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.memo-item-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 11px;
    color: rgba(0, 0, 0, 0.4);
}

.memo-item-folder {
    display: flex;
    align-items: center;
    gap: 4px;
}

.memo-item-folder i {
    font-size: 10px;
}

/* 메모 에디터 - 세련된 스타일 */
.memo-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    position: absolute;
    top: 0;
    left: 8px; /* 리사이즈 핸들 너비만큼 여백 */
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1) 0%, rgba(250, 251, 253, 1) 100%);
    z-index: 5; /* 리사이즈 핸들(z-index: 10)보다 낮게 */
    border-radius: 16px 0 0 16px;
    overflow: hidden; /* 확대 시 내용이 넘치지 않도록 */
}

.memo-editor.hidden {
    display: none;
}

.memo-editor-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff; /* 불투명 배경 */
    border-radius: 16px 0 0 0;
    flex-shrink: 0; /* 헤더가 축소되지 않도록 */
    position: relative;
    z-index: 10;
}

.memo-title-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #1a1a1a;
    font-size: 16px;
    font-weight: 500;
    outline: none;
    padding: 8px 0;
}

.memo-title-input::placeholder {
    color: rgba(0, 0, 0, 0.4);
}

.memo-editor-actions {
    display: flex;
    gap: 6px;
}

/* 에디터 툴바 - 흰색 배경용 */
.memo-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    background: #fafafa; /* 불투명 배경 */
    flex-wrap: wrap;
    flex-shrink: 0; /* 툴바가 축소되지 않도록 */
    position: relative;
    z-index: 10;
}

.memo-format-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(0, 0, 0, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: all 0.15s ease;
}

.memo-format-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #1a1a1a;
}

.memo-format-btn.active {
    background: rgba(74, 158, 255, 0.15);
    color: #2080e0;
}

/* 헤딩 버튼 스타일 */
.memo-heading-btn {
    font-weight: 700;
    font-size: 12px;
    min-width: 28px;
}

.memo-heading-btn[data-heading="h1"] { font-size: 14px; }
.memo-heading-btn[data-heading="h2"] { font-size: 13px; }
.memo-heading-btn[data-heading="h3"] { font-size: 12px; }
.memo-heading-btn[data-heading="p"] { font-size: 11px; font-weight: 400; }

.memo-toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(0, 0, 0, 0.15);
    margin: 0 6px;
}

/* 색상 선택기 - 흰색 배경용 */
.memo-color-picker-wrapper {
    position: relative;
    display: inline-block;
}

.memo-color-palette {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    z-index: 100;
}

.memo-color-palette.hidden {
    display: none;
}

.memo-palette-color {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.memo-palette-color:hover {
    transform: scale(1.15);
    border-color: rgba(0, 0, 0, 0.4);
}

.memo-palette-color[data-color="#ffffff"] {
    border-color: rgba(0, 0, 0, 0.3);
}

/* 메모 내용 에디터 - 흰색 배경용 */
.memo-content-editor {
    flex: 1;
    min-height: 0; /* flex 컨테이너 내에서 스크롤 작동을 위해 필수 */
    padding: 16px 20px;
    color: #1a1a1a;
    /* 헤딩에 em 단위 쓰면 줄 삭제·병합 시 부모 블록 안으로 들어가며 크기가 곱으로 커짐 → 기준 px에서만 계산 */
    --memo-base-fs: 15px;
    --memo-h1-fs: calc(var(--memo-base-fs) * 1.75);
    --memo-h2-fs: calc(var(--memo-base-fs) * 1.35);
    --memo-h3-fs: calc(var(--memo-base-fs) * 1.15);
    font-size: var(--memo-base-fs);
    line-height: 1.7;
    overflow-y: auto !important;
    overflow-x: hidden;
    outline: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative;
    -webkit-overflow-scrolling: touch; /* iOS 스크롤 부드럽게 */
}

.memo-content-editor:empty::before {
    content: attr(data-placeholder);
    color: rgba(0, 0, 0, 0.4);
    pointer-events: none;
}

.memo-content-editor ul,
.memo-content-editor ol {
    padding-left: 1.8em;
    margin: 8px 0;
}

.memo-content-editor li {
    margin: 4px 0;
}

/* 목록 마커 크기를 헤딩 절대 크기에 맞춤 (em 사용 안 함) */
.memo-content-editor li:has(> h1)::marker {
    font-size: var(--memo-h1-fs);
    font-weight: 700;
}

.memo-content-editor li:has(> h2)::marker {
    font-size: var(--memo-h2-fs);
    font-weight: 600;
}

.memo-content-editor li:has(> h3)::marker {
    font-size: var(--memo-h3-fs);
    font-weight: 600;
}

/* 목록 안 헤딩: 바깥 h1 margin 단계에서 li끼리 margin 접힘으로 줄이 붙는 경우 완화 */
.memo-content-editor li > h1 {
    margin: 0.45em 0 0.35em;
    line-height: 1.35;
}

.memo-content-editor li > h2 {
    margin: 0.4em 0 0.3em;
    line-height: 1.4;
}

.memo-content-editor li > h3 {
    margin: 0.35em 0 0.28em;
    line-height: 1.45;
}

/* 헤딩 스타일 — em 아님: 부모가 헤딩/큰 블록으로 감싸져도 단계 크기 고정 */
.memo-content-editor h1 {
    font-size: var(--memo-h1-fs);
    font-weight: 700;
    margin: 0.5em 0 0.3em;
    line-height: 1.3;
}

.memo-content-editor h2 {
    font-size: var(--memo-h2-fs);
    font-weight: 600;
    margin: 0.4em 0 0.25em;
    line-height: 1.4;
}

.memo-content-editor h3 {
    font-size: var(--memo-h3-fs);
    font-weight: 600;
    margin: 0.3em 0 0.2em;
    line-height: 1.4;
}

/* 줄 병합으로 h1~h3 안에 들어온 본문(p/div): 헤딩 굵기·크기 상속 방지 */
.memo-content-editor h1 p,
.memo-content-editor h2 p,
.memo-content-editor h3 p {
    font-size: var(--memo-base-fs);
    font-weight: 400;
    margin: 2px 0;
}

.memo-content-editor h1 > div,
.memo-content-editor h2 > div,
.memo-content-editor h3 > div {
    font-size: var(--memo-base-fs);
    font-weight: 400;
}

.memo-content-editor p {
    margin: 2px 0;
}

/* 수평선 스타일 - 흰색 배경용 */
.memo-content-editor hr,
.memo-content-editor .memo-hr,
.memo-content-editor hr[style],
.memo-content-editor .memo-hr[style] {
    border: none !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent 0%, #cccccc 5%, #cccccc 95%, transparent 100%) !important;
    margin: 16px 0 !important;
}


/* 링크 스타일 */
.memo-content-editor a {
    color: #2563eb;
    text-decoration: underline;
    cursor: pointer;
}

.memo-content-editor a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* 이미지 스타일 */
.memo-content-editor img,
.memo-content-editor .memo-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
}

.memo-content-editor img:hover {
    opacity: 0.95;
}

.memo-content-editor img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
    -webkit-user-drag: none;
    user-drag: none;
}

/* 코드 블록 스타일 */
.memo-content-editor pre {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* Colab/Jupyter 오류·traceback: 회색 박스 없음, 글자는 본문(--memo-base-fs)과 동일 (일반 pre 13px보다 작아 보이던 문제) */
.memo-content-editor pre.memo-paste-colab {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 2px 0;
    margin: 6px 0;
    box-shadow: none;
    font-size: var(--memo-base-fs);
    line-height: 1.7;
    font-family: inherit;
}

.memo-content-editor pre.memo-paste-colab code {
    font-size: 1em;
    font-family: inherit;
}

.memo-content-editor code {
    background: rgba(0, 0, 0, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.memo-content-editor pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
}

/*
 * Jupyter / Colab / IPython 복사 시 붙는 ansi-* 클래스 (배경은 pre에서 통일, 글자색만)
 * 참고: https://github.com/jupyterlab/jupyterlab/blob/master/packages/theme-light-extension/style/variables.css
 */
.memo-paste-pre .ansi-black-fg { color: #3e4249; }
.memo-paste-pre .ansi-red-fg { color: #d13212; }
.memo-paste-pre .ansi-green-fg { color: #197300; }
.memo-paste-pre .ansi-yellow-fg { color: #795e26; }
.memo-paste-pre .ansi-blue-fg { color: #0866cc; }
.memo-paste-pre .ansi-magenta-fg { color: #bc05bc; }
.memo-paste-pre .ansi-cyan-fg { color: #0598bc; }
.memo-paste-pre .ansi-white-fg { color: #bfbfbf; }
.memo-paste-pre .ansi-gray-fg,
.memo-paste-pre .ansi-bright-black-fg { color: #717171; }

.memo-paste-pre .ansi-bright-red-fg { color: #e8503a; }
.memo-paste-pre .ansi-bright-green-fg { color: #13a10e; }
.memo-paste-pre .ansi-bright-yellow-fg { color: #c19c00; }
.memo-paste-pre .ansi-bright-blue-fg { color: #0078d4; }
.memo-paste-pre .ansi-bright-magenta-fg { color: #c240c2; }
.memo-paste-pre .ansi-bright-cyan-fg { color: #00a4b4; }
.memo-paste-pre .ansi-bright-white-fg { color: #fafafa; }

.memo-paste-pre .ansi-red-intense-fg { color: #b22; }
.memo-paste-pre .ansi-green-intense-fg { color: #070; }
.memo-paste-pre .ansi-blue-intense-fg { color: #05a; }
.memo-paste-pre .ansi-yellow-intense-fg { color: #a70; }

/* 에디터 푸터 - 흰색 배경용 */
.memo-editor-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    background: #f8f9fa; /* 불투명 배경으로 내용 가림 */
    font-size: 12px;
    flex-shrink: 0; /* 푸터가 축소되지 않도록 */
    position: relative;
    z-index: 10; /* 내용보다 위에 표시 */
}

.memo-save-status {
    color: rgba(0, 0, 0, 0.5);
}

.memo-save-status.saving {
    color: #f59e0b;
}

.memo-save-status.saved {
    color: #10b981;
}

.memo-folder-select {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 6px 10px;
    color: rgba(0, 0, 0, 0.8);
    font-size: 12px;
    outline: none;
    cursor: pointer;
    max-width: 150px;
}

.memo-folder-select option {
    background: #fff;
    color: #1a1a1a;
}

/* 더보기 메뉴 - 흰색 배경용 */
.memo-more-menu {
    position: absolute;
    top: 60px;
    right: 16px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    padding: 8px;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.memo-more-menu.hidden {
    display: none;
}

.memo-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(0, 0, 0, 0.7);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.memo-menu-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

.memo-menu-item i {
    width: 16px;
    text-align: center;
    font-size: 13px;
}

.memo-menu-danger {
    color: #ef4444;
}

.memo-menu-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.memo-menu-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
    margin: 6px 0;
}

/* 폴더 모달 */
.memo-folder-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.memo-folder-modal.hidden {
    display: none;
}

.memo-folder-modal-content {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    padding: 24px;
    width: 320px;
    max-width: 90vw;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.memo-folder-modal-content h4 {
    margin: 0 0 16px;
    color: #1a1a1a;
    font-size: 18px;
    font-weight: 600;
}

.memo-folder-modal-content input {
    width: 100%;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 12px 14px;
    color: #1a1a1a;
    font-size: 14px;
    outline: none;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.memo-folder-modal-content input:focus {
    border-color: rgba(74, 158, 255, 0.5);
}

.memo-folder-colors {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.memo-color-btn {
    width: 32px;
    height: 32px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memo-color-btn:hover {
    transform: scale(1.1);
}

.memo-color-btn.active {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.memo-folder-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.memo-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.memo-btn-secondary {
    background: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.7);
}

.memo-btn-secondary:hover {
    background: rgba(0, 0, 0, 0.12);
}

.memo-btn-primary {
    background: #4a9eff;
    color: #fff;
}

.memo-btn-primary:hover {
    background: #3b8bef;
}

/* 스크롤바 스타일 - 흰색 배경용 */
.memo-panel ::-webkit-scrollbar {
    width: 6px;
}

.memo-panel ::-webkit-scrollbar-track {
    background: transparent;
}

.memo-panel ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

.memo-panel ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* 반응형 */
@media (max-width: 480px) {
    .memo-panel {
        width: 100vw;
        max-width: 100vw;
        top: 0;
        height: 100vh;
        border-radius: 0;
    }
    
    .memo-panel-header,
    .memo-editor-header {
        border-radius: 0;
    }
    
    .memo-editor {
        border-radius: 0;
        left: 0;
    }
    
    .memo-resize-handle {
        display: none;
    }
}

/* 태블릿에서 메모 기능 숨김 (터치 기기에서 패널 동작 문제) */
@media (max-width: 1024px) and (pointer: coarse),
       (max-width: 768px) {
    #memoButton {
        display: none !important;
    }
    
    .memo-panel {
        display: none !important;
    }
}

/* =============================================
   메모 프레젠테이션 오버레이 - 흰색 배경 통일
   ============================================= */

.memo-present-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.memo-present-overlay.active {
    display: flex;
}

.memo-present-close {
    position: absolute;
    top: 10px;
    right: 20px;
    background: rgba(0, 0, 0, 0.3);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10001;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memo-present-close:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.1);
}

.memo-present-content {
    width: 92vw;
    max-width: 92vw;
    height: 94vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 40px 80px;
    box-sizing: border-box;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.99) 100%);
    border-radius: 12px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #1a1a1a;
    line-height: 1.6;
}

.memo-present-content-inner {
    font-size: 24px;
    --present-base-fs: 24px;
    --present-h1-fs: calc(var(--present-base-fs) * 1.8);
    --present-h2-fs: calc(var(--present-base-fs) * 1.4);
    --present-h3-fs: calc(var(--present-base-fs) * 1.15);
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

/*
 * 프레젠트에 pre 규칙이 없으면 UA 기본(고정폭)만 적용되어 한글은 대체 글꼴·영문은 monospaced로 갈라져 보임.
 * 메모 에디터(.memo-content-editor pre / pre.memo-paste-colab)와 동일한 글꼴·비율 유지.
 */
.memo-present-content pre {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 0.5em 0.75em;
    margin: 0.45em 0;
    overflow-x: auto;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: calc(13 / 15 * 1em);
    line-height: 1.5;
}

.memo-present-content pre.memo-paste-colab {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0.08em 0;
    margin: 0.35em 0;
    box-shadow: none;
    font-family: inherit;
    font-size: 1em;
    line-height: 1.7;
}

.memo-present-content pre.memo-paste-colab code {
    font-size: 1em;
    font-family: inherit;
}

.memo-present-content code {
    background: rgba(0, 0, 0, 0.06);
    padding: 0.08em 0.35em;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

.memo-present-content pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: 1em;
}

.memo-present-content h1 {
    font-size: var(--present-h1-fs);
    margin-bottom: 0.5em;
    color: #111;
    border-bottom: none;
    padding-bottom: 0.2em;
}

.memo-present-content h2 {
    font-size: var(--present-h2-fs);
    margin-bottom: 0.5em;
    color: #222;
}

.memo-present-content h3 {
    font-size: var(--present-h3-fs);
    margin-bottom: 0.5em;
    color: #333;
}

.memo-present-content p,
.memo-present-content div:not(.memo-present-controls):not(.memo-checklist-item) {
    color: #1a1a1a;
    border: none;
}

.memo-present-content-inner > div {
    margin: 0;
}

.memo-present-content-inner img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

.memo-present-content span:not([style*="color"]),
.memo-present-content font:not([color]) {
    color: #1a1a1a;
}

.memo-present-content p {
    margin: 0;
}

.memo-present-content ul,
.memo-present-content ol {
    padding-left: 0;
    margin-left: 0;
    margin-bottom: 0.6em;
    list-style-position: inside;
}

.memo-present-content li {
    margin-bottom: 0.3em;
    color: #1a1a1a;
}

.memo-present-content li:has(> h1)::marker {
    font-size: var(--present-h1-fs);
    font-weight: 700;
}

.memo-present-content li:has(> h2)::marker {
    font-size: var(--present-h2-fs);
    font-weight: 600;
}

.memo-present-content li:has(> h3)::marker {
    font-size: var(--present-h3-fs);
    font-weight: 600;
}

.memo-present-content .memo-checklist-item {
    display: flex;
    align-items: center;
    gap: 0.4em;
    margin: 0.3em 0;
}

.memo-present-content .memo-checkbox {
    width: 0.85em;
    height: 0.85em;
    border: 2px solid rgba(0, 0, 0, 0.35);
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-block;
}

.memo-present-content .memo-checkbox.checked {
    background: #10b981;
    border-color: #10b981;
    position: relative;
}

.memo-present-content .memo-checkbox.checked::after {
    content: '✓';
    color: #fff;
    font-size: 0.6em;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.memo-present-content .memo-checklist-text {
    flex: 1;
}

.memo-present-content .memo-checklist-text.checked {
    text-decoration: line-through;
    color: rgba(0, 0, 0, 0.4);
}

.memo-present-content hr,
.memo-present-content .memo-hr,
.memo-present-content hr[style],
.memo-present-content .memo-hr[style] {
    border: none !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent 0%, #cccccc 5%, #cccccc 95%, transparent 100%) !important;
    margin: 2em 0 !important;
}

.memo-present-controls {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.memo-present-control-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, transform 0.2s;
}

.memo-present-control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.memo-present-zoom-level {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

/* ===== 휴지통 스타일 ===== */
.memo-trash-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.memo-trash-view.hidden {
    display: none;
}

.memo-trash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(255, 100, 100, 0.1);
    border-bottom: 1px solid rgba(255, 100, 100, 0.2);
    color: #e74c3c;
    font-weight: 600;
    font-size: 14px;
}

.memo-empty-trash-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(231, 76, 60, 0.15);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 6px;
    color: #e74c3c;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.memo-empty-trash-btn:hover {
    background: rgba(231, 76, 60, 0.25);
    border-color: rgba(231, 76, 60, 0.5);
}

.memo-trash-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.memo-trash-item {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(231, 76, 60, 0.15);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
    cursor: default;
    transition: all 0.2s;
}

.memo-trash-item:hover {
    border-color: rgba(231, 76, 60, 0.3);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.1);
}

.memo-trash-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.memo-trash-item-title {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 10px;
}

.memo-trash-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.memo-trash-restore-btn,
.memo-trash-delete-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.memo-trash-restore-btn {
    background: rgba(46, 204, 113, 0.15);
    color: #27ae60;
}

.memo-trash-restore-btn:hover {
    background: rgba(46, 204, 113, 0.3);
}

.memo-trash-delete-btn {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.memo-trash-delete-btn:hover {
    background: rgba(231, 76, 60, 0.3);
}

.memo-trash-item-preview {
    font-size: 12px;
    color: #777;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 8px;
}

.memo-trash-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: #999;
}

.memo-trash-item-deleted {
    color: #e74c3c;
}

/* 휴지통 토글 버튼 활성화 상태 */
#memoTrashToggle.active {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

#memoTrashToggle.active:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* 첨부 파일 영역 (메모 내용 아래) */
.memo-attachments {
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    background: #f5f5f5; /* 불투명 배경 */
    max-height: 180px;
    overflow-y: auto;
    flex-shrink: 0;
    position: relative;
    z-index: 10; /* 내용보다 위에 표시 */
}

.memo-attachments.hidden {
    display: none;
}

.memo-attachments-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.memo-attachment-count {
    background: rgba(74, 158, 255, 0.2);
    color: #3b82f6;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

.memo-attachment-list {
    padding: 8px;
}

.memo-attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.memo-attachment-item:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(74, 158, 255, 0.3);
}

.memo-attachment-item:last-child {
    margin-bottom: 0;
}

.memo-attachment-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 158, 255, 0.1);
    border-radius: 6px;
    color: #3b82f6;
    font-size: 14px;
    flex-shrink: 0;
}

.memo-attachment-info {
    flex: 1;
    min-width: 0;
}

.memo-attachment-name {
    font-size: 13px;
    font-weight: 500;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.memo-attachment-size {
    font-size: 11px;
    color: #888;
}

.memo-attachment-actions {
    display: flex;
    gap: 4px;
}

.memo-attachment-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.memo-attachment-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #333;
}

.memo-attachment-btn.download:hover {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.memo-attachment-btn.delete:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* 파일 업로드 중 상태 */
.memo-attachment-item.uploading {
    opacity: 0.7;
}

.memo-attachment-item.uploading .memo-attachment-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 첨부 버튼 활성화 상태 */
#memoAttachBtn.has-files {
    color: #3b82f6;
    background: rgba(74, 158, 255, 0.15);
}

