/* ---------------------------
 * Category Grid
 * -------------------------- */
.uwg-categories {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}

.uwg-categories[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.uwg-categories[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.uwg-categories[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.uwg-categories[data-columns="5"] {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.uwg-category {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.uwg-parent-category {
    cursor: pointer;
}

.uwg-child-category {
    cursor: pointer;
}

.uwg-category:hover {
    transform: translateY(-5px);
}

/* ---------------------------
 * Category Thumbnail
 * -------------------------- */
.uwg-cat-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.uwg-category:hover .uwg-cat-thumb {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.uwg-cat-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.uwg-category:hover .uwg-cat-thumb img {
    transform: scale(1.05);
}

.uwg-cat-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.uwg-cat-placeholder .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: rgba(255,255,255,0.5);
}

/* ---------------------------
 * Category Overlay
 * -------------------------- */
.uwg-cat-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
    padding: 1.5rem 1rem 1rem;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.3s ease;
}

.uwg-category:hover .uwg-cat-overlay {
    transform: translateY(0);
    opacity: 1;
}

.uwg-cat-count {
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.uwg-cat-count::before {
    content: "⊞";
    font-size: 1.4rem;
    font-weight: bold;
}

/* ---------------------------
 * Category Title
 * -------------------------- */
.uwg-cat-title {
    margin: 1rem 0 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    transition: color 0.3s ease;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.uwg-category:hover .uwg-cat-title {
    color: #667eea;
    text-shadow: 0 2px 8px rgba(102,126,234,0.5);
}

/* ---------------------------
 * Subcategory Labels
 * -------------------------- */
.uwg-cat-subcats {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* ---------------------------
 * Subcategory View
 * -------------------------- */
.uwg-subcategory-view {
    margin: 2rem 0;
}

.uwg-images-view {
    margin: 2rem 0;
}

.uwg-gallery-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.3);
}

.uwg-back-to-categories,
.uwg-back-to-subcategories {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.uwg-back-to-categories::before,
.uwg-back-to-subcategories::before {
    content: "←";
    font-size: 1.5rem;
    line-height: 1;
}

.uwg-back-to-categories:hover,
.uwg-back-to-subcategories:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.uwg-parent-title {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ---------------------------
 * Images Grid
 * -------------------------- */
.uwg-images-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.uwg-images-grid[data-columns="2"] {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.uwg-images-grid[data-columns="3"] {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.uwg-images-grid[data-columns="4"] {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.uwg-images-grid[data-columns="5"] {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.uwg-image-item {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.uwg-image-item:hover {
    transform: translateY(-5px);
}

.uwg-image-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #2a2a2a;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: box-shadow 0.3s ease;
}

.uwg-image-item:hover .uwg-image-thumb {
    box-shadow: 0 8px 24px rgba(102,126,234,0.4);
}

.uwg-image-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.uwg-image-item:hover .uwg-image-thumb img {
    transform: scale(1.05);
}

.uwg-image-name {
    margin-top: 0.75rem;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ---------------------------
 * Subcategory Groups
 * -------------------------- */
.uwg-subcat-group {
    margin-bottom: 3rem;
}

.uwg-subcat-title {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid rgba(102, 126, 234, 0.5);
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* ---------------------------
 * Empty State
 * -------------------------- */
.uwg-empty {
    padding: 3rem;
    text-align: center;
    background: #f9fafb;
    border-radius: 12px;
    color: #6b7280;
    font-size: 1.125rem;
}

/* ---------------------------
 * Intermediate Gallery View
 * -------------------------- */
.uwg-gallery-view {
    display: none;
    margin: 3rem 0;
}

.uwg-gallery-view.is-active {
    display: block;
}

.uwg-gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
}

.uwg-gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.uwg-gallery-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.75rem 1.5rem;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.uwg-gallery-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

.uwg-gallery-back::before {
    content: "←";
    font-size: 1.5rem;
}

.uwg-gallery-title-main {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.uwg-gallery-tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.uwg-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.uwg-gallery-item {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.uwg-gallery-item:hover {
    transform: translateY(-5px);
}

.uwg-gallery-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    background: #2a2a2a;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: box-shadow 0.3s ease;
}

.uwg-gallery-item:hover .uwg-gallery-thumb {
    box-shadow: 0 8px 24px rgba(102,126,234,0.4);
}

.uwg-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.uwg-gallery-item:hover .uwg-gallery-thumb img {
    transform: scale(1.05);
}

.uwg-gallery-item-info {
    margin-top: 1rem;
}

.uwg-gallery-item-name {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.uwg-gallery-item-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.uwg-gallery-item-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
}

/* ---------------------------
 * Lightbox Base
 * -------------------------- */
.uwg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
}

.uwg-lightbox.is-active {
    display: flex;
}

/* ---------------------------
 * Lightbox Overlay
 * -------------------------- */
.uwg-lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------------------------
 * Lightbox Content
 * -------------------------- */
.uwg-lightbox-content {
    position: relative;
    width: 100%;
    max-width: 1400px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------------------------
 * Close Button
 * -------------------------- */
.uwg-lb-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.uwg-lb-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg) scale(1.1);
}

/* ---------------------------
 * Lightbox Header
 * -------------------------- */
.uwg-lb-header {
    padding: 0 60px 20px 0;
    text-align: center;
}

.uwg-lb-title {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

/* ---------------------------
 * Tag Filters
 * -------------------------- */
.uwg-lb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.uwg-tag-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.uwg-tag-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.uwg-tag-btn.is-active {
    background: #667eea;
    border-color: #667eea;
}

/* ---------------------------
 * Lightbox Body
 * -------------------------- */
.uwg-lb-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    position: relative;
}

/* ---------------------------
 * Navigation Buttons
 * -------------------------- */
.uwg-lb-prev,
.uwg-lb-next {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.uwg-lb-prev:hover,
.uwg-lb-next:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.uwg-lb-prev span,
.uwg-lb-next span {
    line-height: 0;
}

/* ---------------------------
 * Image Container
 * -------------------------- */
.uwg-lb-image-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    max-height: calc(100vh - 200px);
}

.uwg-lb-image {
    max-width: 100%;
    max-height: calc(100vh - 300px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* ---------------------------
 * Image Info
 * -------------------------- */
.uwg-lb-info {
    margin-top: 1.5rem;
    text-align: center;
    max-width: 600px;
}

.uwg-lb-image-name {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.uwg-lb-image-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.uwg-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
}

.uwg-lb-counter {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
}

/* ---------------------------
 * Responsive Design
 * -------------------------- */
@media (max-width: 1200px) {
    .uwg-categories[data-columns="5"] {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (max-width: 1024px) {
    .uwg-categories[data-columns="4"],
    .uwg-categories[data-columns="5"] {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .uwg-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .uwg-categories {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .uwg-cat-title {
        font-size: 1.125rem;
    }

    .uwg-lightbox-content {
        padding: 15px;
    }

    .uwg-lb-title {
        font-size: 1.5rem;
    }

    .uwg-lb-prev,
    .uwg-lb-next {
        width: 48px;
        height: 48px;
        font-size: 28px;
    }

    .uwg-lb-close {
        width: 40px;
        height: 40px;
        font-size: 28px;
        top: 15px;
        right: 15px;
    }

    .uwg-lb-image {
        max-height: calc(100vh - 250px);
    }

    /* Gallery view responsive */
    .uwg-gallery-container {
        padding: 0;
    }

    .uwg-gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .uwg-gallery-header > div:last-child {
        display: none;
    }

    .uwg-gallery-title-main {
        font-size: 1.5rem;
    }

    .uwg-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    .uwg-categories {
        grid-template-columns: 1fr;
    }

    .uwg-lb-header {
        padding-right: 40px;
    }

    .uwg-lb-title {
        font-size: 1.25rem;
    }

    .uwg-lb-prev,
    .uwg-lb-next {
        position: absolute;
        bottom: 20px;
    }

    .uwg-lb-prev {
        left: 20px;
    }

    .uwg-lb-next {
        right: 20px;
    }

    .uwg-lb-body {
        flex-direction: column;
    }

    /* Gallery view mobile */
    .uwg-gallery-grid {
        grid-template-columns: 1fr;
    }

    .uwg-gallery-title-main {
        font-size: 1.25rem;
    }
}

/* ---------------------------
 * Print Styles
 * -------------------------- */
@media print {
    .uwg-lightbox {
        display: none !important;
    }
}
