/**
 * Shop Category & Tag Taxonomy Styles
 * Modern, responsive styling for category and tag pages
 * 
 * @version 2.0.0
 */

/* ========================================
   VARIABLES
   ======================================== */
:root {
    --jz-category-hero-height: 320px;
    --jz-category-card-gap: 1.5rem;
    --jz-tag-pill-padding: 0.5rem 1rem;
}

/* ========================================
   CATEGORY PAGE
   ======================================== */

.category-hero {
    position: relative;
    overflow: hidden;
    min-height: var(--jz-category-hero-height);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 3rem;
}

.category-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.category-hero__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
}

.category-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.8), rgba(118, 75, 162, 0.8));
    z-index: 1;
}

.category-hero__placeholder {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.category-hero__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.category-hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    width: 100%;
}

.category-hero__text {
    max-width: 700px;
    margin: 0 auto;
    padding: 0 2rem;
}

.category-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 1rem 0 0.5rem;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.category-hero__description {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 300;
    opacity: 0.95;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.category-hero__meta {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.meta-count {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
}

.breadcrumb__link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color var(--jz-transition-fast);
}

.breadcrumb__link:hover {
    color: white;
    text-decoration: underline;
}

.breadcrumb__separator {
    color: rgba(255, 255, 255, 0.5);
}

.breadcrumb__current {
    color: white;
    font-weight: 600;
}

/* ========================================
   TAG PAGE
   ======================================== */

.tag-hero {
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5f7df9 0%, #6b8cff 100%);
    margin-bottom: 3rem;
}

.tag-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.tag-hero__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #5f7df9, #6b8cff);
}

.tag-hero__pattern {
    position: absolute;
    inset: 0;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255,255,255,.05) 10px, rgba(255,255,255,.05) 20px),
        repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,.05) 10px, rgba(255,255,255,.05) 20px);
    z-index: 0;
}

.tag-hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    width: 100%;
    padding: 3rem 2rem;
}

.tag-hero__text {
    max-width: 600px;
    margin: 0 auto;
}

.tag-badge {
    display: inline-block;
    font-size: 3rem;
    font-weight: 700;
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.tag-hero__title {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 700;
    margin: 0.5rem 0;
    line-height: 1.2;
}

.tag-hero__description {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 300;
    opacity: 0.95;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.tag-hero__meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* ========================================
   PRODUCTS TOOLBAR
   ======================================== */

.products-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--jz-gray-200);
    flex-wrap: wrap;
}

.toolbar-left {
    flex: 1;
    min-width: 160px;
}

.result-count {
    font-size: 0.9rem;
    color: var(--jz-gray-600);
    font-weight: 500;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.sort-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--jz-gray-300);
    border-radius: 0.5rem;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: var(--jz-transition-fast);
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--jz-primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
    outline: none;
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-toggle__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--jz-gray-300);
    background: white;
    border-radius: 0.5rem;
    cursor: pointer;
    color: var(--jz-gray-600);
    transition: var(--jz-transition-fast);
}

.view-toggle__btn:hover {
    border-color: var(--jz-primary);
    color: var(--jz-primary);
}

.view-toggle__btn.active {
    background: var(--jz-primary);
    border-color: var(--jz-primary);
    color: white;
}

/* ========================================
   PRODUCTS GRID
   ======================================== */

.products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ========================================
   CATEGORY INDEX PAGE
   ======================================== */

.categories-hero {
    position: relative;
    overflow: hidden;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 3rem;
}

.categories-hero__bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.categories-hero__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.categories-hero__shapes {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.1), rgba(255,255,255,0));
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 200px;
    height: 200px;
    bottom: -50px;
    right: 10%;
}

.shape-3 {
    width: 250px;
    height: 250px;
    top: 50%;
    right: -100px;
}

.categories-hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: 3rem 2rem;
}

.categories-hero__title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.categories-hero__subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    font-weight: 300;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* Search */
.categories-search,
.tags-search {
    position: relative;
    margin-bottom: 2.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.category-search__input,
.tag-search__input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--jz-gray-300);
    border-radius: 2rem;
    font-size: 0.95rem;
    transition: var(--jz-transition-fast);
}

.category-search__input:focus,
.tag-search__input:focus {
    outline: none;
    border-color: var(--jz-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.category-search__icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--jz-gray-400);
    pointer-events: none;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--jz-category-card-gap);
    margin-bottom: 3rem;
}

.category-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: white;
    border-radius: 1rem;
    border: 1px solid var(--jz-gray-200);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: var(--jz-transition-fast);
}

.category-card:hover {
    border-color: var(--jz-primary);
    box-shadow: var(--jz-shadow-lg);
    transform: translateY(-4px);
}

.category-card__image {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--jz-gray-100);
}

.category-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-card:hover .category-card__img {
    transform: scale(1.05);
}

.category-card__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.7), rgba(118, 75, 162, 0.7));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-card:hover .category-card__overlay {
    opacity: 1;
}

.category-card__placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5f5, #e8e8e8);
    color: var(--jz-gray-300);
}

.category-card__content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.category-card__title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem;
    line-height: 1.3;
    transition: color var(--jz-transition-fast);
}

