/* ==========================================================================
   Controls - Buttons, Search, Filters, File Status
   ========================================================================== */

.controls {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* File Status */
.file-status {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    font-weight: 600;
}

.file-status.loading {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.file-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.file-status.error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #f0f0f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: #667eea;
    width: 0%;
    transition: width 0.3s ease;
}

/* Buttons */
.refresh-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: background-color 0.3s ease;
}

.refresh-btn:hover {
    background: #5a6fd8;
}

.refresh-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.stock-filter-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1rem;
    margin-left: 0.5rem;
    transition: background-color 0.3s ease;
}

.stock-filter-btn:hover {
    background: #218838;
}

.stock-filter-btn.active {
    background: #ffc107;
    color: #333;
}

.stock-filter-btn.active:hover {
    background: #e0a800;
}

.stock-filter-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.reset-filters-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1rem;
    margin-left: 0.5rem;
    transition: background-color 0.3s ease;
}

.reset-filters-btn:hover {
    background: #c82333;
}

.reset-filters-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Navigation Buttons */
.nav-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 1rem;
    margin-left: 0.5rem;
    transition: background-color 0.3s ease;
}

.nav-btn:hover {
    background: #5a6fd8;
}

.nav-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Search */
.search-container {
    position: relative;
}

.search-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
}

.search-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    pointer-events: none;
}

.search-debounce {
    color: #999;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Manufacturer Filter */
.manufacturer-filter-container {
    margin-top: 1rem;
}

.manufacturer-filter {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.manufacturer-filter:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Pagination */
.pagination-container {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: #666;
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: #5a6fd8;
}

.pagination-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.page-input {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
}

/* Top Keywords Section - Preferred Searches */
.top-keywords-section {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.top-keywords-section h3 {
    margin: 0 0 0.75rem 0;
    color: #667eea;
    font-size: 0.95rem;
    font-weight: 600;
}

#topKeywordsContainer {
    min-height: 40px;
    display: flex;
    align-items: center;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
}

.saved-search-btn-wrapper {
    display: inline-flex;
    align-items: center;
    background: white;
    border: 1.5px solid #667eea;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.saved-search-btn-wrapper:hover {
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.saved-search-btn {
    background: none;
    color: #667eea;
    border: none;
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.saved-search-btn:hover {
    background: #f0f4ff;
    transform: translateX(1px);
}

.delete-search-btn {
    background: transparent;
    color: #999;
    border: none;
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s ease;
    border-left: 1px solid #e0e0e0;
}

.delete-search-btn:hover {
    background: #f8f8f8;
    color: #dc3545;
}

/* Save Search Button */
.save-search-btn {
    background: none;
    color: #667eea;
    border: none;
    padding: 0;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 0.5rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.save-search-btn:hover {
    background: #f0f4ff;
    transform: scale(1.1);
}

.save-search-btn:active {
    transform: scale(0.95);
}

/* Responsive */
@media (max-width: 768px) {
    .keywords-list {
        gap: 0.4rem;
    }

    .saved-search-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .delete-search-btn {
        padding: 0.35rem 0.5rem;
    }
}