/**
 * Glogglz Cart Flyout Styles
 * 
 * Surf & kitesurf themed webshop
 * 
 * @package Glogglz
 * @since 1.0.0
 */

/* ==========================================================================
   CART FLYOUT CONTAINER
   ========================================================================== */
#glCartFlyout {
    position: fixed;
    inset: 0;
    z-index: 99999;
    visibility: hidden;
    pointer-events: none;
}

#glCartFlyout[aria-hidden="false"],
#glCartFlyout.is-open {
    visibility: visible;
    pointer-events: auto;
}

/* ==========================================================================
   OVERLAY
   ========================================================================== */
.gl-cart-flyout__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
    transition: all 0.35s ease;
    cursor: pointer;
}

#glCartFlyout.is-open .gl-cart-flyout__overlay {
    background: rgba(6, 182, 212, 0.3);
    backdrop-filter: blur(4px);
}

/* ==========================================================================
   DRAWER
   ========================================================================== */
.gl-cart-flyout__drawer {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 460px;
    background: var(--gl-white);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -20px 0 60px rgba(15, 23, 42, 0.15);
}

#glCartFlyout.is-open .gl-cart-flyout__drawer {
    transform: translateX(0);
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.gl-cart-flyout__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--gl-white);
    border-bottom: 1px solid var(--gl-border);
}

.gl-cart-flyout__title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gl-gray-900);
    margin: 0;
}

.gl-cart-flyout__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: var(--gl-ocean);
    color: var(--gl-gray-900);
    font-size: 0.875rem;
    font-weight: 700;
    border-radius: var(--gl-radius-full);
}

.gl-cart-flyout__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-lg);
    color: var(--gl-gray-400);
    cursor: pointer;
    transition: all var(--gl-transition-base);
}

.gl-cart-flyout__close:hover {
    background: var(--gl-gray-50);
    border-color: var(--gl-brand);
    color: var(--gl-brand);
}

/* ==========================================================================
   FREE SHIPPING PROGRESS
   ========================================================================== */
.gl-cart-flyout__shipping {
    padding: 16px 24px;
    background: var(--gl-white);
    border-bottom: 1px solid var(--gl-border);
}

.gl-cart-flyout__shipping-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--gl-gray-700);
    margin-bottom: 10px;
}

.gl-cart-flyout__shipping-text svg {
    color: var(--gl-brand);
    flex-shrink: 0;
}

.gl-cart-flyout__shipping-text strong {
    color: var(--gl-brand);
    font-weight: 700;
}

.gl-cart-flyout__shipping--complete .gl-cart-flyout__shipping-text {
    color: var(--gl-success);
}

.gl-cart-flyout__shipping--complete .gl-cart-flyout__shipping-text svg {
    color: var(--gl-success);
}

.gl-cart-flyout__progress {
    height: 6px;
    background: var(--gl-border);
    border-radius: var(--gl-radius-full);
    overflow: hidden;
}

.gl-cart-flyout__progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--gl-brand-dark), var(--gl-brand));
    border-radius: var(--gl-radius-full);
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.gl-cart-flyout__shipping--complete .gl-cart-flyout__progress-bar {
    background: linear-gradient(90deg, var(--gl-success), #34D399);
}

/* ==========================================================================
   CART ITEMS
   ========================================================================== */
.gl-cart-flyout__items {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--gl-border) transparent;
}

.gl-cart-flyout__items::-webkit-scrollbar {
    width: 6px;
}

.gl-cart-flyout__items::-webkit-scrollbar-track {
    background: transparent;
}

.gl-cart-flyout__items::-webkit-scrollbar-thumb {
    background: var(--gl-border);
    border-radius: 3px;
}

/* Single Cart Item */
.gl-cart-item {
    display: flex;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gl-border);
    transition: background-color var(--gl-transition-base);
    animation: gl-slide-in 0.3s ease;
}

@keyframes gl-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.gl-cart-item:hover {
    background: var(--gl-white);
}

.gl-cart-item.is-removing {
    animation: gl-slide-out 0.3s ease forwards;
}

@keyframes gl-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 150px;
    }
    to {
        opacity: 0;
        transform: translateX(100%);
        max-height: 0;
        padding: 0;
        margin: 0;
    }
}

/* Item Image */
.gl-cart-item__image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: var(--gl-white);
    border-radius: var(--gl-radius-lg);
    overflow: hidden;
}

