/*
Plugin Name: Custom Shop Plugin
Description: Custom Shop Layout CSS
*/

:root {
    --cs-highlight-color: var(--wp--preset--color--primary, #007cba);
    --cs-text-color: inherit;
}

/* Notification Styles (Moved from inline style) */
@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(400px); opacity: 0; }
}
.custom-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 4px;
    z-index: 9999;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-weight: 500;
    min-width: 200px;
    text-align: center;
}
.custom-notification.success {
    background: #4CAF50;
    color: white;
    animation: slideIn 0.3s ease-in;
}
.custom-notification.error {
    background: #f44336;
    color: white;
    animation: slideIn 0.3s ease-in;
}

/* General Layout */
.custom-shop-page { margin: 0; padding: 0; background: transparent; }
.custom-shop-container { display: flex; align-items: flex-start; max-width: 1400px; margin: 0 auto; }

/* Left Column (Sticky Sidebar) */
.shop-sidebar {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: transparent;
    border-right: 1px solid currentColor;
    padding: 30px 20px;
    box-sizing: border-box;
}
.shop-logo img { max-width: 100%; height: auto; }
.sidebar-text { font-size: 14px; color: currentColor; opacity: 0.8; margin: 15px 0; text-align: center; }
.dotted-separator { border: none; border-top: 2px dotted currentColor; margin: 20px 0; }
.shop-categories-list { list-style: none; padding: 0; margin: 20px 0 30px 0; }
.shop-categories-list li { margin-bottom: 8px; border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent); }
.shop-categories-list a { text-decoration: none; color: currentColor; font-weight: 600; display: block; padding: 8px 0; transition: color 0.2s ease, padding-left 0.2s ease; }
.shop-categories-list a:hover { color: var(--cs-highlight-color); padding-left: 5px; }

/* Live Search */
.live-search-container { position: relative; }
#custom-live-search { width: 100%; padding: 10px; border: 1px solid currentColor; border-radius: 4px; box-sizing: border-box; color: inherit; background: transparent; }
#live-search-results { position: absolute; top: 100%; left: 0; width: 100%; background: var(--wp--preset--color--background, #fff); box-shadow: 0 4px 6px rgba(0,0,0,0.1); z-index: 100; max-height: 300px; overflow-y: auto; }
#live-search-results:empty { display: none; }
#live-search-results a { display: block; padding: 10px; border-bottom: 1px solid color-mix(in srgb, currentColor 15%, transparent); text-decoration: none; color: currentColor; font-size: 13px; }

/* Right Column (Main Content) */
.shop-main-content { flex-grow: 1; padding: 30px; box-sizing: border-box; }
.category-header { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 30px; }
.cat-info { width: 100%; margin-bottom: 15px; }
.cat-info h2 { margin-bottom: 10px; }
.cat-image { width: 100%; height: auto; max-height: 250px; object-fit: cover; border-radius: 8px; }
.category-products { display: flex; flex-direction: column; gap: 20px; margin-bottom: 50px; }

/* Product Loop Layout */
.custom-product-item { background: transparent; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px color-mix(in srgb, currentColor 5%, transparent); border: 1px solid color-mix(in srgb, currentColor 10%, transparent); }
.product-top-row { display: flex; gap: 20px; justify-content: space-between; }
.product-info-left { flex-grow: 1; }
.product-info-left h3 { margin: 0 0 5px 0; font-size: 18px; }
.product-additives { font-size: 13px; color: currentColor; opacity: 0.7; margin: 0 0 10px 0; }
.product-excerpt { font-size: 14px; color: currentColor; opacity: 0.9; }

/* Right Sub-Column (Fixed 168px) */
.product-action-right { width: 168px; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; }
.product-price { font-weight: bold; font-size: 18px; margin-bottom: 10px; color: currentColor; }

/* Add to Cart Area */
.add-to-cart-wrapper { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; width: 100%; }

