/* Loading Indicators */
.loading-section {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.loading-status-text {
    font-weight: 600;
    margin-bottom: 15px;
    font-size: 15px;
}

.loading-progress-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    max-width: 400px;
    height: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--paper-bg);
    border-radius: 4px;
    overflow: hidden;
    display: block;
    margin: 15px auto;
}

.loading-progress-bar::-webkit-progress-bar {
    background-color: var(--paper-bg);
    border-radius: 4px;
}

.loading-progress-bar::-webkit-progress-value {
    background-color: var(--text-color);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.loading-progress-bar::-moz-progress-bar {
    background-color: var(--text-color);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.loading-spinner {
    display: inline-block;
    margin-top: 15px;
    font-size: 1.5em;
    animation: spin 1.5s linear infinite;
}

.results-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 20px;
    font-style: italic;
}

.rotating-icon {
    display: inline-block;
    margin-right: 10px;
    font-size: 1.2em;
    animation: spin 1.5s linear infinite;
}

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

/* Search UI */
.search-ui-section {
    display: flex;
    gap: 10px;
    align-items: stretch;
    padding: 20px;
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.search-input {
    flex-grow: 1;
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--paper-bg);
    color: var(--text-color);
    font-family: 'Crimson Text', 'Times New Roman', Times, serif;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: 2px solid var(--text-color);
    border-color: var(--text-color);
}

.search-button {
    padding: 10px 20px;
    background-color: var(--text-color);
    color: var(--paper-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Crimson Text', 'Times New Roman', Times, serif;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-button:hover:not(:disabled) {
    opacity: 0.8;
}

.search-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Table of Contents */
.toc-section {
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.toc-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list > li {
    margin-bottom: 15px;
}

.toc-chapter {
    font-weight: 700;
    font-size: 18px;
    color: var(--heading-color);
    display: block;
    margin-bottom: 8px;
}

.toc-sub-list {
    list-style: none;
    padding-left: 20px;
    margin-top: 8px;
}

.toc-sub-list > li {
    margin-bottom: 8px;
}

.toc-subchapter {
    font-weight: 600;
    font-size: 16px;
    opacity: 0.9;
}

.toc-sub-sub-list {
    list-style: none;
    padding-left: 20px;
    margin-top: 5px;
}

.toc-sub-sub-list > li {
    margin-bottom: 5px;
}

.toc-subsection {
    font-size: 15px;
    opacity: 0.8;
}

/* Results */
.results-section {
    margin-top: 20px;
}

.result-item {
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.result-item:hover {
    background-color: var(--notice-bg);
    border-color: var(--text-color);
}

.result-header {
    margin-bottom: 12px;
}

.page-number {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-hierarchy {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--light-border);
}

.hierarchy-item {
    margin-bottom: 5px;
    font-size: 15px;
}

.hierarchy-label {
    font-weight: 600;
    margin-right: 8px;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.result-content {
    line-height: 1.7;
    font-size: 15px;
}

.result-content .highlight {
    background-color: var(--text-color);
    color: var(--paper-bg);
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* Messages */
.search-error-message,
.no-results-message {
    text-align: center;
    padding: 20px;
    background-color: var(--abstract-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-style: italic;
    margin-bottom: 20px;
}

.no-results-message span {
    font-weight: 600;
    font-style: normal;
}

.result-limit-message {
    text-align: center;
    font-style: italic;
    opacity: 0.7;
    margin-top: 20px;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .search-ui-section {
        flex-direction: column;
    }
    
    .search-button {
        width: 100%;
    }
    
    .toc-section {
        padding: 15px;
    }
}