.gl-cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Item Details */
.gl-cart-item__details {
    flex: 1;
    min-width: 0;
}

.gl-cart-item__name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gl-gray-900);
    margin: 0 0 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gl-cart-item__variant {
    font-size: 0.8125rem;
    color: var(--gl-gray-500);
    margin-bottom: 8px;
}

.gl-cart-item__price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gl-brand);
}

/* Item Actions */
.gl-cart-item__actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
}

.gl-cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--gl-gray-500);
    cursor: pointer;
    transition: all var(--gl-transition-base);
    border-radius: var(--gl-radius-md);
}

.gl-cart-item__remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--gl-error);
}

/* Quantity Controls */
.gl-cart-item__quantity {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--gl-white);
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-lg);
    overflow: hidden;
}

.gl-cart-item__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    color: var(--gl-gray-400);
    cursor: pointer;
    transition: all var(--gl-transition-fast);
}

.gl-cart-item__qty-btn:hover:not(:disabled) {
    background: var(--gl-gray-50);
    color: var(--gl-brand);
}

.gl-cart-item__qty-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gl-cart-item__qty-value {
    min-width: 32px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gl-gray-900);
}

/* ==========================================================================
   EMPTY CART
   ========================================================================== */
.gl-cart-flyout__empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
}

.gl-cart-flyout__empty-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    color: var(--gl-border);
}

.gl-cart-flyout__empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gl-gray-900);
    margin: 0 0 8px;
}

.gl-cart-flyout__empty-text {
    font-size: 0.9375rem;
    color: var(--gl-gray-500);
    margin: 0 0 24px;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.gl-cart-flyout__footer {
    padding: 24px;
    background: var(--gl-white);
    border-top: 1px solid var(--gl-border);
}

/* Subtotal */
.gl-cart-flyout__subtotal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.gl-cart-flyout__subtotal-label {
    font-size: 0.9375rem;
    color: var(--gl-gray-400);
}

.gl-cart-flyout__subtotal-value {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--gl-gray-900);
}

.gl-cart-flyout__shipping-note {
    font-size: 0.8125rem;
    color: var(--gl-gray-500);
    margin-bottom: 20px;
}

/* Buttons */
.gl-cart-flyout__buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gl-cart-flyout__checkout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: var(--gl-brand);
    color: var(--gl-gray-900);
    font-size: 1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-decoration: none;
    border: none;
    border-radius: var(--gl-radius-xl);
    cursor: pointer;
    transition: all var(--gl-transition-base);
}

.gl-cart-flyout__checkout:hover {
    background: var(--gl-brand-light);
    box-shadow: var(--gl-shadow-brand);
    transform: translateY(-2px);
}

.gl-cart-flyout__view-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    color: var(--gl-gray-900);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--gl-border);
    border-radius: var(--gl-radius-xl);
    transition: all var(--gl-transition-base);
}

.gl-cart-flyout__view-cart:hover {
    border-color: var(--gl-brand);
    color: var(--gl-brand);
}

/* ==========================================================================
   LOADING STATE
   ========================================================================== */
.gl-cart-flyout__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    z-index: 10;
}

.gl-cart-flyout__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gl-border);
    border-top-color: var(--gl-brand);
    border-radius: 50%;
    animation: gl-spin 0.8s linear infinite;
}

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

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 480px) {
    .gl-cart-flyout__drawer {
        max-width: 100%;
    }

    .gl-cart-flyout__header {
        padding: 16px;
    }

    .gl-cart-flyout__shipping {
        padding: 12px 16px;
    }

    .gl-cart-item {
        padding: 16px;
    }

    .gl-cart-item__image {
        width: 64px;
        height: 64px;
    }

    .gl-cart-flyout__footer {
        padding: 16px;
    }
}

/* ==========================================================================
   HEADER CART COUNT (for mini cart in header)
   ========================================================================== */
.gl-header__cart-count,
.gl-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--gl-brand);
    color: var(--gl-gray-900);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border-radius: var(--gl-radius-full);
    transition: transform 0.2s ease;
}

.gl-cart-count:empty,
.gl-cart-count[data-count="0"] {
    display: none;
}

.gl-cart-count.is-updating {
    animation: gl-pulse 0.3s ease;
}

@keyframes gl-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

