/* Tags Page Styling */
body {
    background-color: #0a0a0a;
    color: #fff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tags-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 120px 20px 80px;
    flex: 1;
}

/* Header Section */
.tags-header {
    text-align: center;
    margin-bottom: 50px;
}

.tags-header h1 {
    font-size: 3.5em;
    font-weight: 800;
    margin-bottom: 15px;
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
}

.tags-subtitle {
    font-size: 1.2em;
    color: #999;
    margin-bottom: 30px;
    line-height: 1.6;
}

/* Search Bar */
.search-bar {
    max-width: 600px;
    margin: 30px auto;
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    width: 100%;
    padding: 16px 50px 16px 20px;
    font-size: 16px;
    border: 2px solid #2a2a2a;
    border-radius: 50px;
    background: #1a1a1a;
    color: #fff;
    transition: all 0.3s ease;
    outline: none;
}

.search-bar input:focus {
    border-color: #4a9eff;
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.3);
}

.search-bar button {
    position: absolute;
    right: 5px;
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    border: none;
    padding: 12px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-bar button:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.5);
}

.search-bar button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 28px;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 50px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-btn:hover {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.4);
}

/* Stats Section */
.tags-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin: 50px 0;
    padding: 30px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.05) 0%, rgba(123, 104, 238, 0.05) 100%);
    border-radius: 20px;
    border: 1px solid rgba(74, 158, 255, 0.1);
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 3em;
    font-weight: 800;
    background: linear-gradient(135deg, #4a9eff 0%, #7b68ee 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.stat-label {
    display: block;
    font-size: 1em;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Tags Grid */
.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 40px;
    justify-content: center;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 50px;
    color: #fff;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
    max-width: 100%;
    min-width: 0;
    min-height: 44px;
}

.tag-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.1) 0%, rgba(123, 104, 238, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tag-item:hover::before {
    opacity: 1;
}

.tag-item:hover {
    border-color: #4a9eff;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(74, 158, 255, 0.3);
}

.tag-name {
    position: relative;
    z-index: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.tag-count {
    position: relative;
    z-index: 1;
    padding: 4px 10px;
    background: rgba(74, 158, 255, 0.2);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: #4a9eff;
    flex-shrink: 0;
}

.tag-item:focus-visible, .filter-btn:focus-visible {
    outline: 2px solid #80baff;
    outline-offset: 3px;
}

#tags-status {
    text-align: center;
    line-height: 1.7;
}

/* Category-specific colors */
.tag-item.materials .tag-count {
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.tag-item.textures .tag-count {
    background: rgba(255, 107, 74, 0.2);
    color: #ff6b4a;
}

.tag-item.hdris .tag-count {
    background: rgba(123, 104, 238, 0.2);
    color: #7b68ee;
}

.tag-item.models .tag-count {
    background: rgba(255, 215, 0, 0.2);
    color: #ffd700;
}

/* Loading and Error States */
.loading,
.error-message,
.no-results {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 18px;
    grid-column: 1 / -1;
}

.error-message {
    color: #ff6b6b;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .tags-header h1 {
        font-size: 2.5em;
    }

    .tags-stats {
        gap: 40px;
    }

    .stat-number {
        font-size: 2.5em;
    }
}

@media (max-width: 768px) {
    .tags-container {
        padding: 100px 15px 30px;
    }

    .tags-header h1 {
        font-size: 2em;
    }

    .tags-subtitle {
        font-size: 1em;
    }

    .search-bar {
        max-width: 100%;
    }

    .filter-buttons {
        gap: 8px;
    }

    .filter-btn {
        padding: 10px 20px;
        font-size: 13px;
    }

    .tags-stats {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 24px;
        padding: 20px;
    }

    .stat-number {
        font-size: 2em;
    }

    .tags-grid {
        gap: 8px;
        margin-top: 30px;
    }

    .tag-item {
        padding: 10px 16px;
        font-size: 14px;
    }

    .tag-count {
        padding: 3px 8px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .tags-header h1 {
        font-size: 1.8em;
    }

    .filter-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-btn {
        width: 100%;
        min-width: 0;
        padding: 12px 8px;
        min-height: 44px;
    }

    .tag-item {
        flex: 1 1 180px;
        min-width: 0;
        max-width: 100%;
        justify-content: space-between;
    }
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tag-item {
    animation: fadeIn 0.3s ease forwards;
}

.tag-item:nth-child(n) {
    animation-delay: calc(0.02s * (var(--index, 0)));
}
