/* =============================================
   ToolszAI — All Tools Directory Page
   ============================================= */

/* === Page Hero === */
.page-hero {
    position: relative;
    padding: 130px 0 50px;
    text-align: center;
    overflow: hidden;
}

.page-hero-glow {
    position: absolute;
    top: -40%;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.12) 0%, transparent 65%);
    pointer-events: none;
}

.page-hero-content {
    position: relative;
    z-index: 1;
}

.page-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 17px;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.page-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.page-stat {
    text-align: center;
}

.page-stat-num {
    display: block;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

/* === Directory Layout === */
.tools-directory {
    padding: 40px 0 80px;
    position: relative;
    z-index: 1;
}

.directory-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 32px;
    align-items: start;
}

/* === Filter Sidebar === */
.filter-sidebar {
    position: sticky;
    top: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.filter-sidebar::-webkit-scrollbar {
    width: 4px;
}

.filter-sidebar::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.2);
    border-radius: 4px;
}

.filter-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.filter-sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 16px;
    font-weight: 700;
}

.filter-sidebar-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--primary-light);
}

.filter-reset {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.filter-reset:hover {
    color: var(--accent-light);
}

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

.filter-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

/* Search Input */
.filter-search {
    position: relative;
}

.filter-search svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.filter-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: var(--transition-normal);
}

.filter-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.filter-search input::placeholder {
    color: var(--text-muted);
}

/* Checkboxes */
.filter-options {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
    user-select: none;
}

.filter-checkbox:hover {
    background: rgba(124, 58, 237, 0.04);
}

.filter-checkbox input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    position: relative;
    transition: var(--transition-fast);
}

.filter-checkbox input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.filter-checkbox input:checked + .checkmark::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.filter-text {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.filter-count {
    font-size: 11px;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.04);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Rating Range */
.rating-filter {
    padding: 4px 0;
}

.rating-filter input[type="range"] {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    margin-bottom: 10px;
}

.rating-filter input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.rating-filter-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-stars-small {
    font-size: 14px;
    color: #f59e0b;
}

.rating-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Select */
.filter-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    -webkit-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='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.filter-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

.filter-close-mobile {
    display: none;
}

/* === Top Bar === */
.directory-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-filter-btn {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mobile-filter-btn svg {
    width: 14px;
    height: 14px;
}

.mobile-filter-btn:hover {
    border-color: var(--primary);
}

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

.results-count span {
    font-weight: 700;
    color: var(--text-primary);
}

.view-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
}

.view-btn {
    padding: 6px 10px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

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

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

.view-btn:hover:not(.active) {
    color: var(--text-primary);
}

/* === Active Filters === */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
    min-height: 0;
}

.active-filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-light);
}

.active-filter-tag button {
    background: none;
    border: none;
    color: var(--primary-light);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: var(--transition-fast);
}

.active-filter-tag button:hover {
    opacity: 1;
}

/* === Grid View === */
.directory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* === List View === */
.directory-grid.list-view {
    grid-template-columns: 1fr;
    gap: 12px;
}

.directory-grid.list-view .dir-tool-card {
    flex-direction: row;
    align-items: center;
    padding: 16px 24px;
    gap: 20px;
}

.directory-grid.list-view .dir-card-top {
    margin-bottom: 0;
}

.directory-grid.list-view .dir-tool-logo {
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 12px;
}

.directory-grid.list-view .dir-card-badges {
    display: none;
}

.directory-grid.list-view .dir-tool-name {
    font-size: 16px;
    margin-bottom: 2px;
    min-width: 140px;
}

.directory-grid.list-view .dir-tool-desc {
    flex: 1;
    margin-bottom: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.directory-grid.list-view .dir-tool-rating {
    margin-bottom: 0;
    flex-shrink: 0;
}

.directory-grid.list-view .dir-tool-platforms {
    display: none;
}

.directory-grid.list-view .dir-view-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    font-size: 13px;
}

/* === Tool Card (Directory) === */
.dir-tool-card {
    position: relative;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    overflow: hidden;
}

.dir-card-glow {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, rgba(124, 58, 237, 0.06) 0%, transparent 60%);
    opacity: 0;
    transition: var(--transition-slow);
    pointer-events: none;
}

.dir-tool-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    background: var(--bg-card-hover);
}

.dir-tool-card:hover .dir-card-glow {
    opacity: 1;
}

.dir-tool-card.hidden {
    display: none;
}

.dir-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 14px;
}

.dir-tool-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 800;
    color: white;
    font-family: 'Space Grotesk', sans-serif;
    flex-shrink: 0;
    transition: var(--transition-normal);
}

.dir-tool-card:hover .dir-tool-logo {
    transform: scale(1.05);
}

.dir-card-badges {
    display: flex;
    gap: 6px;
}

.dir-badge-free {
    padding: 3px 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    color: var(--neon-green);
    text-transform: uppercase;
}

.dir-badge-paid {
    padding: 3px 8px;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 700;
    color: #f97316;
    text-transform: uppercase;
}

.dir-badge-cat {
    padding: 3px 8px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    color: var(--primary-light);
    text-transform: uppercase;
}

.dir-tool-name {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.dir-tool-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
    flex-grow: 1;
}

.dir-tool-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.dir-stars {
    color: #f59e0b;
    font-size: 14px;
    letter-spacing: 1px;
}

.dir-rating-num {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.dir-tool-platforms {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.dir-tool-platforms span {
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.dir-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    color: var(--primary-light);
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition-normal);
    width: fit-content;
}

.dir-view-btn svg {
    width: 14px;
    height: 14px;
    transition: var(--transition-fast);
}

.dir-view-btn:hover {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.dir-view-btn:hover svg {
    transform: translateX(3px);
}

/* === No Results === */
.no-results {
    text-align: center;
    padding: 80px 20px;
}

.no-results-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.no-results h3 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

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

/* === Active Nav Link === */
.nav-link.active {
    color: var(--primary-light);
    background: rgba(124, 58, 237, 0.1);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .directory-layout {
        grid-template-columns: 1fr;
    }

    .filter-sidebar {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 2000;
        border-radius: 0;
        max-height: 100vh;
        padding: 24px;
        padding-bottom: 80px;
    }

    .filter-sidebar.open {
        display: block;
    }

    .mobile-filter-btn {
        display: flex;
    }

    .filter-close-mobile {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        background: var(--gradient-primary);
        color: white;
        border: none;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        z-index: 2001;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .page-hero {
        padding: 120px 0 40px;
    }

    .page-stats {
        gap: 24px;
    }

    .directory-grid {
        grid-template-columns: 1fr;
    }

    .directory-grid.list-view .dir-tool-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .directory-grid.list-view .dir-tool-desc {
        -webkit-line-clamp: 2;
    }
}
