.wpcafe-custom-listing {
    line-height: 1.5;
    container-type: inline-size;
}

.wpcafe-category-section {
    margin-bottom: 3em;
}

.wpcafe-category-section:last-child {
    margin-bottom: 0;
}

.wpcafe-category-header {
    --header-accent: var(--wp--preset--color--accent-1, #c9a227);

    display: flex;
    align-items: baseline;
    justify-content: flex-start;
    gap: 0.5em;
    margin-bottom: 1.5em;
    padding: 1em 0;
    background: #000;
    border-radius: 8px;
}

.wpcafe-category-title {
    margin: 0;
    font-family: inherit;
    font-size: 1.4em;
    font-weight: 600;
    color: var(--header-accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wpcafe-category-desc {
    margin: 0;
    font-family: inherit;
    color: var(--header-accent);
    font-size: 0.7em;
    line-height: 1;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.wpcafe-no-categories {
    text-align: center;
    padding: 60px 20px;
    background: #f9f9f9;
    border: 2px dashed #ddd;
}

.wpcafe-placeholder-message {
    color: #666;
    font-size: 1em;
    margin: 0;
}

.wpcafe-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--wpcafe-min-card-width, 250px)), 1fr));
    gap: 20px;
}

.wpcafe-product-card {
    --card-accent: var(--wp--preset--color--accent-1, #c9a227);
    color: var(--card-accent);

    background: radial-gradient(circle at top, #211207 0%, #070404 55%, #000 100%);
    border: 1px solid color-mix(in srgb, var(--card-accent) 35%, transparent);
    border-radius: 18px;
    padding: 20px 16px 16px;
    max-width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;

    display: flex;
    flex-direction: column;
    height: 100%;
}

.wpcafe-product-card:hover {
    border-color: var(--card-accent);
    box-shadow:
        0 0 20px color-mix(in srgb, var(--card-accent) 30%, transparent),
        0 0 40px color-mix(in srgb, var(--card-accent) 15%, transparent);
}

.wpcafe-card-image-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.wpcafe-card-image {
    width: min(120px, 50%);
    aspect-ratio: 1;
    border-radius: 50%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow:
        0 0 25px color-mix(in srgb, var(--card-accent) 70%, transparent),
        0 0 45px color-mix(in srgb, var(--card-accent) 40%, transparent),
        0 0 65px color-mix(in srgb, var(--card-accent) 25%, transparent);
    transition: box-shadow 0.25s ease;
}

.wpcafe-product-card:hover .wpcafe-card-image {
    box-shadow:
        0 0 35px color-mix(in srgb, var(--card-accent) 90%, transparent),
        0 0 65px color-mix(in srgb, var(--card-accent) 70%, transparent),
        0 0 90px color-mix(in srgb, var(--card-accent) 40%, transparent);
}

.wpcafe-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wpcafe-card-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.wpcafe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.wpcafe-card-title {
    font-weight: 600;
    font-size: 1em;
    color: #f5f0e6;
}

.wpcafe-card-price {
    font-weight: 600;
    font-size: 1.1em;
    white-space: nowrap;
}

.wpcafe-card-desc {
    opacity: 0.8;
    font-size: 0.85em;
    line-height: 1.4;
    margin: 0;
}

.wpcafe-card-button {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: 1px solid var(--card-accent);
    border-radius: 8px;
    color: var(--card-accent);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.3s ease,
        color 0.3s ease;
    margin-top: auto;
}

.wpcafe-card-button:hover {
    background: var(--card-accent);
    color: #000;
}

.wpcafe-card-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.wpcafe-no-products {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.wpcafe-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
}

.wpcafe-modal-overlay.active {
    display: flex;
}

.wpcafe-modal {
    --modal-accent: var(--wp--preset--color--accent-1, #c9a227);

    background: radial-gradient(circle at top, #211207 0%, #070404 55%, #000 100%);
    border: 1px solid color-mix(in srgb, var(--modal-accent) 35%, transparent);
    border-radius: 18px;
    padding: 30px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: var(--modal-accent);
}

.wpcafe-modal::-webkit-scrollbar {
    width: 6px;
}

.wpcafe-modal::-webkit-scrollbar-track {
    background: transparent;
}

.wpcafe-modal::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--modal-accent) 40%, transparent);
    border-radius: 3px;
}

.wpcafe-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: color-mix(in srgb, var(--modal-accent) 60%, #fff);
    padding: 5px;
    line-height: 1;
    transition: color 0.2s ease;
}

.wpcafe-modal-close:hover {
    color: #fff;
}

.wpcafe-modal-image {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 0 auto 24px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid color-mix(in srgb, var(--modal-accent) 50%, transparent);
}

.wpcafe-modal-title {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #f5f0e6;
    text-align: center;
}

.wpcafe-modal-price {
    font-weight: 600;
    margin: 0 0 16px 0;
    font-size: 1.2em;
    text-align: center;
}

.wpcafe-modal-desc {
    opacity: 0.8;
    margin: 0 0 24px 0;
    line-height: 1.6;
    font-size: 0.95em;
    text-align: center;
}

.wpcafe-special-request-label {
    display: block;
    margin-bottom: 20px;
}

.wpcafe-special-request-label span {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #f5f0e6;
    font-size: 0.9em;
}

.wpcafe-special-request-label textarea {
    width: 100%;
    padding: 12px;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid color-mix(in srgb, var(--modal-accent) 30%, transparent);
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    color: #f5f0e6;
    transition: border-color 0.2s ease;
}

.wpcafe-special-request-label textarea::placeholder {
    color: rgba(245, 240, 230, 0.4);
}

.wpcafe-special-request-label textarea:focus {
    outline: none;
    border-color: var(--modal-accent);
}

.wpcafe-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.wpcafe-quantity-control span {
    font-weight: 500;
    color: #f5f0e6;
}

.wpcafe-quantity-control button {
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    background: transparent;
    border: 1px solid var(--modal-accent);
    border-radius: 8px;
    color: var(--modal-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.wpcafe-quantity-control button:hover {
    background: var(--modal-accent);
    color: #000;
}

#wpcafe-qty-input {
    width: 60px;
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid color-mix(in srgb, var(--modal-accent) 30%, transparent);
    border-radius: 8px;
    font-size: 16px;
    color: #f5f0e6;
    -moz-appearance: textfield;
}

#wpcafe-qty-input:focus {
    outline: none;
    border-color: var(--modal-accent);
}

#wpcafe-qty-input::-webkit-outer-spin-button,
#wpcafe-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wpcafe-add-to-cart-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--modal-accent);
    color: #000;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: opacity 0.2s ease;
}

