/* style.css */

:root {
    --bg-dark: #1a1a1a;
    --bg-darker: #121212;
    --bg-card: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --accent: #4a9eff;
    --accent-hover: #3a8eef;
    --border: #3a3a3a;
    --success: #4caf50;
    --warning: #ff9800;
    --error: #f44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* Tab Navigation */
.tab-navigation {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 15px 30px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Search Section */
.search-section {
    min-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

.search-section.compact {
    min-height: auto;
    padding: 20px;
}

.search-header {
    text-align: center;
    margin-bottom: 40px;
}

.search-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent) 0%, #9c27b0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.search-container {
    width: 100%;
    max-width: 800px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1rem;
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-color: var(--accent);
}

.search-button {
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.1s;
}

.search-button:hover {
    background-color: var(--accent-hover);
}

.search-button:active {
    transform: scale(0.98);
}

.search-button:disabled {
    background-color: var(--border);
    cursor: not-allowed;
}

/* Filters */
.filters-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.filters-toggle button {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.filters-toggle button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filters-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: none;
}

.filters-panel.open {
    display: block;
}

.filter-group {
    margin-bottom: 20px;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.filter-group select,
.filter-group input[type="text"],
.filter-group input[type="number"] {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1rem;
}

.filter-group input::placeholder {
    color: #666;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Searchable Dropdowns */
.dropdown-container {
    position: relative;
}

.dropdown-search {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 6px 6px 0 0;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.dropdown-search:focus {
    border-color: var(--accent);
}

.dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--bg-darker);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 1000;
}

.dropdown-list.open {
    display: block;
}

.dropdown-item {
    padding: 10px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: var(--bg-card);
}

.dropdown-item.selected {
    background-color: var(--accent);
    color: white;
}

.selected-items,
.selected-author {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    min-height: 20px;
}

.selected-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background-color: var(--accent);
    color: white;
    border-radius: 4px;
    font-size: 0.9rem;
}

.selected-chip .remove {
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
}

.selected-chip .remove:hover {
    color: var(--error);
}

/* Results Section */
.results-section {
    display: none;
    margin-top: 40px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.results-section.visible {
    display: block;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border);
}

.results-info {
    color: var(--text-secondary);
}

.results-info strong {
    color: var(--text-primary);
}

.clear-results {
    padding: 8px 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.clear-results:hover {
    background-color: var(--bg-darker);
    border-color: var(--accent);
    color: var(--accent);
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.result-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: border-color 0.3s, transform 0.2s;
}

.result-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

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

.result-title {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.result-title a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.result-title a:hover {
    color: var(--accent-hover);
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.result-author a {
    color: var(--text-secondary);
    text-decoration: none;
}

.result-author a:hover {
    color: var(--accent);
}

.result-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 15px 0;
    padding: 12px;
    background-color: var(--bg-darker);
    border-radius: 6px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.stat-label {
    color: var(--text-secondary);
}

.stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.tag {
    padding: 4px 10px;
    background-color: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading-spinner {
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error */
.error-message {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--error);
    border-radius: 6px;
    padding: 15px;
    margin: 20px 0;
    color: var(--error);
}

/* Responsive */
@media (max-width: 768px) {
    .search-header h1 {
        font-size: 2rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-button {
        width: 100%;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .result-meta {
        flex-direction: column;
        gap: 8px;
    }
    
    .download-box {
        flex-direction: column;
    }
    
    .download-button {
        width: 100%;
    }
    
    .download-header h1 {
        font-size: 2rem;
    }
}

/* Download Section */
#download-section {
    min-height: calc(100vh - 120px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
}

#download-section.active {
    display: flex;
}

.download-header {
    text-align: center;
    margin-bottom: 40px;
}

.download-header h1 {
    font-size: 2em;
    margin-bottom: 10px;
}

.download-header p {
    color: var(--text-secondary);
    font-size: 1em;
}

.download-container {
    max-width: 800px;
    width: 100%;
}

.download-box {
    display: flex;
    gap: 15px;
    margin-bottom: 40px;
}

.download-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    background-color: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.download-input:focus {
    outline: none;
    border-color: var(--accent);
}

.download-button {
    padding: 15px 40px;
    font-size: 16px;
    font-weight: 600;
    background-color: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.download-button:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.download-button:disabled {
    background-color: var(--border);
    cursor: not-allowed;
    transform: none;
}

.download-info {
    background-color: var(--bg-card);
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.download-info h3 {
    margin-bottom: 15px;
    color: var(--accent);
}

.download-info ul {
    list-style: none;
    margin-bottom: 20px;
}

.download-info ul li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.download-info ul li:last-child {
    border-bottom: none;
}

.info-note {
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
}

.download-status {
    padding: 15px 20px;
    border-radius: 8px;
    margin-top: 20px;
    display: none;
}

.download-status.show {
    display: block;
}

.download-status.success {
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.download-status.error {
    background-color: rgba(244, 67, 54, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.download-status.loading {
    background-color: rgba(74, 158, 255, 0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
}

