/* Floating Bar */
.okemaru-floating-bar {
    position: fixed;
    /* Use safe-area-inset for modern mobile browsers (iPhone notch/home bar) */
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 99998; /* Below modal */
    background: #ffffff;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.08);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    display: block !important; /* Override JS hide if visible class added */
    /* Add padding for safe area */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.okemaru-floating-bar.is-visible {
    transform: translateY(0);
}

.okemaru-floating-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.okemaru-floating-product-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    min-width: 0; /* allows text truncation */
}

.okemaru-floating-product-info img {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
    flex-shrink: 0;
}

.okemaru-floating-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.okemaru-floating-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.okemaru-floating-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--okemaru-floating-theme, #e22525);
}

.okemaru-floating-actions {
    flex-shrink: 0;
    margin-left: 20px;
}

.okemaru-floating-btn {
    background-color: var(--okemaru-floating-theme, #e22525);
    color: var(--okemaru-floating-text, #ffffff);
    border: none;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.2s, transform 0.1s;
    white-space: nowrap;
}

.okemaru-floating-btn:hover {
    filter: brightness(0.9);
}
.okemaru-floating-btn:active {
    transform: scale(0.98);
}

/* Bottom Sheet Modal for Variable Products */
.okemaru-floating-sheet {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.okemaru-floating-sheet.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.okemaru-floating-sheet-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.okemaru-floating-sheet-content {
    position: absolute;
    /* Fallback if JS safe area adjustment isn't active */
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    max-height: 80vh; /* changed from 85vh for better mobile toolbar clearance */
    /* Use calculated vh unit if available */
    max-height: calc(var(--okemaru-vh, 1vh) * 80);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.okemaru-floating-sheet.is-active .okemaru-floating-sheet-content {
    transform: translateY(0);
}

.okemaru-floating-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.okemaru-floating-sheet-product {
    display: flex;
    gap: 15px;
    align-items: center;
}

.okemaru-floating-sheet-product img {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    object-fit: cover;
}

.okemaru-floating-sheet-details {
    display: flex;
    flex-direction: column;
}

.okemaru-floating-sheet-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.okemaru-floating-sheet-price {
    font-size: 18px;
    font-weight: bold;
    color: var(--okemaru-floating-theme, #e22525);
}

.okemaru-floating-sheet-close {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    margin-top: -5px;
    transition: color 0.2s;
    background: #f5f5f5;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.okemaru-floating-sheet-close:hover {
    color: #333;
    background: #e8e8e8;
}

.okemaru-floating-sheet-body {
    padding: 20px;
    padding-bottom: 40px; /* Extends bottom padding so last items aren't obscured */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y; /* Ensure vertical scroll works when touching elements */
    flex: 1;
}

/* Fix mobile touch scrolling over options */
.okemaru-floating-sheet-body table.variations,
.okemaru-floating-sheet-body table.variations * {
    touch-action: pan-y;
}
.okemaru-floating-sheet-body table.variations label,
.okemaru-floating-sheet-body table.variations th,
.okemaru-floating-sheet-body table.variations td {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.okemaru-floating-sheet-body::-webkit-scrollbar {
    width: 6px;
}
.okemaru-floating-sheet-body::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 10px;
}
.okemaru-floating-sheet-body::-webkit-scrollbar-thumb {
    background: #ccc; 
    border-radius: 10px;
}
.okemaru-floating-sheet-body::-webkit-scrollbar-thumb:hover {
    background: #aaa; 
}

/* Specific overrides for WooCommerce form inside the sheet */
.okemaru-floating-sheet-body form.cart {
    margin-bottom: 0 !important;
}

.okemaru-floating-sheet-body table.variations {
    width: 100%;
    border: none;
    margin-bottom: 20px;
}

.okemaru-floating-sheet-body table.variations th,
.okemaru-floating-sheet-body table.variations td {
    border: none;
    padding: 10px 0;
    background: transparent;
    display: block; /* Stack on mobile */
    text-align: left;
}

.okemaru-floating-sheet-body table.variations th {
    padding-bottom: 5px;
    font-weight: 600;
    color: #444;
}

.okemaru-floating-sheet-body table.variations select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fafafa;
    font-size: 15px;
}

.okemaru-floating-sheet-body .woocommerce-variation-price {
    display: none; /* Hide internal price, we show it in header */
}

.okemaru-floating-sheet-body .woocommerce-variation-add-to-cart {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.okemaru-floating-sheet-body .quantity {
    margin-bottom: 0 !important;
}

.okemaru-floating-sheet-body .quantity input.qty {
    height: 48px;
    width: 60px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.okemaru-floating-sheet-body button.single_add_to_cart_button {
    flex: 1;
    height: 48px;
    background-color: var(--okemaru-floating-theme, #e22525) !important;
    color: var(--okemaru-floating-text, #ffffff) !important;
    border-radius: 24px;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    transition: transform 0.1s;
}

.okemaru-floating-sheet-body button.single_add_to_cart_button.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.okemaru-floating-sheet-body button.single_add_to_cart_button:not(.disabled):active {
    transform: scale(0.98);
}

/* Mobile specific styling */
@media (max-width: 768px) {
    .okemaru-floating-bar-inner {
        padding: 10px 15px;
    }
    .okemaru-floating-product-info img {
        display: none; /* Hide image on small screens to save space */
    }
    .okemaru-floating-title {
        font-size: 13px;
    }
    .okemaru-floating-price {
        font-size: 15px;
    }
    .okemaru-floating-btn {
        padding: 12px 24px;
        font-size: 16px;
    }
}

/* Force override variation swatches plugin interference */
.okemaru-floating-sheet-body .rtwpvs-terms-wrapper,
.okemaru-floating-sheet-body .rtwpvs-term,
.okemaru-floating-sheet-body .rtwpvs-term-span,
.okemaru-floating-sheet-body .tawcvs-swatches,
.okemaru-floating-sheet-body .swatch {
    touch-action: pan-y !important;
    -webkit-user-drag: none !important;
    pointer-events: auto !important;
}