.qty-container { display: flex; align-items: center; justify-content: space-between; border: 1px solid currentColor; border-radius: 4px; width: 100%; height: 40px; box-sizing: border-box; overflow: hidden; background: transparent; }
.qty-btn { background: transparent; border: none; width: 35px; height: 100%; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: inherit; padding: 0; margin: 0; }
.qty-btn:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.qty-container input.qty { width: calc(100% - 70px); height: 100%; border: none; text-align: center; border-left: 1px solid currentColor; border-right: 1px solid currentColor; color: inherit; font-size: 16px; -moz-appearance: textfield; padding: 0; margin: 0; box-sizing: border-box; outline: none; background: transparent; }
.qty-container input.qty::-webkit-outer-spin-button, .qty-container input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.add-to-cart-wrapper button.single_add_to_cart_button { background: var(--cs-highlight-color); color: #fff; border: none; width: 100%; height: 40px; font-size: 18px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; margin: 0; }

/* Variable Dropdowns */
.variation-select-wrapper select { flex-grow: 1; padding: 8px; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: inherit; }
.variation-select-wrapper select option { background: #fff; color: #000; }

/* Category Spacing */
.category-section { padding-top: 40px; border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent); margin-top: 40px; }
.category-section:first-child { padding-top: 0; border-top: none; margin-top: 0; }

/* Floating Cart Area */
.floating-cart-container { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; align-items: stretch; z-index: 9999; gap: 10px; font-family: "Source Sans Pro", "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; }
.floating-cart-container .floating-cart-btn { background-color: var(--cs-highlight-color); color: #fff; padding: 0.6180469716em 1.41575em; text-decoration: none; font-weight: 600; display: flex; gap: 8px; align-items: center; transition: background 0.3s; margin: 0; border: none; font-size: 100%; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.floating-cart-container .floating-cart-btn:hover { background-color: var(--cs-highlight-color); opacity: 0.9; color: #fff; }
.floating-cart-container .floating-cart-clear { background-color: #f44336; color: #fff; border: none; padding: 0 1em; font-size: 1.2em; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.3s; margin: 0; border-radius: 4px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.floating-cart-container .floating-cart-clear:hover { background-color: #d32f2f; color: #fff; }

/* Mobile Layout adjustments */
@media (max-width: 767px) {
    .custom-shop-container {
        flex-direction: column;
    }
    .shop-sidebar {
        width: 100%;
        height: auto;
        position: static;
        padding: 20px;
        border-right: none;
        border-bottom: 1px solid currentColor;
    }
    .shop-main-content {
        padding: 15px;
    }
    .product-top-row {
        flex-direction: column;
        gap: 15px;
    }
    .product-action-right {
        width: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
        margin-top: 10px;
        border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
        padding-top: 15px;
    }
    .product-price {
        margin-bottom: 0;
    }
    .add-to-cart-wrapper {
        width: 168px; /* Give it fixed width so it doesn't take 100% */
        align-items: flex-end;
    }
    .floating-cart-container {
        width: calc(100% - 40px);
        bottom: 20px;
    }
    .floating-cart-container .floating-cart-btn {
        flex-grow: 1;
        justify-content: center;
    }
    
    .mobile-overlay-panel {
        display: none;
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.8);
        z-index: 10000;
        align-items: center;
        justify-content: center;
        padding: 20px;
        box-sizing: border-box;
    }
    .mobile-overlay-panel.active {
        display: flex;
    }
    .mobile-overlay-content {
        background: var(--wp--preset--color--background, var(--cs-theme-bg, #fff)); color: currentColor;
        padding: 20px;
        border-radius: 8px;
        width: 100%;
        max-width: 400px;
        max-height: 80vh;
        overflow-y: auto;
        position: relative;
    }
    .close-overlay-btn {
        position: absolute;
        top: 15px;
        right: 15px;
        background: var(--wp--preset--color--background, var(--cs-theme-bg, #fff)); border: 1px solid currentColor;
        border: none;
        border-radius: 50%;
        width: 30px;
        height: 30px;
        font-size: 14px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: currentColor;
        padding: 0;
    }
    .close-overlay-btn:hover {
        background: color-mix(in srgb, currentColor 10%, transparent);
    }
    .overlay-title {
        margin-top: 0;
        margin-bottom: 15px;
    }
    
    .mobile-floating-actions {
        /* Container no longer needs flex as children are absolute/fixed */
    }
    #mobile-search-btn {
        position: fixed;
        bottom: 90px;
        right: 20px;
        z-index: 9998;
    }
    #mobile-cat-btn {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 9998;
    }
    .mobile-floating-btn {
        background: var(--cs-highlight-color);
        color: #fff;
        border: none;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
        font-size: 20px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: transform 0.2s;
    }
    .mobile-floating-btn:active {
        transform: scale(0.95);
    }
}
@media (min-width: 768px) {
    .mobile-floating-actions {
        display: none;
    }
    .mobile-overlay-panel {
        display: block !important;
        position: static;
        background: none;
        z-index: auto;
        padding: 0;
    }
    .mobile-overlay-content {
        background: none;
        padding: 0;
        border-radius: 0;
        width: auto;
        max-width: none;
        max-height: none;
        overflow-y: visible;
    }
    .close-overlay-btn, .overlay-title {
        display: none;
    }
}
