/**
 * WP Tools Directory - Public Styles
 * Clean white cards with subtle styling
 *
 * @package WP_Tools_Directory
 * @since 1.0.0
 */

/* ==========================================================================
   Tools Directory Container
   ========================================================================== */

.wtd-tools-directory {
    display: flex;
    gap: 40px;
    margin: 40px 0;
    font-family: inherit;
    align-items: flex-start;
    position: relative;
}

/* ==========================================================================
   Mobile Filter Toggle Button (Burger Menu)
   ========================================================================== */

.wtd-filter-toggle-btn {
    display: none; /* Hidden on desktop */
    align-items: center;
    gap: 10px;
    background: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    position: relative;
    z-index: 100;
}

.wtd-filter-toggle-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.wtd-filter-toggle-btn:active {
    transform: translateY(0);
}

/* Burger Icon */
.wtd-burger-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 22px;
    height: 18px;
}

.wtd-burger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.wtd-filter-toggle-btn.active .wtd-burger-icon span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.wtd-filter-toggle-btn.active .wtd-burger-icon span:nth-child(2) {
    opacity: 0;
}

.wtd-filter-toggle-btn.active .wtd-burger-icon span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Filter Sidebar (Left)
   ========================================================================== */

.wtd-filters-sidebar {
    flex: 0 0 280px;
    background: #ffffff !important;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    height: fit-content;
    transition: all 0.3s ease;
    position: relative;
}

/* Sidebar Header (with close button for mobile) */
.wtd-filters-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f3f4f6;
}

.wtd-filters-sidebar-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* Close Button (hidden on desktop) */
.wtd-close-filters {
    display: none;
    width: 36px;
    height: 36px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    color: #6b7280;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    align-items: center;
    justify-content: center;
}

.wtd-close-filters:hover {
    background: #e5e7eb;
    color: #374151;
}

/* Filter Actions */
.wtd-filters-actions {
    margin-bottom: 24px;
}

.wtd-reset-filters {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.wtd-reset-filters:hover {
    background: #e5e7eb;
    color: #374151;
    border-color: #d1d5db;
}

.wtd-reset-filters .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Filter Content Wrapper with Scrolling */
.wtd-filters-content {
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.wtd-filters-content::-webkit-scrollbar {
    width: 6px;
}

.wtd-filters-content::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 3px;
}

.wtd-filters-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.wtd-filters-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Filter Groups */
.wtd-filter-group {
    margin-bottom: 24px;
}

.wtd-filter-group:last-child {
    margin-bottom: 0;
}

.wtd-filter-group > label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Collapsible Filter Groups */
.wtd-filter-group.wtd-collapsible {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 16px;
}

.wtd-filter-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtd-filter-toggle:hover .wtd-filter-label {
    color: #374151;
}

.wtd-filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s ease;
}

.wtd-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: #9ca3af;
    transition: transform 0.3s ease;
}

.wtd-filter-toggle[aria-expanded="false"] .wtd-toggle-icon {
    transform: rotate(-90deg);
}

.wtd-filter-toggle:hover .wtd-toggle-icon {
    color: #6b7280;
}

/* Filter Content (Collapsible part) */
.wtd-filter-content {
    max-height: 250px;
    overflow-y: auto;
    overflow-x: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    padding-right: 4px;
}

.wtd-filter-content::-webkit-scrollbar {
    width: 5px;
}

.wtd-filter-content::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 3px;
}

.wtd-filter-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.wtd-filter-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.wtd-filter-toggle[aria-expanded="false"] + .wtd-filter-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
}

/* Search Input */
.wtd-search-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    color: #111827;
    transition: border-color 0.2s;
}

.wtd-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wtd-search-input::placeholder {
    color: #9ca3af;
}

