/**
 * Zonesoft Multistore Styles
 * 
 * Styles for the multistore functionality including store switcher
 */

/* Store Switcher Styles */
.zonesoft-store-switcher {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.store-switcher-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.store-switcher-label {
    font-weight: 600;
    color: #495057;
    margin: 0;
    white-space: nowrap;
}

.store-switcher-select {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.store-switcher-select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.store-switcher-select:disabled {
    background-color: #e9ecef;
    opacity: 1;
}

.store-switcher-loading {
    color: #6c757d;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 5px;
}

.store-switcher-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #6c757d;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Notification Styles */
.zonesoft-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.zonesoft-notification-success {
    background-color: #28a745;
    border-left: 4px solid #1e7e34;
}

.zonesoft-notification-error {
    background-color: #dc3545;
    border-left: 4px solid #bd2130;
}

.zonesoft-notification-info {
    background-color: #17a2b8;
    border-left: 4px solid #117a8b;
}

/* Store Information in Cart */
.woocommerce-cart-form__cart-item .store-info {
    font-size: 0.85em;
    color: #6c757d;
    margin-top: 4px;
}

.woocommerce-cart-form__cart-item .store-info::before {
    content: "📍 ";
}

/* Product Store Availability */
.product-store-availability {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    border-left: 4px solid #28a745;
}

.product-store-availability h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #495057;
}

.store-availability-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.store-availability-list li {
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.store-name {
    font-weight: 500;
    color: #495057;
}

.store-stock-cell {
    display: flex;
    align-items: center;
}

.store-stock-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
}

.store-stock-dot--in-stock {
    background-color: #28a745;
}

.store-stock-dot--low-stock {
    background-color: #fd7e14;
}

.store-stock-dot--out-of-stock {
    background-color: #dc3545;
}

.store-stock {
    font-size: 0.9em;
    color: #6c757d;
}

.store-stock.in-stock {
    color: #28a745;
}

.store-stock.out-of-stock {
    color: #dc3545;
}

.store-stock.low-stock {
    color: #fd7e14;
}

/* Responsive Design */
@media (max-width: 768px) {
    .store-switcher-wrapper {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .store-switcher-select {
        min-width: auto;
    }
    
    .zonesoft-notification {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}

/* WooCommerce Integration */
.woocommerce .zonesoft-store-switcher {
    margin-bottom: 1.5em;
}

.single-product .zonesoft-store-switcher {
    margin-bottom: 1em;
}

/* Admin Bar Spacing */
body.admin-bar .zonesoft-notification {
    top: 52px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .zonesoft-notification {
        top: 66px;
    }
}

/* Theme Compatibility */
.theme-storefront .zonesoft-store-switcher,
.theme-astra .zonesoft-store-switcher,
.theme-oceanwp .zonesoft-store-switcher {
    margin-bottom: 1.618em;
}

/* Loading State */
.zonesoft-store-switcher.loading {
    opacity: 0.7;
    pointer-events: none;
}

.zonesoft-store-switcher.loading .store-switcher-select {
    cursor: not-allowed;
}

/* Success State */
.zonesoft-store-switcher.success {
    border-color: #28a745;
    background-color: #f8fff9;
}

/* Error State */
.zonesoft-store-switcher.error {
    border-color: #dc3545;
    background-color: #fff8f8;
}

/* Store Entry Modal */
.zonesoft-store-entry-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.zonesoft-store-entry-modal.is-visible {
    display: flex;
}

.zonesoft-store-entry-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.zonesoft-store-entry-panel {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px 24px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.zonesoft-store-entry-close {
    position: absolute;
    top: 12px;
    right: 14px;
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
}

.zonesoft-store-entry-panel h2 {
    margin: 0 0 16px;
    font-size: 1.35rem;
    text-align: center;
}

.zonesoft-store-entry-desc,
.zonesoft-store-entry-note {
    text-align: center;
    color: #666;
    font-size: 0.95rem;
}

.zonesoft-store-entry-note {
    margin-top: 12px;
    font-size: 0.85rem;
}

.zonesoft-store-entry-choices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 8px;
}

.zonesoft-store-entry-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 140px;
    padding: 20px 16px;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    background: #f8f9fa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.zonesoft-store-entry-choice:hover,
.zonesoft-store-entry-choice:focus {
    border-color: #28a745;
    background: #f0fff4;
    outline: none;
}

.zonesoft-store-entry-choice-label {
    font-weight: 600;
    font-size: 1rem;
    text-align: center;
}

.zonesoft-store-entry-choice-sub {
    font-size: 0.85rem;
    color: #666;
}

.zonesoft-store-entry-icon {
    width: 48px;
    height: 48px;
    display: block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.zonesoft-icon-delivery {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='%2328a745'%3E%3Cpath d='M4 44h4v4H4zm44-8h8l6 8v8h-4a8 8 0 1 1-16 0H26a8 8 0 1 1-16 0H4v-8l8-16h24v8zm-8 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm-30 0a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 28h20v-4H16z'/%3E%3C/svg%3E");
}

.zonesoft-icon-store {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='%2328a745'%3E%3Cpath d='M8 24 32 8l24 16v4H8zm4 8h40v24H12zm8 8v8h8v-8zm16 0v8h8v-8z'/%3E%3C/svg%3E");
}

.zonesoft-store-entry-back {
    border: 0;
    background: transparent;
    color: #0073aa;
    cursor: pointer;
    padding: 0 0 12px;
    font-size: 0.9rem;
}

.zonesoft-store-entry-postcode-row {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.zonesoft-store-entry-postcode-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 1rem;
}

.zonesoft-store-entry-submit,
.zonesoft-store-entry-store-btn {
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: #28a745;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.zonesoft-store-entry-store-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 100px;
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
}

.zonesoft-store-entry-store-btn:hover {
    border-color: #28a745;
    background: #f0fff4;
}

.zonesoft-store-entry-stores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.zonesoft-store-entry-error {
    color: #dc3545;
    text-align: center;
    margin-top: 10px;
}

.zonesoft-store-entry-current {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
}

body.zonesoft-entry-modal-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .zonesoft-store-entry-choices,
    .zonesoft-store-entry-stores {
        grid-template-columns: 1fr;
    }

    .zonesoft-store-entry-postcode-row {
        flex-direction: column;
    }
}

/* Sticky header helper */
body.zonesoft-has-sticky-header .zonesoft-sticky-header-target {
    position: sticky;
    top: 0;
    z-index: 999;
    background: #fff;
}

body.admin-bar.zonesoft-has-sticky-header .zonesoft-sticky-header-target {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar.zonesoft-has-sticky-header .zonesoft-sticky-header-target {
        top: 46px;
    }
}

/* Oportunidades sidebar item */
.zonesoft-subcategories .subcategory-item.zonesoft-oportunidades-item > .subcategory-link,
.zonesoft-subcategories-wrap .subcategory-item.zonesoft-oportunidades-item > .subcategory-link {
    color: #dc3545;
    font-weight: 600;
}

.zonesoft-oportunidades-icon {
    margin-right: 6px;
}

/* Product filters */
.zonesoft-product-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.5em;
    align-items: center;
}

.zonesoft-product-filters input[type="search"],
.zonesoft-product-filters select {
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    min-width: 200px;
}

.zonesoft-product-filters .zonesoft-filter-search {
    flex: 1;
    min-width: 220px;
}

.zonesoft-product-filters-sticky {
    position: sticky;
    top: 80px;
    z-index: 90;
    background: #fff;
    padding: 12px 0;
}

/* Oportunidades product grid */
.zonesoft-oportunidades-grid {
    display: grid;
    gap: 20px;
    margin: 0 0 2em;
}

.zonesoft-oportunidades-grid.columns-2 { grid-template-columns: repeat(2, 1fr); }
.zonesoft-oportunidades-grid.columns-3 { grid-template-columns: repeat(3, 1fr); }
.zonesoft-oportunidades-grid.columns-4 { grid-template-columns: repeat(4, 1fr); }

.zonesoft-oportunidades-card {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    text-align: center;
}

.zonesoft-oportunidades-card img {
    width: 100%;
    height: auto;
    display: block;
}

.zonesoft-oportunidades-card-body {
    padding: 12px;
}

.zonesoft-oportunidades-card .price {
    color: #dc3545;
    font-weight: 600;
}

.zonesoft-oportunidades-card .price del {
    color: #999;
    font-weight: 400;
}

@media (max-width: 768px) {
    .zonesoft-oportunidades-grid.columns-3,
    .zonesoft-oportunidades-grid.columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
} 