/**
 * Stellar Categories Grid Widget Styles
 * Luxury warm aesthetic, rounded photo cards, floating pill buttons, responsive layout.
 */

.stellar-category-grid-wrapper {
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

/* ============================================================
   Section Header
============================================================ */
.stellar-catgrid-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 28px;
    gap: 20px;
}

.stellar-catgrid-header.align-center {
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.stellar-catgrid-header.align-right {
    flex-direction: row-reverse;
}

.stellar-catgrid-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stellar-catgrid-subtitle {
    font-family: 'Figtree', sans-serif;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #8C6A48;
    margin: 0;
}

.stellar-catgrid-title {
    font-family: 'Marcellus', serif;
    font-size: 34px;
    font-weight: 400;
    line-height: 1.2;
    color: #1A3324;
    margin: 0;
    letter-spacing: -0.01em;
}

.stellar-catgrid-desc {
    font-family: 'Figtree', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #5C5549;
    margin: 4px 0 0 0;
    max-width: 600px;
}

.stellar-catgrid-view-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: 'Figtree', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #1A3324;
    text-decoration: none;
    transition: all 0.25s ease;
    white-space: nowrap;
    padding-bottom: 4px;
    border-bottom: 1.5px solid rgba(26, 51, 36, 0.25);
}

.stellar-catgrid-view-all:hover {
    color: #8C6A48;
    border-bottom-color: #8C6A48;
    transform: translateX(3px);
}

.stellar-catgrid-view-all svg {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
    fill: currentColor;
}

.stellar-catgrid-view-all:hover svg {
    transform: translateX(4px);
}

/* ============================================================
   Grid Container
============================================================ */
.stellar-catgrid-items {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   Category Card
============================================================ */
.stellar-catgrid-card {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    background-color: #E8E0D2;
    display: block;
    text-decoration: none;
    box-sizing: border-box;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    isolation: isolate;
}

/* Aspect ratio handling */
.stellar-catgrid-card.aspect-square {
    aspect-ratio: 1 / 1;
}

.stellar-catgrid-card.aspect-portrait {
    aspect-ratio: 4 / 5;
}

.stellar-catgrid-card.aspect-classic {
    aspect-ratio: 3 / 4;
}

.stellar-catgrid-card.aspect-landscape {
    aspect-ratio: 16 / 9;
}

.stellar-catgrid-card.aspect-custom {
    /* Height controlled via inline CSS / Elementor control */
}

/* Hover Card Effects */
.stellar-catgrid-card.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 36px rgba(26, 51, 36, 0.14);
}

.stellar-catgrid-card.hover-shadow:hover {
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Background Image Layer */
.stellar-catgrid-image-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
}

.stellar-catgrid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), filter 0.4s ease;
    will-change: transform;
}

.stellar-catgrid-card:hover .stellar-catgrid-img {
    transform: scale(1.06);
}

/* Fallback SVG / Pattern Placeholder */
.stellar-catgrid-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #DFD6C5 0%, #CEBEA4 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8C7B65;
    position: relative;
    overflow: hidden;
}

.stellar-catgrid-placeholder::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    background-image: radial-gradient(#1A3324 1.5px, transparent 1.5px);
    background-size: 16px 16px;
}

.stellar-catgrid-placeholder-icon {
    width: 54px;
    height: 54px;
    opacity: 0.55;
    transition: transform 0.4s ease;
}

.stellar-catgrid-card:hover .stellar-catgrid-placeholder-icon {
    transform: scale(1.1);
}

/* Overlay Layer */
.stellar-catgrid-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 50%, rgba(0, 0, 0, 0.38) 100%);
    opacity: 0.85;
    transition: opacity 0.35s ease, background 0.35s ease;
    z-index: 2;
    pointer-events: none;
}

.stellar-catgrid-card:hover .stellar-catgrid-overlay {
    opacity: 0.95;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.00) 40%, rgba(26, 51, 36, 0.48) 100%);
}

/* ============================================================
   Top Badge (e.g., "Trending", "New", Count)
============================================================ */
.stellar-catgrid-top-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 4;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #1A3324;
    font-family: 'Figtree', sans-serif;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 5px 12px;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   Category Pill Button (Bottom)
============================================================ */
.stellar-catgrid-pill-wrap {
    position: absolute;
    z-index: 3;
    pointer-events: auto;
}

