/* ========================================
   TOOLS BY SUBCATEGORY - COMPACT CARD DESIGN
   Matching sample layout with premium dark theme
   ======================================== */

/* Main Section Container */
.tools-by-subcategory-section {
    padding: 6rem 2rem 4rem;
    background: var(--primary-bg);
    position: relative;
}

.subcategory-container {
    max-width: 1600px;
    margin: 0 auto;
}

/* Section Heading */
.section-heading-wrapper {
    text-align: center;
    margin-bottom: 3.5rem;
    padding: 0 2rem;
    animation: fadeInDown 0.8s ease-out;
}

.section-main-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #00d4ff, #00ff88, #00d4ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-main-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* =======================================
   CATEGORY CARD CONTAINER
   ======================================= */

.category-card-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Category Card */
.category-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.category-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.15);
    transform: translateY(-2px);
}

/* Category Header */
.category-header {
    padding: 0.9rem 1.1rem;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 255, 136, 0.05));
    border-bottom: 2px solid transparent;
    border-image: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary), var(--accent-tertiary));
    border-image-slice: 1;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.category-icon-wrapper {
    font-size: 1.2rem;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 7px;
    animation: subtlePulse 3s ease-in-out infinite;
}

.category-card:hover .category-icon-wrapper {
    animation: iconBounce 0.6s ease;
}

.category-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

/* Tools List inside Category Card */
.category-tools-list {
    padding: 0;
    margin: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Individual Tool Item */
.tool-list-item {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.1rem;
    border-bottom: 1px solid rgba(45, 51, 64, 0.5);
    transition: all 0.2s ease;
    position: relative;
}

.tool-list-item:last-child {
    border-bottom: none;
}

.tool-list-item:hover {
    background: rgba(0, 212, 255, 0.03);
}

.tool-list-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tool-list-item:hover::before {
    opacity: 1;
}

/* Tool Number Badge */
.tool-number {
    min-width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 0.7rem;
}

/* Tool Logo Container */
.tool-logo-small {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.7rem;
    transition: all 0.2s ease;
}

.tool-list-item:hover .tool-logo-small {
    transform: scale(1.1);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.tool-logo-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tool-logo-placeholder-small {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.1), rgba(0, 255, 136, 0.1));
}

/* Tool Info Row - Single Line Layout */
.tool-info-row {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow: hidden;
}

.tool-name-compact {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
    transition: color 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.tool-list-item:hover .tool-name-compact {
    color: var(--accent-primary);
}

/* Tool Badges Inline */
.tool-badges-inline {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-shrink: 0;
}

/* Legacy wrapper - kept for backwards compatibility */
.tool-name-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.tool-meta-inline {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-shrink: 0;
}

.tool-badge-mini {
    padding: 0.15rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.badge-mini-featured {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.2));
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-mini-trending {
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(255, 71, 87, 0.2));
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.badge-mini-popular {
    background: linear-gradient(135deg, rgba(0, 255, 136, 0.2), rgba(0, 208, 132, 0.2));
    color: var(--accent-secondary);
    border: 1px solid rgba(0, 255, 136, 0.3);
}

.badge-mini-price {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.badge-mini-free {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

/* Icon-Only Badges - Compact Design */
.tool-badge-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: help;
    flex-shrink: 0;
}

.badge-icon-featured {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(147, 51, 234, 0.15));
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
    animation: starRotate 4s linear infinite, starGlow 2s ease-in-out infinite;
}

.badge-icon-featured:hover {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(147, 51, 234, 0.25));
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(168, 85, 247, 0.5);
    animation: starRotate 2s linear infinite, starGlow 1s ease-in-out infinite;
}

.badge-icon-free {
    background: rgba(0, 255, 136, 0.1);
    color: var(--accent-secondary);
    border: 1px solid rgba(0, 255, 136, 0.3);
    font-size: 0.75rem;
    animation: priceShine 3s ease-in-out infinite;
}

.badge-icon-free:hover {
    background: rgba(0, 255, 136, 0.15);
    transform: scale(1.15) translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 255, 136, 0.4);
    animation: priceShine 1.5s ease-in-out infinite;
}

.badge-icon-premium {
    background: rgba(0, 212, 255, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
    font-size: 0.7rem;
    animation: premiumShimmer 3s ease-in-out infinite;
}

.badge-icon-premium:hover {
    background: rgba(0, 212, 255, 0.15);
    transform: scale(1.15) translateY(-1px);
    box-shadow: 0 3px 10px rgba(0, 212, 255, 0.4);
    animation: premiumShimmer 1.5s ease-in-out infinite;
}

/* View Link Icon */
.tool-view-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 5px;
    color: var(--accent-primary);
    font-size: 0.8rem;
    transition: all 0.2s ease;
    margin-left: 0.7rem;
    text-decoration: none;
}

.tool-view-icon:hover {
    background: var(--accent-primary);
    color: var(--primary-bg);
    border-color: var(--accent-primary);
    transform: translateX(2px);
}

/* Category Footer */
.category-footer {
    padding: 0.8rem 1.1rem;
    background: rgba(0, 212, 255, 0.02);
    border-top: 1px solid rgba(45, 51, 64, 0.5);
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
    justify-content: center;
}

