/* ==========================================================================
   Tools Page Styles - Figma 2846-5805
   ========================================================================== */

/* ==========================================================================
   Tools Hero Section
   ========================================================================== */

.tools-hero {
    position: relative;
    background: transparent; /* Single BG layer via ::before only */
    padding: 140px 0 80px; /* Adjusted: header now at top:0, more bottom padding for BG breathing room */
    overflow: hidden;
    border-bottom-left-radius: 65px;
    border-bottom-right-radius: 65px;
}

.tools-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 110, 253, 0.1);
    backdrop-filter: blur(50px);
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 0 0 65px 65px;
    z-index: 0;
}

/* Decorative Spots */
.tools-hero-decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.tools-hero-spot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(13, 110, 253, 0.3) 0%, rgba(13, 110, 253, 0.1) 40%, transparent 70%);
    filter: blur(60px);
}

.tools-hero-spot.spot-1 {
    width: 606px;
    height: 606px;
    top: -196px;
    right: -100px;
}

.tools-hero-spot.spot-2 {
    width: 412px;
    height: 412px;
    top: 50px;
    left: -37px;
}

/* Hero Content */
.tools-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.tools-hero-title {
    font-size: 48px;
    font-weight: var(--font-bold);
    line-height: 60px;
    color: var(--color-black);
    margin-bottom: 23px;
}

.tools-hero-subtitle {
    font-size: 20px;
    font-weight: var(--font-medium);
    line-height: 30px;
    color: var(--color-text-light);
    max-width: 778px;
    margin: 0 auto 46px;
}

/* Search Bar */
.tools-search-wrapper {
    position: relative;
    max-width: 777px;
    margin: 0 auto;
}

.tools-search-input {
    width: 100%;
    height: 56px;
    padding: 0 60px 0 24px;
    font-size: 16px;
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 127px;
    outline: none;
    transition: all 0.3s ease;
}

.tools-search-input::placeholder {
    color: #adadad;
}

.tools-search-input:focus {
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

.tools-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.tools-search-btn:hover {
    background: #0b5ed7;
}

/* ==========================================================================
   Category Filter Section
   ========================================================================== */

.tools-filters {
    padding: 60px 0 40px; /* More top padding to push category filter down */
    overflow: hidden; /* Prevent filter overflow from causing page scroll */
}

.category-filter {
    position: relative;
    display: flex;
    justify-content: center;
    gap: 0;
    background: #f0f3f7;
    border-radius: 56px;
    padding: 5px;
    max-width: 549px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Hide scrollbar for category filter */
.category-filter::-webkit-scrollbar {
    display: none;
}

/* Sliding indicator that moves behind active button */
.filter-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    height: calc(100% - 10px);
    background: white;
    border: 1px solid rgba(255, 255, 255, 1);
    border-radius: 1000px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 0;
}

.filter-btn {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px;
    font-size: 16px;
    font-weight: var(--font-medium);
    font-family: var(--font-primary);
    color: #717171;
    background: transparent;
    border: none;
    border-radius: 1000px;
    cursor: pointer;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.filter-btn svg {
    width: 14px;
    height: 13px;
    flex-shrink: 0;
}

.filter-icon-letter {
    font-size: 12px;
    font-weight: var(--font-semibold);
    color: currentColor;
    width: 8px;
    height: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.filter-btn.active {
    color: var(--color-text);
    /* Background handled by .filter-indicator sliding element */
}

/* ==========================================================================
   Tools Grid Section
   ========================================================================== */

.tools-listing {
    padding: 40px 0 80px;
}

.tools-listing .tools-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 46px;
}

/* ==========================================================================
   Tool Card
   ========================================================================== */

.tool-card {
    background: #f9fbff;
    border: 1px solid #d7d9e2;
    border-radius: 13px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.tool-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-4px);
    border-color: var(--color-primary-border);
}

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

/* Tool Preview/Screenshot */
.tool-card-preview {
    position: relative;
    width: 100%;
    padding-top: 69.76%; /* 263/377 = 0.6976 - fallback for aspect-ratio */
    aspect-ratio: 377 / 263;
    background: linear-gradient(135deg, #f0f4f8 0%, #e8eef3 100%);
    overflow: hidden;
}

.tool-card-screenshot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.tool-card-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e8f4fc 0%, #d4e8f7 100%);
    border-bottom: 1px solid #d7d9e2;
}

.tool-card-placeholder span {
    font-size: 18px;
    font-weight: var(--font-semibold);
    color: #4a90d9;
    text-transform: none;
    padding: 20px;
    text-align: center;
    line-height: 1.3;
}

/* Hover Overlay */
.tool-card-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.6) 60%, transparent 100%);
    padding: 20px 16px 16px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 60%;
}

