/**
 * AI Tools Directory - Main Page Styles (Refined V3)
 * 
 * Isolated styles for the main directory page.
 * Restores React-style animations and refinements.
 * 
 * @package HyzenPro_AI_Tools
 * @since 2.3.0
 */

/* ==========================================================================
   HERO SECTION & SEARCH
   ========================================================================== */
.aid-directory-hero {
    background: #fff;
    padding: 2.5rem 1.5rem 1rem;
    /* Significantly reduced from 4rem */
    text-align: center;
}

.aid-directory-hero h1 {
    font-size: 3rem;
    font-weight: 900;
    color: #111;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
}

.aid-accent {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    background-clip: text;
    /* Theme primary gradient */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.aid-hero-desc {
    font-size: 1.125rem;
    color: #64748b;
    max-width: 650px;
    margin: 0 auto 1.25rem;
    /* Reduced margin */
    line-height: 1.6;
}

.aid-search-wrapper {
    max-width: 600px;
    margin: 0 auto;
}

.aid-search-inner {
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
    border-radius: 9999px;
}

.aid-search-inner i {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1.125rem;
}

.aid-directory-search {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 9999px;
    font-size: 1.0625rem;
    background: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.aid-directory-search:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* ==========================================================================
   MAIN DIRECTORY LAYOUT & RESPONSIVENESS
   ========================================================================== */
.aid-directory-page {
    min-height: 100vh;
    background: #fff;
    /* Clean white background */
    font-family: 'Inter', system-ui, sans-serif;
}

.aid-container {
    max-width: 1320px;
    /* Slightly tighter for better focus */
    margin: 0 auto;
    padding: 0 1.5rem;
}

.aid-directory-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    /* Slightly narrower sidebar */
    gap: 1.5rem;
    /* Reduced gap from 2.5rem */
    padding: 0.5rem 0 3rem;
    /* Reduced padding */
}

@media (max-width: 1200px) {
    .aid-directory-layout {
        grid-template-columns: 280px 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 991px) {
    .aid-directory-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .aid-directory-sidebar {
        display: none;
    }
}

/* ==========================================================================
   TOP BAR
   ========================================================================== */
.aid-directory-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem 0;
    /* Reduced padding */
    margin-bottom: 0;
    border-bottom: 1px solid #f1f5f9;
}

.aid-directory-count {
    font-size: 0.875rem;
    color: #64748b;
    font-weight: 500;
}

.aid-directory-count strong {
    color: #111;
}

.aid-directory-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Custom Sort Dropdown (Image 0 Fidelity) */
.aid-sort-wrapper {
    position: relative;
    min-width: 160px;
}

.aid-sort-toggle {
    width: 100%;
    height: 2.75rem;
    padding: 0 1rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #111;
    transition: all 0.2s ease;
}

.aid-sort-toggle:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.aid-sort-toggle i {
    font-size: 0.75rem;
    color: #94a3b8;
    transition: transform 0.3s ease;
}

.aid-sort-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.aid-sort-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 200px;
    /* Explicit width for stability */
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.875rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    list-style: none;
    z-index: 1000;
    /* Higher z-index */
    display: none;
    flex-direction: column;
    gap: 0.25rem;
}

.aid-sort-menu.show {
    display: flex;
    animation: aid-slide-down 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes aid-slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.aid-sort-option {
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.aid-sort-option:hover {
    background: #f1f5f9;
    color: #111;
}

.aid-sort-option.active {
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
}

/* ==========================================================================
   SIDEBAR & CATEGORY WIDGET (Final Match)
   ========================================================================== */
.aid-directory-sidebar {
    position: sticky;
    top: 90px;
    height: fit-content;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* Tightened sidebar gap */
}

.aid-sidebar-widget {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 1.25rem;
    padding: 1rem 0.625rem;
    /* Ultra-tight padding */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.aid-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    /* Slightly smaller */
    font-weight: 800;
    color: #111;
    margin-bottom: 0.75rem;
    /* Reduced margin */
    padding: 0 0.5rem;
}

/* Category List */
.aid-category-list,
.aid-pricing-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    /* Ultra-tight gap */
    margin: 0;
    padding: 0;
}

.aid-category-item,
.aid-pricing-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.625rem;
    /* Ultra-micro spacing */
    border-radius: 3rem;
    font-size: 0.8125rem;
    color: #111;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f8fafc;
    font-weight: 600;
}

.aid-category-item:hover,
.aid-pricing-item:hover {
    background: #f1f5f9;
}

.aid-category-item.active,
.aid-pricing-item.active {
    background: #111;
    color: #fff;
}

.aid-category-item.active .aid-cat-count {
    color: rgba(255, 255, 255, 0.9);
}

.aid-category-item .aid-cat-icon {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.aid-category-item .aid-cat-icon i {
    width: 1.25rem;
    text-align: center;
    font-size: 1rem;
    opacity: 0.9;
}

.aid-pricing-item .aid-active-indicator {
    width: 0.625rem;
    height: 0.625rem;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
}

.aid-pricing-item.active .aid-active-indicator {
    border-color: #fff;
    background: #fff;
    box-shadow: inset 0 0 0 2px #111;
}

.aid-cat-count {
    font-size: 0.8125rem;
    color: #475569;
    /* Darker grey for better contrast on light BG (WCAG AA+) */
    font-weight: 700;
}

.aid-directory-main {
    min-height: 600px;
    /* Prevent layout collapse when filtering */
}

.aid-animate-fade-in {
    animation: aidFadeInStagger 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ==========================================================================
   TOOL CARDS (Centered & Exact Match)
   ========================================================================== */
.aid-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

@media (max-width: 1250px) {
    .aid-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .aid-tools-grid {
        grid-template-columns: 1fr;
        padding-bottom: 3rem;
    }
}

.aid-tool-card {
    background: #fff;
    border: 1px solid #f1f5f9;
    border-radius: 1.5rem;
    padding: 0.75rem;
    /* Ultra-micro padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.125rem;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    height: auto;
    min-height: 340px;
    /* Reduced to 340px */
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.aid-tool-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 40px 80px -15px rgba(0, 0, 0, 0.12);
    border-color: #cbd5e1;
}

/* High Fidelity Effects */
.aid-card-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), transparent, rgba(168, 85, 247, 0.05));
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.aid-tool-card:hover .aid-card-gradient-overlay {
    opacity: 1;
}

