/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4F46E5;
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* 헤더 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* 업로드 영역 */
.upload-section {
    margin-bottom: 40px;
}

.upload-area {
    background: var(--card-bg);
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background-color: #F5F3FF;
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background-color: #EEF2FF;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.upload-area h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* 버튼 스타일 */
.btn-primary, .btn-secondary, .btn-filter, .btn-export {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #4338CA;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #4B5563;
}

.btn-filter {
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    margin: 5px;
}

.btn-filter.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-export {
    width: 100%;
    margin: 10px 0;
    background-color: var(--primary-color);
    color: white;
}

.btn-export:hover {
    background-color: #4338CA;
}

/* 진행 상태 */
.progress-section {
    margin-bottom: 40px;
}

.progress-container {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.progress-container h3 {
    margin-bottom: 20px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background-color: var(--border-color);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
    border-radius: 15px;
}

#progress-text {
    text-align: center;
    color: var(--text-secondary);
}

/* 컨트롤 영역 */
.controls-section {
    margin-bottom: 30px;
}

.controls {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 20px;
}

.sort-buttons {
    margin-bottom: 20px;
}

.sort-select {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    background-color: var(--card-bg);
}

.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* 북마크 그리드 */
.bookmarks-section {
    margin-bottom: 40px;
}

.bookmarks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* 북마크 카드 */
.bookmark-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: move;
    position: relative;
}

.bookmark-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.bookmark-card.dragging {
    opacity: 0.5;
}

.bookmark-card.duplicate {
    border: 3px solid var(--warning-color);
}

.bookmark-card.error {
    border: 3px solid var(--danger-color);
}

.bookmark-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background-color: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bookmark-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bookmark-info {
    padding: 15px;
}

.bookmark-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

.bookmark-favicon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    border-radius: 4px;
}

.bookmark-title {
    flex: 1;
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bookmark-url {
    color: var(--text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 10px;
}

.bookmark-badges {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-duplicate {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-error {
    background-color: #FEE2E2;
    color: #991B1B;
}

.bookmark-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.btn-card {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-visit {
    background-color: var(--primary-color);
    color: white;
}

.btn-visit:hover {
    background-color: #4338CA;
}

.btn-delete {
    background-color: var(--danger-color);
    color: white;
}

.btn-delete:hover {
    background-color: #DC2626;
}

/* 로딩 애니메이션 */
.loading {
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 빈 상태 */
.empty-section {
    text-align: center;
    padding: 60px 20px;
}

.empty-message {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

/* 모달 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-bottom: 30px;
    text-align: center;
}

.export-options {
    margin-bottom: 20px;
}

/* 반응형 */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .bookmarks-grid {
        grid-template-columns: 1fr;
    }

    .controls {
        padding: 15px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}

/* 드래그 오버 효과 */
.drag-over-card {
    border: 2px dashed var(--primary-color);
    background-color: #F5F3FF;
}