/* Positions */
.stellar-catgrid-pill-wrap.pos-bottom-left {
    bottom: 18px;
    left: 18px;
    right: auto;
    top: auto;
}

.stellar-catgrid-pill-wrap.pos-bottom-center {
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    right: auto;
    top: auto;
    width: max-content;
    max-width: calc(100% - 36px);
}

.stellar-catgrid-pill-wrap.pos-bottom-right {
    bottom: 18px;
    right: 18px;
    left: auto;
    top: auto;
}

.stellar-catgrid-pill-wrap.pos-top-left {
    top: 18px;
    left: 18px;
    right: auto;
    bottom: auto;
}

.stellar-catgrid-pill-wrap.pos-center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: max-content;
    max-width: calc(100% - 36px);
}

/* The Pill Button Itself */
.stellar-catgrid-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #FAF6F0;
    color: #1A3324;
    font-family: 'Figtree', sans-serif;
    font-size: 14.5px;
    font-weight: 600;
    line-height: 1.25;
    padding: 10px 20px;
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-sizing: border-box;
    text-decoration: none;
    max-width: 100%;
}

.stellar-catgrid-pill-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
}

.stellar-catgrid-pill-count {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.7;
    margin-left: 2px;
}

.stellar-catgrid-pill-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.stellar-catgrid-pill-arrow svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Pill Hover inside Card Hover */
.stellar-catgrid-card:hover .stellar-catgrid-pill {
    background-color: #FFFFFF;
    color: #1A3324;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    transform: translateY(-2px);
}

.stellar-catgrid-card:hover .stellar-catgrid-pill-arrow {
    transform: translateX(3px);
}

/* Secondary Pill Style: Dark / Green variant */
.stellar-catgrid-pill.style-dark {
    background-color: #1A3324;
    color: #FAF6F0;
}

.stellar-catgrid-card:hover .stellar-catgrid-pill.style-dark {
    background-color: #264A35;
    color: #FFFFFF;
}

/* Secondary Pill Style: Translucent Glass variant */
.stellar-catgrid-pill.style-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.stellar-catgrid-card:hover .stellar-catgrid-pill.style-glass {
    background: rgba(255, 255, 255, 0.98);
}

/* ============================================================
   Responsive Breakpoints
============================================================ */
@media (max-width: 1024px) {
    .stellar-catgrid-items {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
    .stellar-catgrid-title {
        font-size: 28px;
    }
    .stellar-catgrid-pill {
        font-size: 13.5px;
        padding: 9px 16px;
    }
}

@media (max-width: 768px) {
    .elementor-widget-stellar-category-grid,
    .stellar-category-grid-wrapper {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        clear: both !important;
        float: none !important;
        margin-bottom: 32px !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    .stellar-catgrid-items {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        clear: both !important;
        box-sizing: border-box !important;
    }

    .stellar-catgrid-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 18px;
    }

    .stellar-catgrid-title {
        font-size: 24px;
    }

    .stellar-catgrid-card {
        border-radius: 16px;
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        display: block !important;
        aspect-ratio: 1 / 1 !important;
        min-height: 135px;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .stellar-catgrid-pill-wrap {
        max-width: calc(100% - 16px) !important;
        box-sizing: border-box !important;
    }

    .stellar-catgrid-pill-wrap.pos-bottom-left {
        bottom: 10px;
        left: 10px;
    }

    .stellar-catgrid-pill {
        font-size: 12px;
        padding: 7px 11px;
        max-width: 100% !important;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
        box-sizing: border-box !important;
    }

    .stellar-catgrid-pill-text {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .elementor-widget-stellar-category-grid,
    .stellar-category-grid-wrapper {
        margin-bottom: 28px !important;
    }

    .stellar-catgrid-items {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stellar-catgrid-card {
        border-radius: 14px;
        min-height: 120px;
    }

    .stellar-catgrid-pill-wrap.pos-bottom-left {
        bottom: 8px;
        left: 8px;
    }

    .stellar-catgrid-pill {
        font-size: 11px;
        padding: 5px 8px;
        gap: 3px;
    }

    .stellar-catgrid-pill-text {
        font-size: 11px;
    }

    .stellar-catgrid-pill-count {
        font-size: 10px;
    }

    .stellar-catgrid-pill-arrow {
        width: 10px;
        height: 10px;
    }
}
