/**
 * Central CSS for Keyword Research Filters & Export System
 * Used by all keyword research tools: Keyword Ideas, Keywords by URL, Search Volume Global, Search Volume Local
 */

/* Sortable table headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable:hover {
    background-color: rgba(27, 49, 255, 0.3);
}

.sortable i {
    margin-left: 5px;
    opacity: 0.7;
}

.sortable:hover i {
    opacity: 1;
}

/* Pagination styling */
.pagination .page-link {
    color: #1b31ff;
    border-color: #dee2e6;
    background-color: #fff;
}

.pagination .page-item.active .page-link {
    background-color: #1b31ff;
    border-color: #1b31ff;
    color: #fff;
}

.pagination .page-link:hover {
    color: #fff;
    background-color: #1b31ff;
    border-color: #1b31ff;
}

/* Filter section styling */
#filterSection {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
    position: sticky;
    top: 60px; /* Adjust based on sticky header height */
    z-index: 998;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#filterSection .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

#filterSection .form-control {
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

#filterSection .form-control:focus {
    border-color: #1b31ff;
    box-shadow: 0 0 0 0.2rem rgba(27, 49, 255, 0.25);
}

/* Filter buttons */
#applyFilters {
    background-color: #1b31ff;
    border-color: #1b31ff;
}

#applyFilters:hover {
    background-color: #0d1ecc;
    border-color: #0d1ecc;
}

#clearFilters {
    color: #6c757d;
    border-color: #6c757d;
}

#clearFilters:hover {
    color: #495057;
    border-color: #495057;
    background-color: #f8f9fa;
}

/* Filter toggle button */
#showFilters {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

#showFilters:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

/* Selection buttons */
#selectAll {
    color: #1b31ff;
    border-color: #1b31ff;
}

#selectAll:hover {
    background-color: #1b31ff;
    color: white;
}

#deselectAll {
    color: #6c757d;
    border-color: #6c757d;
}

#deselectAll:hover {
    background-color: #6c757d;
    color: white;
}

/* Export button */
#exportCsv {
    color: #6c757d;
    border-color: #6c757d;
}

#exportCsv:not(:disabled):hover {
    background-color: #6c757d;
    color: white;
}

#exportCsv:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Table styling */
#resultsTable {
    margin-bottom: 0;
}

#resultsTable thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

/* Table headers - static (not sticky) */
#resultsTable {
    margin-bottom: 0;
}

#resultsTable thead th {
    background-color: #343a40 !important;
    color: white !important;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    padding: 0.75rem;
}

#resultsTable tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Checkbox styling */
.keyword-checkbox {
    cursor: pointer;
}

#selectAllCheckbox {
    cursor: pointer;
}

/* Keyword click-to-select styles */
#resultsTableBody tr td:nth-child(2) {
    cursor: pointer;
    transition: background-color 0.2s ease;
    user-select: none;
}

#resultsTableBody tr td:nth-child(2):hover {
    background-color: rgba(27, 49, 255, 0.1);
}

/* Responsive design */
@media (max-width: 768px) {
    .d-flex.flex-wrap {
        flex-direction: column;
    }
    
    .d-flex.flex-wrap > div {
        margin-bottom: 0.5rem;
        margin-right: 0 !important;
    }
    
    #filterSection .row > div {
        margin-bottom: 1rem;
    }
    
    #filterSection .d-flex.gap-2 {
        justify-content: center;
    }
    
    /* Adjust sticky positions for mobile */
    .card-header.sticky-header {
        top: 0;
    }
    
    #filterSection {
        top: 50px;
    }
    
}

/* Vertical tool navigation - compact design */
.tool-navigation {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: all 0.3s ease;
}

.tool-nav-item {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
    padding: 12px 8px;
    border-radius: 8px 0 0 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    width: 30px;
    height: 80px;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    overflow: hidden;
    white-space: nowrap;
}

.tool-navigation:hover .tool-nav-item {
    width: 140px;
    padding: 12px 18px;
    font-size: 16px;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    transform: translateX(-5px);
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.3);
}

.tool-nav-item:hover {
    text-decoration: none;
    color: white;
}

.tool-nav-item.active {
    border-left-color: #28a745;
    background: linear-gradient(135deg, #28a745, #20c997);
    width: 140px;
    padding: 12px 18px;
    font-size: 16px;
    writing-mode: horizontal-tb;
    text-orientation: initial;
}

/* Different colors for each tool */
.tool-nav-item.keyword-ideas {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.tool-nav-item.keyword-ideas:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
}

.tool-nav-item.keyword-ideas-url {
    background: linear-gradient(135deg, #6f42c1, #5a32a3);
}

.tool-nav-item.keyword-ideas-url:hover {
    background: linear-gradient(135deg, #5a32a3, #4c2a85);
}

.tool-nav-item.search_volume_global {
    background: linear-gradient(135deg, #fd7e14, #e55a00);
}

.tool-nav-item.search_volume_global:hover {
    background: linear-gradient(135deg, #e55a00, #cc4e00);
}

.tool-nav-item.search_volume_local {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.tool-nav-item.search_volume_local:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .tool-navigation {
        right: 0;
        gap: 2px;
    }
    
    .tool-nav-item {
        width: 25px;
        height: 70px;
        font-size: 12px;
        padding: 10px 6px;
    }
    
    .tool-navigation:hover .tool-nav-item {
        width: 120px;
        padding: 10px 15px;
        font-size: 14px;
        writing-mode: horizontal-tb;
        text-orientation: initial;
    }
    
    .tool-nav-item.active {
        width: 120px;
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
    font-style: italic;
}

/* Entries info styling */
#entriesInfo {
    color: #6c757d;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Filter section animation */
#filterSection {
    transition: all 0.3s ease-in-out;
}

/* Button group styling */
.btn-group-sm > .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Form control sizing */
.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

.form-select-sm {
    padding: 0.25rem 2.25rem 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* Card header styling */
.card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Sticky header for search and options */
.card-header.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table responsive wrapper */
.table-responsive {
    border-radius: 0.375rem;
    position: relative;
}


/* Pagination wrapper */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .pagination-wrapper {
        flex-direction: column;
        gap: 1rem;
    }
    
    .pagination {
        margin-bottom: 0;
    }
}
