/* ===== UX Polish - Loading States, Errors, Search ===== */

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 120px;
    margin-bottom: 1rem;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-title {
    height: 2rem;
    width: 80%;
    margin-bottom: 1rem;
}

/* Loading State Container */
.loading-container {
    padding: 2rem;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.error-state h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.error-state p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.btn-retry {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--accent-gradient);
    color: var(--bg-body);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(201, 169, 97, 0.3);
}

/* Search Improvements */
.header-search {
    position: relative;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    padding: 4px;
    line-height: 1;
}

.header-search.has-value .search-clear {
    opacity: 1;
    pointer-events: all;
}

.search-clear:hover {
    color: var(--accent-color);
}

.search-results-count {
    padding: 1rem 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.search-results-count strong {
    color: var(--accent-color);
}

/* Better Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state .empty-icon {
    font-size: 5rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 400px;
    margin: 0 auto;
}

/* Breadcrumb Navigation */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.breadcrumb-item {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.breadcrumb-item:hover {
    color: var(--accent-color);
}

.breadcrumb-separator {
    color: var(--text-muted);
    opacity: 0.5;
}

.breadcrumb-item.active {
    color: var(--text-primary);
    font-weight: 500;
}

/* Smooth Transitions */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus Visible (Accessibility) */
button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Improved Note Cards Hover */
.note-item {
    transition: all 0.2s ease;
}

.note-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Print Styles */
@media print {

    .sidebar,
    .toc-sidebar,
    .share-actions,
    .back-btn,
    .theme-toggle,
    .reading-progress,
    .page-header {
        display: none !important;
    }

    .note-content-wrapper {
        max-width: 100%;
        margin: 0;
    }

    .note-detail-container {
        padding: 0;
    }
}