/**
 * Sidebar Widgets and Sticky Elements
 */

.single-content-sidebar {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    min-width: 0;
    overflow: visible;
}

.sticky-cta-widget {
    position: sticky;
    top: calc(80px + var(--space-8));
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    z-index: 10;
}

.widget-trending-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(249, 115, 22, 0.15) 100%);
    color: #f97316;
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    border-radius: var(--radius-full);
    border: 1px solid rgba(249, 115, 22, 0.3);
    align-self: flex-start;
}

.widget-trending-badge svg {
    color: #ef4444;
    width: 14px;
    height: 14px;
}

.widget-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.widget-logo {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-surface);
    flex-shrink: 0;
}

.widget-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.widget-logo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-gradient);
    color: white;
    font-size: var(--text-h4);
    font-weight: var(--weight-bold);
}

.widget-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
    overflow: hidden;
}

.widget-name {
    font-size: var(--text-body);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.widget-stats {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
}

.widget-stats svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.widget-cta-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4);
    background: var(--brand-gradient);
    color: #ffffff !important;
    font-size: var(--text-body);
    font-weight: var(--weight-semibold);
    text-decoration: none;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md), 0 0 20px rgba(168, 85, 247, 0.2);
}

.widget-cta-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.widget-cta-btn:hover {
    background: var(--brand-gradient-hover);
    box-shadow: var(--shadow-lg), var(--glow-purple-intense);
    transform: translateY(-2px);
    color: #ffffff !important;
}

.widget-pricing {
    text-align: center;
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

.widget-pricing .pricing-label {
    font-size: var(--text-h4);
    font-weight: var(--weight-bold);
    color: var(--accent-success);
}

/* Mobile Trending Section (Initially hidden) */
.trending-mobile-section {
    display: none;
    margin: var(--space-10) 0;
}

/* Trending Widget */
.trending-widget {
    background: var(--bg-card, #1a1a2e);
    border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    width: 100%;
    box-sizing: border-box;
}

[data-theme="light"] .trending-widget {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.05);
}

.trending-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-h4);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.trending-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-error);
}

.trending-tools-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.trending-tool-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    min-width: 0;
    /* Critical for overflow fix */
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .trending-tool-item {
    background: #f8fafc;
    border-color: #f1f5f9;
}

.trending-tool-item:hover {
    background: rgba(var(--item-accent), 0.08);
    border-color: rgba(var(--item-accent), 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(var(--item-accent), 0.15);
}

[data-theme="light"] .trending-tool-item:hover {
    background: rgba(var(--item-accent), 0.04);
}

.trending-tool-logo {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 8px;
    overflow: visible;
    background: rgba(var(--item-accent), 0.1);
    border: 1px solid rgba(var(--item-accent), 0.2);
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.trending-tool-item:hover .trending-tool-logo {
    transform: scale(1.1) rotate(-5deg);
    background: rgba(var(--item-accent), 0.2);
}

.trending-tool-logo img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.trending-tool-logo .logo-placeholder {
    font-size: 12px;
    font-weight: 800;
    color: rgb(var(--item-accent));
}

.trending-tool-logo .verified-icon-overlay {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #3b82f6;
    color: #fff;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card, #1a1a2e);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 5;
}

[data-theme="light"] .trending-tool-logo .verified-icon-overlay {
    border-color: #ffffff;
}

.trending-tool-info {
    flex: 1;
    min-width: 0;
}

.trending-tool-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.3s ease;
}

[data-theme="light"] .trending-tool-name {
    color: #334155;
}

.trending-tool-item:hover .trending-tool-name {
    color: rgb(var(--item-accent));
}

/* Related Categories Section */
.related-categories-section {
    margin-bottom: var(--space-10);
}

.category-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-6);
}

.category-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.category-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.category-card-name {
    font-size: var(--text-body);
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

.category-card-count {
    font-size: var(--text-xs);
    color: var(--text-dim);
}