/* 뷰어 전용 스타일 */

/* 하이라이트 스타일 */
.highlight {
    position: relative;
    cursor: pointer;
    border-radius: 2px;
    padding: 1px 2px;
    margin: -1px -2px;
    transition: all 0.2s ease-in-out;
}

.highlight:hover {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
    z-index: 10;
}

.highlight.selected {
    box-shadow: 0 0 0 2px #3B82F6;
    z-index: 10;
}

/* 하이라이트 버튼 */
.highlight-button {
    animation: fadeInUp 0.2s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 검색 하이라이트 */
.search-highlight {
    background-color: #FEF3C7 !important;
    border: 1px solid #F59E0B;
    border-radius: 2px;
    padding: 1px 2px;
    margin: -1px -2px;
}

/* 문서 내용 스타일 */
#document-content {
    line-height: 1.7;
    font-size: 16px;
    color: #374151;
}

#document-content h1,
#document-content h2,
#document-content h3,
#document-content h4,
#document-content h5,
#document-content h6 {
    color: #111827;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

#document-content h1 {
    font-size: 2.25rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.5rem;
}

#document-content h2 {
    font-size: 1.875rem;
}

#document-content h3 {
    font-size: 1.5rem;
}

#document-content p {
    margin-bottom: 1rem;
}

#document-content ul,
#document-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

#document-content li {
    margin-bottom: 0.25rem;
}

#document-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6b7280;
}

#document-content code {
    background-color: #f3f4f6;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
}

#document-content pre {
    background-color: #f3f4f6;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

#document-content pre code {
    background: none;
    padding: 0;
}

#document-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

#document-content th,
#document-content td {
    border: 1px solid #e5e7eb;
    padding: 0.5rem;
    text-align: left;
}

#document-content th {
    background-color: #f9fafb;
    font-weight: 600;
}

#document-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* 사이드 패널 스타일 */
.side-panel {
    background: white;
    border-left: 1px solid #e5e7eb;
    height: calc(100vh - 4rem);
    overflow: hidden;
}

.panel-tab {
    transition: all 0.2s ease-in-out;
}

.panel-tab.active {
    background-color: #eff6ff;
    color: #2563eb;
    border-bottom: 2px solid #2563eb;
}

/* 메모 카드 스타일 */
.note-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.note-card:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.note-card.selected {
    border-color: #3b82f6;
    background: #eff6ff;
}

/* 책갈피 카드 스타일 */
.bookmark-card {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
}

.bookmark-card:hover {
    background: #ecfdf5;
    border-color: #bbf7d0;
    transform: translateY(-1px);
}

/* 색상 선택기 */
.color-picker {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: #f3f4f6;
    border-radius: 0.5rem;
}

.color-option {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    border: 2px solid white;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

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

.color-option.selected {
    box-shadow: 0 0 0 2px #3b82f6;
}

/* 검색 입력 */
.search-input {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    width: 100%;
    transition: all 0.2s ease-in-out;
}

.search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 도구 모음 */
.toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.toolbar-button {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: none;
    background: #f3f4f6;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-size: 0.875rem;
    font-weight: 500;
}

.toolbar-button:hover {
    background: #e5e7eb;
}

.toolbar-button.active {
    background: #3b82f6;
    color: white;
}

.toolbar-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 모달 스타일 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.2s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 태그 입력 */
.tag-input {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    min-height: 2.5rem;
    background: white;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #eff6ff;
    color: #1e40af;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.tag-remove {
    cursor: pointer;
    color: #6b7280;
    font-size: 0.75rem;
}

.tag-remove:hover {
    color: #ef4444;
}

/* 스크롤 표시기 */
.scroll-indicator {
    position: fixed;
    top: 4rem;
    right: 1rem;
    width: 4px;
    height: calc(100vh - 5rem);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    z-index: 30;
}

.scroll-thumb {
    width: 100%;
    background: #3b82f6;
    border-radius: 2px;
    transition: background-color 0.2s ease-in-out;
}

.scroll-thumb:hover {
    background: #2563eb;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .side-panel {
        position: fixed;
        top: 4rem;
        right: 0;
        width: 100%;
        max-width: 24rem;
        z-index: 40;
        box-shadow: -4px 0 6px -1px rgba(0, 0, 0, 0.1);
    }
    
    #document-content {
        font-size: 14px;
        padding: 1rem;
    }
    
    .toolbar {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .toolbar-button {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .color-option {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* 다크 모드 지원 */
@media (prefers-color-scheme: dark) {
    .highlight {
        filter: brightness(0.8);
    }
    
    .search-highlight {
        background-color: #451a03 !important;
        border-color: #92400e;
        color: #fbbf24;
    }
    
    #document-content {
        color: #e5e7eb;
    }
    
    #document-content h1,
    #document-content h2,
    #document-content h3,
    #document-content h4,
    #document-content h5,
    #document-content h6 {
        color: #f9fafb;
    }
}

/* 인쇄 스타일 */
@media print {
    .toolbar,
    .side-panel,
    .highlight-button {
        display: none !important;
    }
    
    .highlight {
        background-color: #fef3c7 !important;
        box-shadow: none !important;
    }
    
    #document-content {
        font-size: 12pt;
        line-height: 1.5;
    }
}