.aid-card-shine {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.aid-tool-card:hover .aid-card-shine {
    opacity: 1;
}

.aid-card-shine::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-15deg);
    animation: aid-shine 2s infinite;
}

@keyframes aid-shine {
    0% {
        left: -100%;
    }

    50%,
    100% {
        left: 150%;
    }
}

/* Badges (Top Right - ChatGPT Style) */
.aid-card-badges {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.375rem;
    z-index: 10;
}

.aid-badge-trending {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    background: linear-gradient(135deg, #ff7e5f, #ff6b6b);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 800;
    border-radius: 2rem;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.aid-badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.75rem;
    background: #fff;
    color: #111;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 2rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Logo Section (High Fidelity) */
.aid-card-logo-wrapper {
    position: relative;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aid-card-logo-glow {
    position: absolute;
    inset: 0;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    opacity: 0.1;
    filter: blur(15px);
    transition: all 0.5s;
}

.aid-tool-card:hover .aid-card-logo-glow {
    transform: scale(1.4);
    opacity: 0.2;
}

.aid-card-logo-ring {
    position: absolute;
    inset: -9px;
    /* More pronounced halo */
    border-radius: 1.5rem;
    border: 2px dashed rgba(99, 102, 241, 0.7);
    /* Vivid blue/indigo */
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 1;
}

.aid-tool-card:hover .aid-card-logo-ring {
    opacity: 1;
    animation: aid-rotate-ring 3s linear infinite;
    /* Faster rotation */
}

@keyframes aid-rotate-ring {
    from {
        transform: rotate(0deg) scale(1.1);
    }

    to {
        transform: rotate(360deg) scale(1.1);
    }
}

.aid-card-logo {
    position: relative;
    width: 100%;
    /* Fill wrapper */
    height: 100%;
    border-radius: 1.125rem;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s;
    z-index: 2;
}

.aid-card-logo img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.aid-tool-card:hover .aid-card-logo {
    border-color: #6366f1;
    transform: scale(1.05);
}

.aid-card-header {
    width: 100%;
}

.aid-card-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    /* Slightly smaller for compactness */
    font-weight: 800;
    color: #111;
    margin: 0.125rem 0;
    letter-spacing: -0.02em;
}

.aid-card-rating {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.aid-card-stars {
    color: #f59e0b;
    /* Golden stars */
    display: flex;
    gap: 0.125rem;
}

.aid-card-rating-value {
    color: #111;
    font-weight: 700;
}

.aid-card-desc {
    font-size: 0.875rem;
    line-height: 1.5;
    /* Improved readability */
    color: #475569;
    /* Darker grey for better contrast */
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8rem;
    font-weight: 500;
}

.aid-card-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0;
}

.aid-card-tag {
    padding: 0.375rem 1rem;
    background: #f1f5f9;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.aid-card-separator {
    width: 90%;
    height: 1px;
    background: #f1f5f9;
    margin: 0.75rem auto 0.5rem;
}

/* Footer & Interactivity */
.aid-card-footer {
    width: 100%;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Micro gap */
}

.aid-card-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    /* Centered meta like Canva image */
}

.aid-pricing-badge {
    padding: 0.375rem 1rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: #eff6ff;
    color: #1d4ed8;
}

/* Light blue Theme */
.aid-pricing-badge.paid {
    background: #fffbeb;
    color: #b45309;
}

/* Light orange Theme */
.aid-pricing-badge.free {
    background: #ecfdf5;
    color: #047857;
}

/* Light green Theme */

.aid-card-views {
    font-size: 0.8125rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

/* Action Center (Canva Style) */
.aid-card-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    /* Reduced gap */
    width: 100%;
    padding-top: 0.25rem;
}

.aid-action-btn {
    height: 2.5rem;
    /* Reduced height */
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.aid-btn-like {
    padding: 0 0.75rem;
    border-radius: 0.875rem;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 800;
    flex: 1;
}

.aid-btn-bookmark {
    width: 2.5rem;
    border-radius: 0.875rem;
    font-size: 0.9375rem;
}

.aid-action-btn:hover {
    background: #fff;
    border-color: #111;
    transform: translateY(-2px);
}

.aid-view-btn {
    flex: 2;
    height: 2.5rem;
    background: #111;
    color: #fff;
    border-radius: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.875rem;
    font-size: 0.8125rem;
    font-weight: 800;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    min-width: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.aid-view-btn i {
    font-size: 0.875rem;
    margin-left: 0.625rem;
    transition: transform 0.3s;
}

.aid-view-btn:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.aid-view-btn:hover i {
    transform: translateX(4px);
}


/* ==========================================================================
   PULSE ANIMATION FOR TRENDING
   ========================================================================== */
@keyframes pulse-trending {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

.aid-badge-trending i {
    animation: pulse-trending 1.5s infinite;
}