.category-card:hover .category-card__title {
    color: var(--jz-primary);
}

.category-card__description {
    font-size: 0.9rem;
    color: var(--jz-gray-600);
    margin: 0 0 auto;
    line-height: 1.4;
}

.category-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--jz-gray-200);
}

.category-count {
    font-size: 0.85rem;
    color: var(--jz-gray-500);
    font-weight: 500;
}

.category-card__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--jz-gray-100);
    color: var(--jz-primary);
    transition: var(--jz-transition-fast);
}

.category-card:hover .category-card__arrow {
    background: var(--jz-primary);
    color: white;
    transform: translateX(4px);
}

/* Categories Stats */
.categories-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    color: white;
}

.stat-card__label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin: 0;
    font-weight: 500;
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

/* ========================================
   TAG CLOUD (Index Page)
   ======================================== */

.tags-hero {
    position: relative;
    overflow: hidden;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-bottom: 3rem;
}

.tags-hero__bg {
    position: absolute;
    inset: 0;
}

.tags-hero__gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.tags-hero__content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: white;
    padding: 3rem 2rem;
}

.tags-hero__title {
    font-size: clamp(1.75rem, 4vw, 3rem);
    font-weight: 700;
    margin: 0 0 0.5rem;
}

.tags-hero__subtitle {
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    font-weight: 300;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

/* Tags Cloud */
.tags-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 3rem;
    max-width: 100%;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: var(--jz-tag-pill-padding);
    background: var(--jz-gray-100);
    border: 1px solid var(--jz-gray-300);
    border-radius: 2rem;
    color: var(--jz-gray-700);
    text-decoration: none;
    font-weight: 500;
    transition: var(--jz-transition-fast);
    white-space: nowrap;
}

.tag-pill:hover {
    background: var(--jz-primary);
    border-color: var(--jz-primary);
    color: white;
    transform: translateY(-2px);
}

.tag-icon {
    color: currentColor;
    opacity: 0.7;
}

.tag-count {
    font-size: 0.85em;
    opacity: 0.8;
}

/* Tag sizes */
.tag-pill.size-1 { font-size: 0.8rem; }
.tag-pill.size-2 { font-size: 0.95rem; }
.tag-pill.size-3 { font-size: 1rem; font-weight: 600; }
.tag-pill.size-4 { font-size: 1.15rem; font-weight: 600; }
.tag-pill.size-5 { font-size: 1.35rem; font-weight: 700; }

/* Popular Tags List */
.popular-tags-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.popular-tag-item {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--jz-gray-50);
    border: 1px solid var(--jz-gray-200);
    border-radius: 0.75rem;
    transition: var(--jz-transition-fast);
}

.popular-tag-item:hover {
    background: var(--jz-gray-100);
    border-color: var(--jz-primary);
}

.popular-tag-link {
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.75rem;
}

.popular-tag-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--jz-primary);
}

.tag-hash {
    opacity: 0.6;
}

.popular-tag-count {
    font-size: 0.85rem;
    color: var(--jz-gray-600);
}

/* Tips Section */
.tags-tips {
    margin-top: 3rem;
}

.tips-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.tip-card {
    padding: 2rem 1.5rem;
    background: var(--jz-gray-50);
    border: 1px solid var(--jz-gray-200);
    border-radius: 1rem;
    text-align: center;
    transition: var(--jz-transition-fast);
}

.tip-card:hover {
    border-color: var(--jz-primary);
    box-shadow: var(--jz-shadow-md);
}

.tip-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.tip-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    color: var(--jz-gray-900);
}

.tip-description {
    font-size: 0.9rem;
    color: var(--jz-gray-600);
    margin: 0;
    line-height: 1.5;
}

/* Related Categories */
.related-categories {
    background: var(--jz-gray-50);
    padding: 3rem 2rem;
    border-radius: 1rem;
    margin-top: 3rem;
}

.related-tags {
    background: var(--jz-gray-50);
    padding: 3rem 2rem;
    border-radius: 1rem;
    margin-top: 3rem;
}

.section-title {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
}

/* No results */
.no-products,
.no-categories,
.no-tags {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 2rem;
    background: var(--jz-gray-50);
    border-radius: 1rem;
    border: 2px dashed var(--jz-gray-300);
}

.no-products p,
.no-categories p,
.no-tags p {
    color: var(--jz-gray-600);
    font-size: 1.1rem;
    margin: 0;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .categories-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    :root {
        --jz-category-hero-height: 260px;
        --jz-category-card-gap: 1rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .products-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }
    
    .toolbar-right {
        justify-content: space-between;
    }
    
    .sort-select {
        flex: 1;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tags-cloud {
        gap: 0.75rem;
    }
    
    .tag-pill {
        font-size: 0.85rem;
    }
    
    .popular-tags-list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 480px) {
    .category-hero,
    .tag-hero,
    .categories-hero,
    .tags-hero {
        min-height: 200px;
    }
    
    .category-hero__title,
    .tag-hero__title,
    .categories-hero__title,
    .tags-hero__title {
        font-size: 1.5rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    
    .tags-cloud {
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .popular-tags-list {
        grid-template-columns: 1fr;
    }
}

/* 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: 0;
}
