/**
 * OM Side Cart Styles
 *
 * @since 2.1.0
 */

/* =========================================================================
   Overlay
   ========================================================================= */

.om-sc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999998;
}

.om-sc-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================================================
   Floating Trigger Button
   ========================================================================= */

.om-sc-trigger {
    position: fixed;
    bottom: var(--om-sc-icon-offset, 30px);
    z-index: 999997;
    width: calc(var(--om-sc-icon-size, 25px) * 2.2) !important;
    height: calc(var(--om-sc-icon-size, 25px) * 2.2) !important;
    min-height: unset !important;
    max-height: none !important;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--om-sc-icon-bg, #212121);
    color: var(--om-sc-icon-color, #ffffff);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.om-sc-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.om-sc-trigger:focus {
    outline: 2px solid var(--om-sc-icon-bg, #212121);
    outline-offset: 2px;
}

.om-sc-trigger-right {
    right: var(--om-sc-icon-offset, 30px);
}

.om-sc-trigger-left {
    left: var(--om-sc-icon-offset, 30px);
}

.om-sc-trigger svg {
    width: var(--om-sc-icon-size, 25px);
    height: var(--om-sc-icon-size, 25px);
    stroke: currentColor;
}

.om-sc-trigger-count {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--om-sc-counter-bg, #757575);
    color: var(--om-sc-counter-color, #ffffff);
    font-size: 11px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
}

.om-sc-trigger[data-count="0"] .om-sc-trigger-count {
    display: none;
}

/* Hide trigger when cart panel is open */
.om-sc-trigger.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* =========================================================================
   Side Cart Panel
   ========================================================================= */

.om-sc-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--om-sc-panel-width, 400px);
    max-width: 100vw;
    background: var(--om-sc-panel-bg, #ffffff);
    color: var(--om-sc-panel-text, #333333);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.om-sc-panel-right {
    right: 0;
    transform: translateX(100%);
}

.om-sc-panel-left {
    left: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.om-sc-panel.active {
    transform: translateX(0);
}

/* =========================================================================
   Panel Header
   ========================================================================= */

.om-sc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--om-sc-panel-header-bg, #f5f5f5);
    border-bottom: 1px solid var(--om-sc-panel-border, #e0e0e0);
    flex-shrink: 0;
}

.om-sc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--om-sc-panel-header-text, #333333);
}

.om-sc-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--om-sc-panel-header-text, #333333);
    cursor: pointer;
    transition: background 0.2s ease;
}

.om-sc-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.om-sc-close svg {
    width: 20px;
    height: 20px;
}

/* =========================================================================
   Panel Content
   ========================================================================= */

.om-sc-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Free Shipping Bar in Side Cart */
.om-sc-free-shipping {
    padding: 12px 16px;
    background: var(--om-sc-panel-header-bg, #f5f5f5);
    border-bottom: 1px solid var(--om-sc-panel-border, #e0e0e0);
}

.om-sc-free-shipping .om-fs-wrap {
    margin: 0;
}

.om-sc-free-shipping .om-fs-card {
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
}

/* Brand Gift Offers in Side Cart */
.om-sc-brand-gifts {
    padding: 0;
}

.om-sc-brand-gifts:empty {
    display: none;
}

.om-bg-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--om-sc-panel-header-bg, #f5f5f5);
    border-bottom: 1px solid var(--om-sc-panel-border, #e0e0e0);
}

.om-bg-wrap.om-bg-qualified {
    background: #d4edda; /* overridden by inline style when custom color is set */
}

.om-bg-image img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

.om-bg-info {
    flex: 1;
    min-width: 0;
}

.om-bg-msg {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 4px;
    color: var(--om-sc-panel-text, #333);
}

/* Layout: image only */
.om-bg-layout-image_only {
    justify-content: center;
    flex-wrap: wrap;
}

.om-bg-layout-image_only .om-bg-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80px;
}

.om-bg-layout-image_only .om-bg-gift-choice {
    width: 100%;
    text-align: center;
}

/* Layout: image on top */
.om-bg-layout-image_top {
    flex-direction: column;
    text-align: center;
}

.om-bg-layout-image_top .om-bg-image {
    margin-bottom: 6px;
}

.om-bg-layout-image_top .om-bg-image img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 80px;
}

.om-bg-gift-choice {
    margin: 4px 0;
}

.om-bg-gift-select {
    width: 100%;
    font-size: 11px;
    padding: 3px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
}

.om-bg-bar-wrap {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
}

.om-bg-bar-bg {
    height: 100%;
    background: #e0e0e0;
    border-radius: 3px;
}

.om-bg-bar-fg {
    height: 100%;
    background: #e8a317;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.om-bg-qualified .om-bg-bar-fg {
    background: #28a745;
}

/* Gift item in side cart */
.om-sc-gift-item {
    grid-template-columns: 70px 1fr;
    padding: 12px 16px;
    margin: 0 -16px;
    align-items: center;
    border-bottom-color: transparent;
}

.om-sc-gift-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px 14px;
    border-radius: 10px;
    min-height: 60px;
}

.om-sc-gift-heading {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #b8860b;
    margin-bottom: 3px;
}

.om-sc-gift-heading del {
    color: #999;
    text-decoration: line-through;
}

.om-sc-gift-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--om-sc-panel-text, #333);
}

.om-sc-gift-name a {
    color: inherit;
    text-decoration: none;
}

.om-sc-gift-price del {
    text-decoration: line-through;
}

.om-sc-gift-item .om-bg-gift-choice {
    margin-top: 6px;
}

/* Legacy - kept for backward compat */
.om-bg-gift-badge {
    display: inline-block;
    background: #e8a317;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

/* =========================================================================
   Cart Items
   ========================================================================= */

.om-sc-items {
    flex: 1;
    padding: 0 16px;
    overflow-y: auto;
}

.om-sc-item {
    position: relative;
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--om-sc-panel-border, #e0e0e0);
    align-items: start;
}

.om-sc-item:last-child {
    border-bottom: none;
}

/* Remove Button */
.om-sc-item-remove {
    position: absolute;
    top: 12px;
    left: 0;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #999;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, color 0.2s ease;
    z-index: 1;
}

.om-sc-item:hover .om-sc-item-remove {
    opacity: 1;
}

.om-sc-item-remove:hover {
    color: #e53935;
}

.om-sc-item-remove svg {
    width: 16px;
    height: 16px;
}

/* Product Image */
.om-sc-item-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.om-sc-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.om-sc-item-image a {
    display: block;
}

/* Product Details */
.om-sc-item-details {
    min-width: 0;
}

.om-sc-item-name {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 4px;
}

.om-sc-item-name a {
    color: inherit;
    text-decoration: none;
}

.om-sc-item-name a:hover {
    text-decoration: underline;
}

.om-sc-item-details .variation {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.om-sc-item-price {
    font-size: 13px;
    color: #666;
}

.om-sc-item-price del {
    color: #999;
    margin-right: 4px;
}

.om-sc-item-qty-price {
    color: #999;
    font-size: 12px;
}

/* Product Actions */
.om-sc-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* Quantity Controls */
.om-sc-item-quantity {
    display: flex;
    align-items: center;
    border: 1px solid var(--om-sc-panel-border, #e0e0e0);
    border-radius: 4px;
    overflow: hidden;
}

.om-sc-qty-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--om-sc-panel-text, #333333);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.om-sc-qty-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.om-sc-qty-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.om-sc-qty-input {
    width: 44px;
    height: 28px;
    padding: 0 4px;
    border: none;
    border-left: 1px solid var(--om-sc-panel-border, #e0e0e0);
    border-right: 1px solid var(--om-sc-panel-border, #e0e0e0);
    text-align: center;
    font-size: 14px;
    -moz-appearance: textfield;
}

.om-sc-qty-input::-webkit-outer-spin-button,
.om-sc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Item Total */
.om-sc-item-total {
    font-size: 14px;
    font-weight: 600;
    color: var(--om-sc-panel-text, #333333);
}

/* =========================================================================
   Cart Savings
   ========================================================================= */

.om-sc-savings {
    padding: 12px 16px;
    background: #e8f5e9;
    color: #2e7d32;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

/* =========================================================================
   Coupon Section
   ========================================================================= */

.om-sc-coupon {
    padding: 12px 16px;
    border-top: 1px solid var(--om-sc-panel-border, #e0e0e0);
}

.om-sc-coupon-form {
    display: flex;
    gap: 8px;
}

.om-sc-coupon-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--om-sc-panel-border, #e0e0e0);
    border-radius: 4px;
    font-size: 14px;
}

.om-sc-coupon-input:focus {
    outline: none;
    border-color: var(--om-sc-checkout-bg, #212121);
}

.om-sc-coupon-btn {
    padding: 10px 16px;
    border: 1px solid var(--om-sc-panel-border, #e0e0e0);
    border-radius: 4px;
    background: transparent;
    color: var(--om-sc-panel-text, #333333);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.om-sc-coupon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.om-sc-applied-coupons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.om-sc-coupon-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #e3f2fd;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #1565c0;
}

.om-sc-coupon-remove {
    width: 16px;
    height: 16px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    color: #1565c0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease;
}

.om-sc-coupon-remove:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* =========================================================================
   Panel Footer
   ========================================================================= */

.om-sc-footer {
    padding: 16px;
    background: var(--om-sc-panel-bg, #ffffff);
    border-top: 1px solid var(--om-sc-panel-border, #e0e0e0);
    flex-shrink: 0;
}

.om-sc-subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 16px;
}

.om-sc-subtotal-label {
    font-weight: 500;
}

.om-sc-subtotal-value {
    font-weight: 600;
}

.om-sc-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.om-sc-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.om-sc-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.om-sc-btn-checkout {
    background: var(--om-sc-checkout-bg, #212121);
    color: var(--om-sc-checkout-text, #ffffff);
}

.om-sc-btn-view-cart {
    background: var(--om-sc-view-cart-bg, transparent);
    color: var(--om-sc-view-cart-text, #333333);
    border: 1px solid var(--om-sc-panel-border, #e0e0e0);
}

/* =========================================================================
   Empty Cart
   ========================================================================= */

.om-sc-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.om-sc-empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    color: #ccc;
}

.om-sc-empty-icon svg {
    width: 100%;
    height: 100%;
    stroke-width: 1.5;
}

.om-sc-empty-text {
    font-size: 16px;
    color: #666;
    margin-bottom: 24px;
}

.om-sc-btn-continue {
    background: var(--om-sc-checkout-bg, #212121);
    color: var(--om-sc-checkout-text, #ffffff);
    max-width: 200px;
}

/* =========================================================================
   Loading State
   ========================================================================= */

.om-sc-loading {
    position: relative;
    pointer-events: none;
}

.om-sc-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.om-sc-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid var(--om-sc-panel-border, #e0e0e0);
    border-top-color: var(--om-sc-checkout-bg, #212121);
    border-radius: 50%;
    animation: om-sc-spin 0.8s linear infinite;
    z-index: 1;
}

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

/* =========================================================================
   Mobile Styles
   ========================================================================= */

@media (max-width: 480px) {
    .om-sc-panel {
        width: 100%;
    }

    .om-sc-item {
        grid-template-columns: 60px 1fr;
    }

    .om-sc-item-actions {
        grid-column: 1 / -1;
        flex-direction: row;
        justify-content: space-between;
        margin-top: 8px;
    }

    .om-sc-trigger {
        bottom: 20px;
    }

    .om-sc-trigger-right {
        right: 20px;
    }

    .om-sc-trigger-left {
        left: 20px;
    }
}

/* =========================================================================
   Admin Styles (side-cart-admin.css)
   ========================================================================= */
