/**
 * AI Tools & Search Styles
 * 
 * @package AI_Navigator
 * @since 2.8.0
 */

/* ===== Section Header ===== */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.section-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.1);
    flex-shrink: 0;
}

.section-icon svg {
    width: 18px;
    height: 18px;
    color: var(--color-primary);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.section-more {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
}

.section-more:hover { text-decoration: underline; }

/* ===== Tool Card Enhancements ===== */
.tool-card {
    position: relative;
    display: flex;
    flex-direction: column;
    text-decoration: none;
}

.tool-card-badges {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    gap: 4px;
    z-index: 1;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

.tool-badge-featured {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.tool-badge-hot {
    background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    color: white;
}

.tool-badge-new {
    background: #10B981;
    color: white;
}

.tool-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    padding-top: 12px;
}

.tool-pricing {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.tool-pricing-free {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
}

.tool-pricing-freemium {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.tool-pricing-paid {
    background: rgba(99, 102, 241, 0.1);
    color: #6366F1;
}

.tool-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.tool-rating svg {
    color: #FBBF24;
}

/* ===== Topbar Navigation - Scrollable ===== */
.topbar-tools {
    padding: 0 16px;
    gap: 16px;
}

.topbar-nav-wrapper {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    position: relative;
}

.topbar-nav-scrollable {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 0;
    flex: 1;
}

.topbar-nav-scrollable::-webkit-scrollbar { display: none; }

.topbar-nav-scrollable .topbar-link {
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-scroll-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition);
}

.topbar-scroll-btn:hover { background: var(--bg-hover); }
.topbar-scroll-btn svg { width: 16px; height: 16px; color: var(--text-secondary); }
.topbar-scroll-left { left: 0; }
.topbar-scroll-right { right: 0; }

/* ===== Search Box ===== */
#tool-search-box {
    position: relative;
    flex-shrink: 0;
}

.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-top: 8px;
    display: none;
    z-index: 100;
    max-height: 400px;
    overflow-y: auto;
}

.search-dropdown.active { display: block; }

.search-dropdown .search-results-list { padding: 8px; }

.search-dropdown .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition);
}

.search-dropdown .search-result-item:hover { background: var(--bg-hover); }

.search-dropdown .search-result-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.search-dropdown .search-result-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.search-dropdown .search-result-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.search-dropdown .search-result-info { flex: 1; min-width: 0; }

.search-dropdown .search-result-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-dropdown .search-result-category {
    font-size: 12px;
    color: var(--text-tertiary);
}

.search-loading,
.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

.search-view-all {
    display: block;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    color: var(--color-primary);
    border-top: 1px solid var(--border-light);
    text-decoration: none;
}

.search-view-all:hover { background: var(--bg-hover); }

/* ===== Tool Detail Page ===== */
.tool-detail-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 32px;
}

.tool-detail-main { min-width: 0; }

.tool-detail-header {
    display: flex;
    gap: 24px;
    padding: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.tool-detail-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.tool-detail-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-detail-icon svg {
    width: 48px;
    height: 48px;
    color: var(--text-tertiary);
}

.tool-detail-info {
    flex: 1;
    min-width: 200px;
}

.tool-detail-name {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-detail-tagline {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.tool-detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.tool-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.tool-detail-meta svg {
    width: 16px;
    height: 16px;
}

.tool-detail-rating svg {
    color: #FBBF24;
}

.tool-detail-actions {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-default);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-hover);
}

/* Tool Detail Sections */
.tool-detail-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 24px;
    margin-bottom: 24px;
}

.tool-detail-section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.tool-detail-description p {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tool-detail-description p:last-child {
    margin-bottom: 0;
}

/* Features Grid */
.tool-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.tool-feature-item {
    padding: 20px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
}

.tool-feature-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.tool-feature-icon svg {
    width: 20px;
    height: 20px;
    color: var(--color-primary);
}

.tool-feature-item h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.tool-feature-item p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

/* Tool Tags */
.tool-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tool-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.tool-tag:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Tool Sidebar */
.tool-detail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-sidebar-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    padding: 20px;
}

.tool-sidebar-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.tool-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-info-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.tool-info-label {
    color: var(--text-tertiary);
}

.tool-info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Related Tools */
.related-tools-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.related-tool-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin: -10px;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: var(--transition);
}

.related-tool-item:hover {
    background: var(--bg-hover);
}

.related-tool-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.related-tool-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-tool-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.related-tool-info {
    flex: 1;
    min-width: 0;
}

.related-tool-name {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.related-tool-category {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ===== Search Results Page ===== */
.search-box.large {
    width: 100%;
    max-width: 600px;
}

.search-box.large input {
    height: 44px;
    font-size: 15px;
}

.search-results-header {
    margin-bottom: 24px;
}

.search-results-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.search-results-title span {
    color: var(--color-primary);
}

.search-results-count {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Search Tabs */
.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-input);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.search-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.search-tab.active {
    background: var(--color-primary);
    color: white;
}

.tab-count {
    font-size: 11px;
    opacity: 0.8;
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 13px;
    color: var(--text-tertiary);
}

.filter-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

/* Search Results List */
.content > .search-results-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.content > .search-results-list > .search-result-item {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: var(--transition);
}

.content > .search-results-list > .search-result-item:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-sm);
}

.result-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.result-icon svg {
    width: 24px;
    height: 24px;
}

.result-icon.tool {
    background: #FEF3C7;
    color: #D97706;
}

.result-icon.post {
    background: #DBEAFE;
    color: #2563EB;
}

.result-icon.article {
    background: #D1FAE5;
    color: #059669;
}

.result-content {
    flex: 1;
    min-width: 0;
}

.result-type {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.result-title mark {
    background: #FEF3C7;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.result-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-description mark {
    background: #FEF3C7;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

.result-meta {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.result-meta svg {
    width: 14px;
    height: 14px;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.no-results svg {
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.no-results h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.no-results p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Search Empty */
.search-empty {
    text-align: center;
    padding: 80px 20px;
}

.search-empty svg {
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.search-empty h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.search-empty p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== Category Archive Page ===== */
.category-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
}

.category-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-icon svg {
    width: 32px;
    height: 32px;
    color: var(--color-primary);
}

.category-info {
    flex: 1;
}

.category-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.category-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.category-count {
    font-size: 13px;
    color: var(--text-tertiary);
}

.tools-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.tools-toolbar-left {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    font-size: 14px;
    color: var(--text-primary);
    text-decoration: none;
    transition: var(--transition);
}

.pagination-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-default);
}

.pagination-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

/* ===== Responsive ===== */
@media (max-width: 1200px) {
    .tool-detail-layout {
        grid-template-columns: 1fr;
    }
    
    .tool-detail-sidebar {
        order: -1;
    }
    
    .tool-features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tool-detail-header {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }
    
    .tool-detail-icon {
        margin: 0 auto;
    }
    
    .tool-detail-meta {
        justify-content: center;
    }
    
    .tool-detail-actions {
        justify-content: center;
    }
    
    .search-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .search-filters {
        flex-direction: column;
    }
    
    .category-header {
        flex-direction: column;
        text-align: center;
        padding: 24px;
    }
}