/* Checkbox Groups */
.wtd-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wtd-checkbox-label {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.wtd-checkbox-label:hover {
    background-color: #f9fafb;
}

.wtd-checkbox-label input[type="checkbox"] {
    margin: 0 10px 0 0;
    cursor: pointer;
}

.wtd-checkbox-text {
    font-size: 14px;
    color: #374151;
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wtd-category-count,
.wtd-audience-count,
.wtd-pricing-count {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

/* ==========================================================================
   Tools Container (Right)
   ========================================================================== */

.wtd-tools-container {
    flex: 1 !important;
    min-width: 0 !important;
    max-width: calc(100% - 320px) !important; /* Sidebar (280px) + gap (40px) */
}

.wtd-tools-grid-container {
    width: 100% !important;
    max-width: 100% !important;
}

/* Results Header */
.wtd-results-header {
    margin-bottom: 20px;
}

.wtd-results-count {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
}

/* Loading Indicator */
.wtd-loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.wtd-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: wtd-spin 0.8s linear infinite;
}

@keyframes wtd-spin {
    to { transform: rotate(360deg); }
}

.wtd-loading-indicator span {
    font-size: 14px;
    color: #6b7280;
}

/* ==========================================================================
   Tools Grid (Two Columns)
   ========================================================================== */

.wtd-tools-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 24px !important;
    margin-bottom: 32px;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 200px;
    box-sizing: border-box !important;
}

/* ==========================================================================
   Tool Card - Clean White Card Style
   ========================================================================== */

.wtd-tool-card {
    position: relative;
    background: #ffffff !important;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    display: flex !important;
    flex-direction: column !important;
    transition: all 0.2s ease;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.wtd-tool-card:hover {
    border-color: #d1d5db;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Featured Badge - Top of card */
.wtd-featured-badge {
    position: static;
    display: inline-block;
    background: #fbbf24;
    color: #78350f;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    width: fit-content;
}

.wtd-featured-badge span::before {
    content: "";
}

/* Tool Content */
.wtd-tool-content {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
}

/* Header with logo and title */
.wtd-tool-header {
    display: flex !important;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
    width: 100% !important;
    min-width: 0 !important;
}

/* Tool Logo - Small inline */
.wtd-tool-logo {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.wtd-tool-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.wtd-no-logo {
    text-align: center;
    color: #d1d5db;
}

.wtd-no-logo .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    opacity: 0.4;
}

/* Title wrapper to hold title and badges */
.wtd-tool-title-wrapper {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    min-width: 0 !important;
    overflow: hidden !important;
}

.wtd-tool-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: #111827;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.wtd-tool-title a {
    color: #111827;
    text-decoration: none;
    transition: color 0.2s;
}

.wtd-tool-title a:hover {
    color: #3b82f6;
}

.wtd-tool-description {
    margin: 0 0 16px 0;
    font-size: 15px;
    line-height: 1.6;
    color: #6b7280;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Tool Categories - Hidden */
.wtd-tool-categories {
    display: none;
}

/* Pricing Tags */
.wtd-tool-pricing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.wtd-pricing-tag {
    display: inline-flex !important;
    align-items: center !important;
    padding: 6px 14px !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    transition: all 0.2s !important;
    border: 1px solid transparent !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    margin-right: 8px !important;
}

.wtd-pricing-tag:last-child {
    margin-right: 0 !important;
}

.wtd-pricing-tag:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
}

/* Free - Green Badge */
.wtd-pricing-tag-free,
.wtd-pricing-tag-ucretsiz {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

/* Freemium - Blue Badge */
.wtd-pricing-tag-freemium {
    background: #3b82f6 !important;
    color: #ffffff !important;
    border-color: #2563eb !important;
}

/* Paid - Purple Badge */
.wtd-pricing-tag-paid,
.wtd-pricing-tag-ucretli {
    background: #a855f7 !important;
    color: #ffffff !important;
    border-color: #9333ea !important;
}

/* Premium - Gold Badge */
.wtd-pricing-tag-premium {
    background: #f59e0b !important;
    color: #ffffff !important;
    border-color: #d97706 !important;
}

/* Trial - Orange Badge */
.wtd-pricing-tag-trial,
.wtd-pricing-tag-deneme {
    background: #f97316 !important;
    color: #ffffff !important;
    border-color: #ea580c !important;
}

/* Subscription - Indigo Badge */
.wtd-pricing-tag-subscription,
.wtd-pricing-tag-abonelik {
    background: #6366f1 !important;
    color: #ffffff !important;
    border-color: #4f46e5 !important;
}

/* Tool Actions - Simple link */
.wtd-tool-actions {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.wtd-learn-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #3b82f6 !important;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    transition: color 0.2s;
}

.wtd-learn-more-btn::after {
    content: "→";
    font-size: 16px;
    transition: transform 0.2s;
}

.wtd-learn-more-btn:hover {
    color: #2563eb !important;
    text-decoration: none;
}

.wtd-learn-more-btn:hover::after {
    transform: translateX(3px);
}


/* ==========================================================================
   No Results
   ========================================================================== */

.wtd-no-results {
    text-align: center;
    padding: 60px 20px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    color: #6b7280;
    font-size: 16px;
}

.wtd-no-results::before {
    content: "🔍";
    display: block;
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.wtd-pagination-container {
    margin-top: 32px;
}

.wtd-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wtd-pagination-btn {
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wtd-pagination-btn:hover {
    background: #f9fafb;
    border-color: #3b82f6;
    color: #3b82f6;
}

.wtd-pagination-btn.wtd-active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #ffffff;
}

.wtd-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
    .wtd-tools-directory {
        display: block !important;
        position: relative;
    }

    /* Show burger menu button */
    .wtd-filter-toggle-btn {
        display: flex !important;
        width: fit-content;
    }

    /* Hide sidebar by default on mobile - completely remove from flow */
    .wtd-filters-sidebar {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 320px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        z-index: 10000 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.1) !important;
        border-radius: 0 !important;
        border: none !important;
        border-right: 1px solid #e5e7eb !important;
        transition: transform 0.3s ease !important;
        padding: 24px !important;
        margin: 0 !important;
        background: #ffffff !important;
        transform: translateX(-100%) !important;
        flex: none !important;
    }

    /* Show sidebar when active */
    .wtd-filters-sidebar.active {
        display: block !important;
        transform: translateX(0) !important;
    }

    /* Show close button on mobile */
    .wtd-close-filters {
        display: flex !important;
    }

    /* Backdrop overlay */
    .wtd-filter-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9999;
    }
    
    .wtd-filter-backdrop.active {
        display: block;
    }
    
    /* Tools container takes full width */
    .wtd-tools-container {
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
    }
    
    .wtd-tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    /* Prevent body scroll when sidebar is open */
    body.wtd-filters-open {
        overflow: hidden !important;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767px) {
    .wtd-tools-directory {
        display: block !important;
        margin: 20px 0;
    }

    .wtd-filter-toggle-btn {
        margin-bottom: 16px !important;
        width: 100% !important;
        justify-content: center !important;
    }

    .wtd-filters-sidebar {
        width: 280px !important;
        max-width: 80vw !important;
    }

    .wtd-tools-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .wtd-tool-card {
        padding: 20px;
        width: 100% !important;
    }

    .wtd-tool-header {
        gap: 12px;
    }

    .wtd-tool-logo {
        width: 48px;
        height: 48px;
    }

    .wtd-tool-title {
        font-size: 18px;
    }

    .wtd-tool-description {
        font-size: 14px;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .wtd-tool-card {
        padding: 16px;
        width: 100% !important;
    }

    .wtd-filters-sidebar {
        padding: 16px;
    }

    .wtd-filter-group {
        margin-bottom: 20px;
    }

    .wtd-pagination-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
    
    .wtd-tools-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.wtd-search-input:focus,
.wtd-checkbox-label input:focus,
.wtd-pagination-btn:focus,
.wtd-learn-more-btn:focus,
.wtd-reset-filters:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wtd-filters-sidebar,
    .wtd-pagination,
    .wtd-reset-filters,
    .wtd-loading-indicator {
        display: none !important;
    }

    .wtd-tools-directory {
        display: block;
    }

    .wtd-tools-grid {
        grid-template-columns: 1fr;
    }

    .wtd-tool-card {
        page-break-inside: avoid;
        box-shadow: none;
    }
}