.wpcafe-add-to-cart-btn:hover {
    opacity: 0.9;
}

.wpcafe-add-to-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wpcafe-add-to-cart-btn.loading {
    position: relative;
    color: transparent;
}

.wpcafe-add-to-cart-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #000;
    border-top-color: transparent;
    border-radius: 50%;
    animation: wpcafe-spin 0.8s linear infinite;
}

@keyframes wpcafe-spin {
    to {
        transform: rotate(360deg);
    }
}

.wpcafe-cart-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    font-size: 0.9em;
}

.wpcafe-cart-message.success {
    background: rgba(34, 197, 94, 0.15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.wpcafe-cart-message.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.wpcafe-cart-message a {
    color: inherit;
    font-weight: 600;
}

@container (max-width: 600px) {
    .wpcafe-product-grid {
        gap: 16px;
    }

    .wpcafe-card-image-wrapper {
        margin-bottom: 16px;
    }

    .wpcafe-card-content {
        gap: 12px;
        margin-bottom: 12px;
    }

    .wpcafe-card-button {
        padding: 10px 14px;
    }
}

@container (max-width: 350px) {
    .wpcafe-product-grid {
        gap: 14px;
    }

    .wpcafe-product-card {
        padding: 16px 14px 14px;
    }

    .wpcafe-card-content {
        flex-direction: column;
        gap: 8px;
    }

    .wpcafe-card-price {
        align-self: flex-start;
    }
}

@media (max-width: 500px) {
    .wpcafe-modal-overlay {
        padding: 16px;
    }

    .wpcafe-modal {
        padding: 24px 20px;
        border-radius: 14px;
    }

    .wpcafe-modal-image {
        width: 100px;
        height: 100px;
        margin-bottom: 20px;
    }

    .wpcafe-modal-title {
        font-size: 1.2em;
    }

    .wpcafe-modal-desc {
        font-size: 0.9em;
        margin-bottom: 20px;
    }

    .wpcafe-special-request-label {
        margin-bottom: 16px;
    }

    .wpcafe-quantity-control {
        margin-bottom: 20px;
    }
}

.editor-styles-wrapper .wpcafe-custom-listing {
    pointer-events: none;
}

.editor-styles-wrapper .wpcafe-product-card {
    cursor: default;
}

.editor-styles-wrapper .wpcafe-modal-overlay {
    display: none !important;
}
