/* ============================================================
   Tag Cloud Styles
   ============================================================ */

.tag-cloud-section {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 40px 0;
    margin: 40px 0;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.tag-cloud-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.tag-cloud-header {
    position: relative;
    z-index: 1;
    margin-bottom: 30px;
    text-align: center;
}

.tag-cloud-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
}

.tag-cloud-header p {
    color: #64748b;
    font-size: 1rem;
}

/* Tag Cloud Container */
.tag-cloud {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
    padding: 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    line-height: 1.8;
}

/* Individual Tag */
.tag-item {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    cursor: pointer;
    position: relative;
    font-weight: 500;
    border: 1px solid transparent;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.tag-item:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Tag Size Levels */
.tag-item.size-1 { font-size: 12px; opacity: 0.6; }
.tag-item.size-2 { font-size: 14px; opacity: 0.7; }
.tag-item.size-3 { font-size: 16px; opacity: 0.8; }
.tag-item.size-4 { font-size: 20px; opacity: 0.9; }
.tag-item.size-5 { font-size: 24px; opacity: 1; }

/* Tag Colors by Difficulty */
.tag-item.difficulty-easy {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.tag-item.difficulty-easy:hover {
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.tag-item.difficulty-medium {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.tag-item.difficulty-medium:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.tag-item.difficulty-hard {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.tag-item.difficulty-hard:hover {
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Tag Tooltip */
.tag-item[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s;
    z-index: 10;
    margin-bottom: 8px;
}

.tag-item[data-tooltip]:hover::after {
    opacity: 1;
}

/* Tag Filters */
.tag-cloud-filters {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
    justify-content: center;
}

.tag-filter-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.tag-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8fafc;
}

.tag-filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Tag Stats */
.tag-cloud-stats {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
}

.tag-stat {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.tag-stat:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.tag-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
}

.tag-stat-label {
    font-size: 13px;
    color: #64748b;
    margin-top: 4px;
}

/* Tag Search */
.tag-search-box {
    position: relative;
    z-index: 1;
    margin-bottom: 30px;
}

.tag-search-input {
    width: 100%;
    max-width: 400px;
    display: block;
    margin: 0 auto;
    padding: 12px 16px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.tag-search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Trending Tags Badge */
.trending-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    position: absolute;
    top: -8px;
    right: -8px;
}

.trending-badge::before {
    content: '??';
}

/* Popular Badge */
.popular-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    position: absolute;
    top: -8px;
    right: -8px;
}

.popular-badge::before {
    content: '?';
}

/* Loading State */
.tag-cloud.loading {
    opacity: 0.6;
    pointer-events: none;
}

.tag-cloud-skeleton {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.tag-skeleton {
    height: 32px;
    width: 80px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 20px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 768px) {
    .tag-cloud-section {
        padding: 30px 0;
    }

    .tag-cloud-header h2 {
        font-size: 1.5rem;
    }

    .tag-cloud {
        gap: 8px;
        padding: 20px;
    }

    .tag-item.size-5 { font-size: 18px; }
    .tag-item.size-4 { font-size: 16px; }
    .tag-item.size-3 { font-size: 14px; }

    .tag-cloud-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .tag-cloud-filters {
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .tag-cloud-section {
        padding: 20px 0;
        margin: 20px 0;
    }

    .tag-cloud-header h2 {
        font-size: 1.25rem;
    }

    .tag-item {
        font-size: 12px;
        padding: 6px 12px;
    }

    .tag-cloud-stats {
        grid-template-columns: 1fr;
    }
}

/* Animation */
@keyframes tagPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.tag-item.pulse {
    animation: tagPulse 2s infinite;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .tag-cloud-section {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    }

    .tag-cloud {
        background: #0f172a;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    .tag-filter-btn {
        background: #1e293b;
        border-color: #334155;
        color: #cbd5e1;
    }

    .tag-filter-btn:hover {
        background: #334155;
        border-color: #667eea;
    }

    .tag-stat {
        background: #1e293b;
        border-color: #334155;
    }

    .tag-search-input {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }
}
