/* ========== 에디터 툴바 ========== */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    border-bottom: 1px solid var(--border-color);
}

.toolbar-group {
    display: flex;
    gap: 2px;
    padding-right: 8px;
    border-right: 1px solid var(--border-color);
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
}

.toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    position: relative;
}

.toolbar-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toolbar-btn:active {
    transform: scale(0.95);
}

.toolbar-btn.active {
    background: var(--primary);
    color: white;
}

.toolbar-btn[title]::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 10px;
    background: var(--text-primary);
    color: var(--bg-primary);
    font-size: 0.75rem;
    white-space: nowrap;
    border-radius: 6px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
    z-index: 100;
}

.toolbar-btn:hover[title]::after {
    opacity: 1;
    visibility: visible;
}

/* 드롭다운 */
.toolbar-dropdown {
    position: relative;
}

.toolbar-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all var(--transition-fast);
}

.toolbar-dropdown-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.toolbar-dropdown-content {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 150px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px var(--shadow-color);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.toolbar-dropdown:hover .toolbar-dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-tertiary);
}

.dropdown-item.heading-1 { font-size: 1.5rem; font-weight: 700; }
.dropdown-item.heading-2 { font-size: 1.3rem; font-weight: 700; }
.dropdown-item.heading-3 { font-size: 1.1rem; font-weight: 700; }
.dropdown-item.heading-4 { font-size: 1rem; font-weight: 600; }
.dropdown-item.heading-5 { font-size: 0.9rem; font-weight: 600; }
.dropdown-item.heading-6 { font-size: 0.85rem; font-weight: 600; }

/* 색상 선택기 */
.color-picker-wrapper {
    position: relative;
}

.color-picker-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-fast);
}

.color-picker-btn:hover {
    background: var(--bg-secondary);
}

.color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
}

.color-picker-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px var(--shadow-color);
    padding: 12px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 100;
}

.color-picker-wrapper:hover .color-picker-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform var(--transition-fast);
    border: 2px solid transparent;
}

.color-swatch:hover {
    transform: scale(1.2);
    z-index: 1;
}

.color-swatch.selected {
    border-color: var(--text-primary);
}