/* View All Link */
.view-all-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.1rem;
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.view-all-link:hover {
    background: var(--accent-primary);
    color: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.view-all-text {
    font-weight: 700;
}

.view-all-count {
    opacity: 0.9;
    font-size: 0.75rem;
}

.view-all-arrow {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
}

.view-all-link:hover .view-all-arrow {
    transform: translateX(3px);
}

/* Legacy See More Link */
.see-more-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.see-more-link:hover {
    background: var(--accent-primary);
    color: var(--primary-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}

.see-more-arrow {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.see-more-link:hover .see-more-arrow {
    transform: translateX(3px);
}

/* Load More Button */
.load-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.2rem;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--primary-bg);
    border: none;
    border-radius: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: inherit;
}

.load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 212, 255, 0.4);
}

.load-more-text {
    font-weight: 700;
}

.load-more-count {
    opacity: 0.9;
    font-size: 0.75rem;
}

.load-more-arrow {
    font-size: 0.9rem;
    transition: transform 0.3s ease;
}

.load-more-btn:hover .load-more-arrow {
    transform: translateY(3px);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Load More Cards Button - Section Level */
.load-more-cards-wrapper {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
}

.load-more-cards-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 2rem;
    background: linear-gradient(135deg, #00d4ff, #00ff88);
    color: var(--primary-bg);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.load-more-cards-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.4);
}

.load-more-cards-btn:active {
    transform: translateY(-1px);
}

.load-more-cards-btn .load-more-arrow {
    font-size: 1.1rem;
}

.load-more-cards-btn:hover .load-more-arrow {
    transform: translateY(4px);
}

.load-more-cards-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Hidden Cards */
.hidden-card {
    display: none !important;
}

/* Hidden Tools - Legacy */
.hidden-tool {
    display: none !important;
}

/* =======================================
   RESPONSIVE DESIGN
   ======================================= */

@media (max-width: 1400px) {
    .category-card-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 1024px) {
    .category-card-wrapper {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .tools-by-subcategory-section {
        padding: 4rem 1rem 3rem;
    }

    .section-heading-wrapper {
        margin-bottom: 2.5rem;
        padding: 0;
    }

    .section-main-title {
        font-size: 1.75rem;
    }

    .section-main-subtitle {
        font-size: 0.95rem;
    }

    .category-card-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .tool-number {
        min-width: 28px;
        height: 28px;
        font-size: 0.8rem;
    }

    .tool-logo-small {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .tool-name-compact {
        font-size: 0.9rem;
    }
    
    .tool-badge-icon {
        width: 20px;
        height: 20px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .tools-by-subcategory-section {
        padding: 3rem 0.75rem 2rem;
    }
    
    .category-card-wrapper {
        gap: 0.875rem;
    }

    .tool-list-item {
        padding: 0.75rem 0.875rem;
    }

    .category-header {
        padding: 0.875rem 1rem;
    }

    .tool-number {
        display: none;
    }

    .tool-logo-small {
        margin-right: 0.75rem;
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .tool-name-compact {
        font-size: 0.9rem;
    }

    /* Keep badges visible on mobile - smaller size */
    .tool-badge-mini {
        font-size: 0.65rem;
        padding: 0.1rem 0.4rem;
    }

    .tool-badge-icon {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
    }
    
    .tool-badges-inline {
        gap: 0.25rem;
    }

    .tool-view-icon {
        width: 26px;
        height: 26px;
        font-size: 0.8rem;
        margin-left: 0.5rem;
    }

    .tool-meta-inline {
        gap: 0.3rem;
    }
}

/* =======================================
   SCROLL ANIMATIONS
   ======================================= */

.category-card {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =======================================
   BADGE & ICON ANIMATIONS
   ======================================= */

/* Featured Star Animation - Rotating with Glow */
@keyframes starRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes starGlow {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 2px rgba(168, 85, 247, 0.3));
    }
    50% {
        filter: brightness(1.3) drop-shadow(0 0 6px rgba(168, 85, 247, 0.6));
    }
}

/* Premium Badge Animation - Shimmer Effect */
@keyframes premiumShimmer {
    0%, 100% {
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.2);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 12px rgba(0, 212, 255, 0.4), inset 0 0 8px rgba(0, 212, 255, 0.1);
        filter: brightness(1.2);
    }
}

/* Free Badge Animation - Gentle Shine */
@keyframes priceShine {
    0%, 100% {
        box-shadow: 0 0 4px rgba(0, 255, 136, 0.2);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 10px rgba(0, 255, 136, 0.4), inset 0 0 6px rgba(0, 255, 136, 0.1);
        filter: brightness(1.2);
    }
}

/* Category Icon Animations */
@keyframes subtlePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(0, 212, 255, 0);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 8px rgba(0, 212, 255, 0.2);
    }
}

@keyframes iconBounce {
    0%, 100% {
        transform: scale(1) translateY(0);
    }
    25% {
        transform: scale(1.1) translateY(-3px);
    }
    50% {
        transform: scale(1.05) translateY(-1px);
    }
    75% {
        transform: scale(1.08) translateY(-2px);
    }
}

/* =======================================
   ACCESSIBILITY
   ======================================= */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.tool-view-icon:focus,
.see-more-link:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* =======================================
   HOVER STATE COUNT INDICATOR
   ======================================= */

.category-header::after {
    content: attr(data-count);
    padding: 0.2rem 0.5rem;
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-primary);
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 10px;
    margin-left: auto;
}