.tool-card:hover .tool-card-overlay {
    transform: translateY(0);
}

.tool-card-overlay-content {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.tool-card:hover .tool-card-overlay-content {
    opacity: 1;
    transform: translateY(0);
}

.tool-card-description {
    font-size: 13px;
    font-weight: var(--font-regular);
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tool-feature-tag {
    font-size: 11px;
    font-weight: var(--font-medium);
    color: white;
    background: rgba(13, 110, 253, 0.8);
    padding: 4px 10px;
    border-radius: 20px;
}

/* Tool Info */
.tool-card-info {
    padding: 24px;
}

.tool-card-title {
    font-size: 25px;
    font-weight: var(--font-bold);
    color: var(--color-black);
    margin-bottom: 8px;
}

.tool-card-price {
    font-size: 0; /* Hide any text nodes (long excerpts) */
    font-weight: var(--font-bold);
    color: var(--color-black);
    margin-bottom: 24px;
    line-height: 1.2;
}

/* Style for price spans - handles HTML like "excerpt text <span>$5/month</span>" */
/* Only the span content is visible due to font-size: 0 on parent */
.tool-card-price span {
    font-size: 36px;
    font-weight: var(--font-bold);
    color: var(--color-black);
}

/* Price period styling (e.g., "/month") */
.tool-card-price span.price-period {
    font-size: 20px;
    font-weight: var(--font-medium);
    color: var(--color-text-light);
}

.tool-card-price .price-amount {
    font-size: 36px;
    font-weight: var(--font-bold);
}

.tool-card-price .price-period {
    font-size: 20px;
    font-weight: var(--font-medium);
    color: var(--color-text-light);
}

/* Subscribe Button */
.btn-subscribe {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 7px 16px;
    font-size: 16px;
    font-weight: var(--font-bold);
    font-family: var(--font-primary);
    color: var(--color-text-light);
    background: #f0f3f7;
    border: none;
    border-radius: 10px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* ==========================================================================
   No Results Message
   ========================================================================== */

.tools-no-results {
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-muted);
}

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

.tools-no-results h3 {
    font-size: 24px;
    font-weight: var(--font-semibold);
    color: var(--color-text);
    margin-bottom: 8px;
}

.tools-no-results p {
    font-size: 16px;
    color: var(--color-text-muted);
}

.tools-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    font-size: 18px;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Tools Footer
   ========================================================================== */

.tools-footer {
    padding: 0 0 40px;
}

.tools-footer .container {
    background: #f0f6ff;
    border-radius: 20px;
    padding: 17px 30px;
}

.tools-footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tools-footer-language {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    background: #cce0ff;
    border-radius: 10px;
    font-size: 16px;
    font-weight: var(--font-medium);
    color: var(--color-black);
    cursor: pointer;
}

.tools-footer-language img {
    border-radius: 4px;
}

.tools-footer-language svg {
    margin-left: 8px;
}

.tools-footer-copyright {
    font-size: 16px;
    font-weight: var(--font-medium);
    color: var(--color-text-light);
}

/* ==========================================================================
   Responsive - Tablet
   ========================================================================== */

@media (max-width: 1024px) {
    .tools-listing .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .tools-hero-title {
        font-size: 40px;
        line-height: 50px;
    }

    .category-filter {
        max-width: 100%;
        justify-content: flex-start;
        padding: 5px 10px;
    }

    .filter-btn {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Responsive - Mobile
   ========================================================================== */

@media (max-width: 768px) {
    .tools-hero {
        padding: 100px 0 50px; /* Adjusted for header at top:0 */
        border-bottom-left-radius: 30px;
        border-bottom-right-radius: 30px;
    }

    .tools-hero::before {
        border-radius: 0 0 30px 30px;
    }

    .tools-hero-title {
        font-size: 32px;
        line-height: 40px;
    }

    .tools-hero-subtitle {
        font-size: 16px;
        line-height: 24px;
        margin-bottom: 30px;
    }

    .tools-search-input {
        height: 50px;
        font-size: 14px;
    }

    .tools-listing .tools-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .tools-filters {
        padding: 40px 0 30px; /* Adjusted category spacing for mobile */
    }

    .tools-listing {
        padding: 20px 0 60px;
    }

    .tool-card-title {
        font-size: 20px;
    }

    .tool-card-price {
        font-size: 0; /* Keep excerpt text hidden on mobile too */
    }

    .tool-card-price span {
        font-size: 28px;
    }

    .tool-card-price .price-amount {
        font-size: 28px;
    }

    .tool-card-price .price-period {
        font-size: 16px;
    }

    .tools-footer-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .tools-footer-copyright {
        font-size: 14px;
    }
}

/* ==========================================================================
   Responsive - Small Mobile
   ========================================================================== */

@media (max-width: 480px) {
    .tools-hero-title {
        font-size: 28px;
        line-height: 36px;
    }

    .tools-hero-spot.spot-1 {
        width: 300px;
        height: 300px;
    }

    .tools-hero-spot.spot-2 {
        width: 200px;
        height: 200px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

body.dark-mode .tools-hero {
    background: var(--color-bg);
}

body.dark-mode .tools-hero::before {
    background: rgba(13, 110, 253, 0.05);
}

body.dark-mode .tools-hero-title {
    color: var(--color-white);
}

body.dark-mode .tools-hero-subtitle {
    color: var(--color-text-muted);
}

body.dark-mode .tools-search-input {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--color-white);
}

body.dark-mode .tools-search-input::placeholder {
    color: #666;
}

body.dark-mode .category-filter {
    background: rgba(30, 30, 30, 0.8);
}

body.dark-mode .filter-btn {
    color: var(--color-text-muted);
}

body.dark-mode .filter-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--color-white);
}

body.dark-mode .tool-card {
    background: #1e1e1e;
    border-color: #333;
}

body.dark-mode .tool-card-title {
    color: var(--color-white);
}

body.dark-mode .tool-card-price span {
    color: var(--color-white);
}

body.dark-mode .btn-subscribe {
    background: #2a2a2a;
    color: #ccc;
}

body.dark-mode .btn-subscribe:hover {
    background: var(--color-primary);
    color: var(--color-white);
}

body.dark-mode .tools-footer .container {
    background: rgba(13, 110, 253, 0.1);
}

body.dark-mode .tools-footer-language {
    background: rgba(13, 110, 253, 0.2);
    color: var(--color-white);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.hidden {
    display: none !important;
}

/* Screen reader only - for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Tool Card Animations
   ========================================================================== */

.tool-card.fade-in {
    animation: toolCardFadeIn 0.3s ease forwards;
}

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

/* ==========================================================================
   Tool Card Expanded State (Plan Selection)
   ========================================================================== */

/* When card is expanded, hide the preview and show plans panel */
.tool-card.expanded .tool-card-preview {
    display: none;
}

.tool-card.expanded .tool-card-plans {
    display: block !important;
}

/* Plans Panel inside tool card */
.tool-card-plans {
    padding: 20px;
    background: var(--color-white);
}

/* Custom Pill Dropdown */
.tool-card-plan-dropdown-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.tool-card-plan-dropdown-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px 16px;
    background: var(--color-white);
    border: 1px solid #e5e7eb;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tool-card-plan-dropdown-btn:hover {
    border-color: #d1d5db;
}

.tool-card-plan-dropdown-wrapper.open .tool-card-plan-dropdown-btn {
    border-color: var(--color-primary);
}

.tool-card-plan-name {
    font-size: 16px;
    font-weight: var(--font-semibold);
    color: var(--color-black);
}

.dropdown-icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #f3f4f6;
    border-radius: 50%;
    color: #6b7280;
    transition: transform 0.2s ease;
}

.tool-card-plan-dropdown-wrapper.open .dropdown-icon-circle {
    transform: rotate(180deg);
}

/* Dropdown List */
.tool-card-plan-dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--color-white);
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 8px;
    list-style: none;
    margin: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.tool-card-plan-dropdown-wrapper.open .tool-card-plan-dropdown-list {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.tool-card-plan-dropdown-list li {
    padding: 12px 16px;
    font-size: 15px;
    font-weight: var(--font-medium);
    color: var(--color-text);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.tool-card-plan-dropdown-list li:hover {
    background: #f9fafb;
}

.tool-card-plan-dropdown-list li.active {
    background: #f0f9ff;
    color: var(--color-primary);
}

.tool-card-plan-description {
    font-size: 14px;
    color: var(--color-text-light);
    line-height: 1.5;
    margin-bottom: 16px;
}

.tool-card-plan-features {
    margin-bottom: 16px;
}

.tool-card-plan-features .features-label {
    font-size: 13px;
    color: var(--color-text-light);
    margin-bottom: 10px;
}

.tool-card-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tool-card-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    margin-bottom: 6px;
    line-height: 1.4;
}

.tool-card-features-list .feature-check {
    color: #10b981;
    font-weight: bold;
    flex-shrink: 0;
}

.tool-card-plan-price {
    text-align: center;
    margin-top: 16px;
}

.tool-card-plan-price .plan-price-amount {
    font-size: 28px;
    font-weight: var(--font-bold);
    color: var(--color-black);
}

.tool-card-plan-price .price-period {
    font-size: 16px;
    font-weight: var(--font-medium);
    color: var(--color-text-light);
}

/* Hide info section when card is expanded (price shown in plans panel) */
.tool-card.expanded .tool-card-info .tool-card-price {
    display: none;
}