.color-custom {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.color-custom input[type="color"] {
    width: 32px;
    height: 32px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
}

.color-custom input[type="text"] {
    flex: 1;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

/* 폰트 크기 선택 */
.font-size-dropdown .dropdown-item {
    justify-content: space-between;
}

.font-size-preview {
    color: var(--text-tertiary);
    font-size: 0.8rem;
}

/* 에디터 미리보기 */
.editor-preview {
    border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
}

.editor-preview h1 { font-size: 2rem; margin: 20px 0 10px; }
.editor-preview h2 { font-size: 1.75rem; margin: 18px 0 10px; }
.editor-preview h3 { font-size: 1.5rem; margin: 16px 0 8px; }
.editor-preview h4 { font-size: 1.25rem; margin: 14px 0 8px; }
.editor-preview h5 { font-size: 1.1rem; margin: 12px 0 6px; }
.editor-preview h6 { font-size: 1rem; margin: 10px 0 6px; }

.editor-preview p {
    margin-bottom: 12px;
    line-height: 1.8;
}

.editor-preview strong {
    font-weight: 700;
}

.editor-preview em {
    font-style: italic;
}

.editor-preview u {
    text-decoration: underline;
}

.editor-preview s {
    text-decoration: line-through;
}

.editor-preview code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

.editor-preview pre {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: 16px 0;
}

.editor-preview pre code {
    background: none;
    padding: 0;
}

.editor-preview blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.editor-preview ul, .editor-preview ol {
    margin: 12px 0;
    padding-left: 24px;
}

.editor-preview li {
    margin-bottom: 6px;
}

.editor-preview hr {
    border: none;
    height: 2px;
    background: var(--border-color);
    margin: 24px 0;
}

.editor-preview a {
    color: var(--primary);
    text-decoration: underline;
}

.editor-preview table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.editor-preview th, .editor-preview td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
}

.editor-preview th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.editor-preview .task-list-item {
    list-style: none;
    margin-left: -20px;
}

.editor-preview .task-list-item input {
    margin-right: 8px;
}

/* 마크다운 문법 하이라이트 */
.editor-syntax-bold {
    font-weight: 700;
}

.editor-syntax-italic {
    font-style: italic;
}

.editor-syntax-code {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.editor-syntax-link {
    color: var(--accent);
}

.editor-syntax-heading {
    color: var(--secondary);
    font-weight: 700;
}

/* 단축키 안내 */
.shortcuts-panel {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 30px var(--shadow-color);
    padding: 16px;
    max-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all var(--transition-normal);
    z-index: 100;
}

.shortcuts-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.shortcuts-title {
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.shortcut-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.shortcut-keys {
    display: flex;
    gap: 4px;
}

.shortcut-key {
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
}

/* 글자 스타일 프리셋 */
.text-style-primary { color: var(--primary); }
.text-style-secondary { color: var(--secondary); }
.text-style-accent { color: var(--accent); }
.text-style-success { color: var(--success); }
.text-style-warning { color: var(--warning); }
.text-style-danger { color: var(--danger); }

.text-size-xs { font-size: 0.75rem; }
.text-size-sm { font-size: 0.875rem; }
.text-size-base { font-size: 1rem; }
.text-size-lg { font-size: 1.125rem; }
.text-size-xl { font-size: 1.25rem; }
.text-size-2xl { font-size: 1.5rem; }
.text-size-3xl { font-size: 1.875rem; }
.text-size-4xl { font-size: 2.25rem; }

.text-highlight-yellow { background: rgba(250, 204, 21, 0.3); }
.text-highlight-green { background: rgba(16, 185, 129, 0.3); }
.text-highlight-blue { background: rgba(59, 130, 246, 0.3); }
.text-highlight-pink { background: rgba(236, 72, 153, 0.3); }
.text-highlight-purple { background: rgba(139, 92, 246, 0.3); }

/* 에디터 카운터 */
.editor-counter {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
    padding: 8px 0;
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 에디터 포커스 모드 */
.editor-focus-mode .post-editor {
    min-height: 300px;
    font-size: 1.1rem;
    line-height: 2;
}

.editor-focus-mode .editor-toolbar {
    position: sticky;
    top: 70px;
    z-index: 10;
}

/* ========== 에디터 모바일 최적화 ========== */
@media (max-width: 768px) {
    .editor-toolbar {
        padding: 10px;
        gap: 6px;
        flex-wrap: wrap;
        overflow-x: visible;
        justify-content: flex-start;
    }
    
    .toolbar-group {
        flex-shrink: 0;
        padding-right: 8px;
        padding-bottom: 6px;
        border-right: 1px solid var(--border-color);
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .toolbar-group:last-child {
        border-right: none;
    }
    
    .toolbar-btn {
        width: 34px;
        height: 34px;
        font-size: 0.85rem;
    }
    
    .toolbar-btn[title]::after {
        display: none;
    }
    
    .toolbar-dropdown-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        height: 34px;
    }
    
    .toolbar-dropdown-content {
        min-width: 150px;
        max-height: 250px;
        overflow-y: auto;
    }
    
    .dropdown-item {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .color-picker-btn {
        width: 34px;
        height: 34px;
    }
    
    .color-picker-panel {
        min-width: 200px;
        left: auto;
        right: 0;
    }
    
    .color-grid {
        gap: 4px;
    }
    
    .color-swatch {
        width: 24px;
        height: 24px;
    }
    
    .emoji-picker {
        min-width: 240px;
        max-width: 300px;
        right: 0;
        left: auto;
    }
    
    .emoji-grid {
        gap: 3px;
    }
    
    .emoji-grid span {
        font-size: 1.2rem;
        padding: 4px !important;
    }
    
    .editor-preview {
        padding: 14px;
        font-size: 0.9rem;
    }
}

@media (max-width: 375px) {
    .editor-toolbar {
        padding: 8px;
        gap: 5px;
    }
    
    .toolbar-btn {
        width: 32px;
        height: 32px;
        font-size: 0.8rem;
    }
    
    .toolbar-dropdown-btn {
        height: 32px;
        padding: 5px 8px;
        font-size: 0.75rem;
    }
    
    .toolbar-group {
        padding-right: 6px;
        padding-bottom: 5px;
        gap: 3px;
    }
    
    .color-picker-panel,
    .emoji-picker {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        min-width: auto;
        max-width: none;
    }
}
