/**
 * Frontend styles for Fusertech Locations
 */

/* Hide add to cart button for out of stock products in selected store */
.woocommerce ul.products li.product.outofstock .button,
.woocommerce ul.products li.product.outofstock a.add_to_cart_button,
.woocommerce-page ul.products li.product.outofstock .button,
.woocommerce-page ul.products li.product.outofstock a.add_to_cart_button,
.woocommerce ul.products li.product.outofstock .btn-add-to-cart,
.woocommerce ul.products li.product.outofstock .add_to_cart.button,
.woocommerce-page ul.products li.product.outofstock .btn-add-to-cart,
.woocommerce-page ul.products li.product.outofstock .add_to_cart.button {
    display: none !important;
}

/* Hide custom add to cart button structure */
.woocommerce ul.products li.product.outofstock .btn-add-to-cart,
.woocommerce-page ul.products li.product.outofstock .btn-add-to-cart,
.woocommerce ul.products li.product.ft-out-of-stock-store .btn-add-to-cart,
.woocommerce-page ul.products li.product.ft-out-of-stock-store .btn-add-to-cart,
.woocommerce ul.products li.product.ft-out-of-stock-store .add_to_cart.button,
.woocommerce-page ul.products li.product.ft-out-of-stock-store .add_to_cart.button {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Out of stock label in loop (replaces add to cart button) */
.ft-out-of-stock-label {
    display: inline-block;
    padding: 0.5em 1em;
    color: #777;
    cursor: not-allowed;
}

/* Single product page: out of stock for selected store */
.ft-out-of-stock-single {
    margin: 0.75em 0;
}
.ft-out-of-stock-button {
    cursor: not-allowed;
    opacity: 0.85;
}
/* Hide entire cart form when product is out of stock for selected store (button & availability are in summary above) */
.product.ft-out-of-stock-store .cart {
    display: none !important;
}
/* Legacy single-product out of stock message */
.ft-out-of-stock-message {
    margin: 0.5em 0;
}

/* Available in (store names as tags) - blue & black theme */
.ft-available-in {
    margin: 0.85em 0;
    font-size: 0.9em;
    line-height: 1.6;
    padding: 0.5em 0;
}
/* Legacy format: <p class="ft-available-in"><strong>Available in:</strong> A, B</p> */
p.ft-available-in {
    color: #1a1a1a;
}
p.ft-available-in strong {
    color: #1a1a1a;
    font-weight: 600;
    margin-right: 0.35em;
}
.ft-available-in-label {
    font-weight: 600;
    color: #1a1a1a;
    margin-right: 0.5em;
    letter-spacing: 0.02em;
}
.ft-available-in-stores {
    display: inline;
}
.ft-available-in-tag {
    display: inline-block;
    margin: 0.2em 0.35em 0.2em 0;
    padding: 0.35em 0.65em;
    background: #e8f0f8;
    color: #1a365d;
    border: 1px solid #2563eb;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}
.ft-available-in-tag:not(:last-child) {
    margin-right: 0.2em;
}
.ft-available-in-tag:not(:last-child)::after {
    content: ", ";
    margin-right: 0.2em;
}

/* Not available in (store names as tags) */
.ft-not-available-in {
    margin: 0.5em 0 0.85em 0;
    font-size: 0.9em;
    line-height: 1.6;
    padding: 0.25em 0;
}
.ft-not-available-in-label {
    font-weight: 600;
    color: #1a1a1a;
    margin-right: 0.5em;
    letter-spacing: 0.02em;
}
.ft-not-available-in-stores {
    display: inline;
}
.ft-not-available-in-tag {
    display: inline-block;
    margin: 0.2em 0.35em 0.2em 0;
    padding: 0.35em 0.65em;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}
.ft-not-available-in-tag:not(:last-child) {
    margin-right: 0.2em;
}
.ft-not-available-in-tag:not(:last-child)::after {
    content: ", ";
    margin-right: 0.2em;
}

/* Store selector - blue & black theme */
.ft-store-selector {
    margin: 18px 0;
    padding: 0;
    background: #fff;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ft-store-selector label {
    display: block;
    margin: 0;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: #1a1a1a;
}

.ft-store-selector .ft-store-select {
    width: 100%;
    margin: 0;
    padding: 14px 40px 14px 16px;
    border: none;
    border-top: 1px solid #e5e7eb;
    border-radius: 0;
    font-size: 15px;
    font-weight: 500;
    color: #1a1a1a;
    background: #fff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%231a365d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.ft-store-selector .ft-store-select:hover {
    background-color: #f8fafc;
}

.ft-store-selector .ft-store-select:focus {
    outline: none;
    background-color: #f0f7ff;
    box-shadow: inset 0 0 0 2px #2563eb;
}

.ft-store-selector.ft-compact {
    margin: 12px 0;
}

.ft-store-selector.ft-compact label {
    padding: 10px 14px;
    font-size: 0.8em;
}

.ft-store-selector.ft-compact .ft-store-select {
    padding: 12px 36px 12px 14px;
    font-size: 14px;
}

.ft-store-selector-message {
    margin: 0;
    padding: 10px 16px;
    border-radius: 0;
    display: none;
    font-size: 13px;
    border-top: 1px solid #e5e7eb;
}

.ft-store-selector-message.success {
    background: #ecfdf5;
    color: #065f46;
    border-top: 1px solid #a7f3d0;
    display: block;
}

.ft-store-selector-message.error {
    background: #fef2f2;
    color: #991b1b;
    border-top: 1px solid #fecaca;
    display: block;
}

/* Selected Store block - hidden (store is shown in selector above) */
.ft-selected-store-info {
    display: none !important;
}

.ft-selected-store-info p {
    margin: 0;
}

/* Checkout Store Info */
.ft-checkout-store-info {
    margin: 0 0 20px 0;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #0073aa;
    border-radius: 6px;
    border-left: 4px solid #0073aa;
}

.ft-checkout-store-message {
    margin: 0;
    font-size: 15px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ft-checkout-store-message strong {
    color: #0073aa;
    font-weight: 600;
}

.ft-checkout-store-name {
    font-weight: 600;
    color: #0073aa;
    font-size: 16px;
}

.ft-checkout-store-location {
    color: #666;
    font-size: 14px;
}

/* Current Store Display - Compact inline version */
.ft-current-store-display {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin: 5px 0;
    flex-wrap: nowrap;
    font-size: 14px;
}

.ft-current-store-label {
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
    font-size: 14px;
    margin: 0;
}

.ft-current-store-name {
    font-weight: 500;
    color: #0073aa;
    font-size: 14px;
    white-space: nowrap;
}

.ft-current-store-select {
    min-width: 150px;
    max-width: 200px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #333;
    cursor: pointer;
    height: 32px;
    line-height: 20px;
}

.ft-current-store-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.ft-change-store-link {
    margin-left: auto;
    color: #0073aa;
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border: 1px solid #0073aa;
    border-radius: 4px;
    transition: all 0.2s;
    white-space: nowrap;
}

.ft-change-store-link:hover {
    background: #0073aa;
    color: #fff;
    text-decoration: none;
}

/* Store Popup Modal */
.ft-store-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ft-store-popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(2px);
}

.ft-store-popup-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
    animation: ft-popup-fade-in 0.3s ease-out;
}

@keyframes ft-popup-fade-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ft-store-popup-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.ft-store-popup-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

.ft-store-popup-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #666;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ft-store-popup-close span {
    font-size: 32px;
    line-height: 1;
    font-weight: 300;
}

