/**
 * WooCommerce Sticky Product Header Styles
 * Handles sticky header for single product pages
 */

@import '../variables.css';

/* === STICKY PRODUCT HEADER === */

.sticky-product-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: white;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.sticky-product-header.active {
    transform: translateY(0);
}

.sticky-header-content {
    display: flex;
    align-items: center;
    padding: var(--spacing-4) 0;
    gap: var(--spacing-6);
}

/* Sticky Logo */

.sticky-logo {
    flex: 0 0 auto;
    width: 200px; /* Fixed width like main header */
}

.sticky-logo img {
    max-height: 160px;
    width: auto;
    display: block;
}

.sticky-logo a {
    text-decoration: none;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-lg);
    color: var(--color-primary);
    display: block;
}

/* Sticky Product Info */

.sticky-product-info {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 1fr;
    align-items: center;
    gap: var(--spacing-4);
    flex: 1;
    height: 100%;
}

.sticky-product-image {
    flex: 0 0 auto;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-product-image img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: var(--border-radius-md);
    display: block;
}

.sticky-product-details {
    flex: 1;
    min-width: 0; /* Allow text truncation */
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.sticky-product-title {
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    color: var(--color-primary);
    margin: 0 0 var(--spacing-1) 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.sticky-product-price {
    font-family: var(--font-primary);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    font-size: var(--font-size-base);
}

/* Sticky Add to Cart Section */

.sticky-add-to-cart {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    height: 100%;
    justify-content: end;
}
.sticky-add-to-cart .btn {
    width: auto;
    padding: var(--spacing-2) var(--spacing-3);
    background: var(--color-primary-alt);
    border: none;
    border-radius: var(--border-radius-md);
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sticky-product-header .container {
    padding: var(--spacing-2);
    margin: 0 auto;
}

.sticky-cart-form {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
    margin: 0;
}

/* Sticky Quantity Controls */

.sticky-quantity-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    height: 36px;
}

.sticky-qty-btn {
    background: var(--color-white);
    border: none;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-tertiary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.sticky-qty-btn:hover {
    background: var(--color-primary-lighter);
    color: var(--color-primary);
}

.sticky-qty {
    width: 50px;
    height: 36px;
    padding: 0;
    border: none;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    text-align: center;
    font-family: var(--font-tertiary);
    font-size: var(--font-size-sm);
    background: var(--color-white);
    -moz-appearance: textfield;
    appearance: textfield;
}

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

.sticky-qty:focus {
    outline: none;
    background: var(--color-white-primary);
}

/* Responsive Sticky Header */
@media (max-width: 1024px) {

    .sticky-header-content {
        gap: var(--spacing-4);
    }
}

@media (max-width: 768px) {
    .sticky-logo {
        display: none; /* Hide logo on mobile for more space */
    }

    .sticky-header-content {
        gap: var(--spacing-3);
        padding: var(--spacing-2) 0;
    }

    .sticky-product-image img {
        width: 40px;
        height: 40px;
    }

    .sticky-product-title {
        font-size: var(--font-size-sm);
    }

    .sticky-product-price {
        font-size: var(--font-size-sm);
    }

    .sticky-quantity-wrapper,
    .sticky-qty-btn,
    .sticky-qty {
        height: 32px;
    }

    .sticky-qty-btn {
        width: 32px;
        font-size: var(--font-size-xs);
    }

    .sticky-qty {
        width: 40px;
        font-size: var(--font-size-xs);
    }
}

@media (max-width: 480px) {
    .sticky-product-info {
        grid-template-columns: 1fr 1fr;
    }

    .sticky-product-details {
        display: none; /* Hide title and price on very small screens */
    }

    .sticky-header-content {
        justify-content: space-between;
    }
}

@media (max-width: 320px) {
    .sticky-qty {
        width: 20px;
    }
}