.ft-store-popup-close:hover {
    color: #000;
}

.ft-store-popup-body {
    padding: 25px;
}

.ft-store-popup-description {
    margin: 0 0 20px 0;
    color: #666;
    line-height: 1.6;
}

.ft-store-popup-selector {
    margin-bottom: 20px;
}

.ft-store-popup-selector label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.ft-store-popup-selector .ft-store-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: #fff;
    transition: border-color 0.2s;
}

.ft-store-popup-selector .ft-store-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.ft-store-popup-message {
    margin-bottom: 20px;
    padding: 12px 15px;
    border-radius: 6px;
    display: none;
    font-size: 14px;
}

.ft-store-popup-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.ft-store-popup-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.ft-store-popup-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.ft-store-popup-actions .button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-block;
}

.ft-store-popup-actions .button-primary {
    background: #0073aa;
    color: #fff;
}

.ft-store-popup-actions .button-primary:hover {
    background: #005a87;
    color: #fff;
}

.ft-store-popup-actions .button-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.ft-store-popup-actions .button-secondary {
    background: #f0f0f0;
    color: #333;
}

.ft-store-popup-actions .button-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* Responsive */
@media (max-width: 600px) {
    .ft-store-popup-content {
        width: 95%;
        margin: 20px;
    }
    
    .ft-store-popup-header {
        padding: 15px 20px;
    }
    
    .ft-store-popup-header h2 {
        font-size: 20px;
    }
    
    .ft-store-popup-body {
        padding: 20px;
    }
    
    .ft-store-popup-actions {
        flex-direction: column;
    }
    
    .ft-store-popup-actions .button {
        width: 100%;
    }
}
