/**
 * Booking Cart Widget Styles
 * Popover style (similar to old booking widget)
 *
 * @package NaturRo
 */

/* ==================================================================
   EMBEDDED STRIPE CHECKOUT ON BOOKING PAGE
   ================================================================== */

/* Wrapper for embedded checkout to control layout */
.stripe-embedded-checkout-wrapper {
    width: 100%;
    margin: 2rem 0;
    display: flex;
    justify-content: center;
    background: transparent;
}

.stripe-embedded-checkout {
    width: 100%;
    min-height: 600px;
    margin: 0;
    display: block;
}

/* Ensure embedded checkout container is visible and uses full width */
#stripe-checkout-embedded {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 600px;
    margin: 0;
    padding: 0;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Force Stripe's embedded checkout iframe to use full width */
#stripe-checkout-embedded iframe,
#stripe-checkout-embedded > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100%;
}

/* Responsive adjustments for embedded checkout */
@media (min-width: 1024px) {
    .stripe-embedded-checkout-wrapper {
        margin: 3rem 0;
    }
    
    #stripe-checkout-embedded {
        min-height: 800px;
        border-radius: 16px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .stripe-embedded-checkout-wrapper {
        margin: 2rem 0;
    }
    
    #stripe-checkout-embedded {
        min-height: 700px;
    }
}

@media (max-width: 767px) {
    .stripe-embedded-checkout-wrapper {
        margin: 1rem 0;
    }
    
    .stripe-embedded-checkout {
        margin: 0;
    }
    
    #stripe-checkout-embedded {
        min-height: 500px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

/* ==================================================================
   FLOATING CART WIDGET (Popover Style)
   ================================================================== */

.floating-cart-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: min(360px, calc(100vw - 2rem));
    z-index: 1000;
    color: white;
    font-family: inherit;
}

/* Trigger Button */
.floating-cart-trigger {
    width: 100%;
    background: var(--color-green, #00400e);
    color: white;
    border: none;
    border-radius: var(--floating-radius, 12px);
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: border-radius 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.floating-cart-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
}

.floating-cart-widget.open .floating-cart-trigger {
    border-radius: var(--floating-radius, 12px) var(--floating-radius, 12px) 0 0;
}

.floating-cart-trigger i {
    font-size: 1.25rem;
}

.cart-trigger-text {
    flex: 1;
    text-align: left;
}

.cart-count-badge {
    background: var(--color-accent, #ff0000);
    color: white;
    border-radius: 50%;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    padding: 0 0.375rem;
    border: 2px solid white;
}

.floating-cart-arrow {
    transition: transform 0.3s ease;
    font-size: 1rem;
}

.floating-cart-widget.open .floating-cart-arrow {
    transform: rotate(180deg);
}

/* Popover Panel */
.floating-cart-overlay {
    background: var(--color-green, #00400e);
    color: white;
    border-radius: 0 0 var(--floating-radius, 12px) var(--floating-radius, 12px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    max-height: 0;
    transition: max-height 0.35s ease;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
}

.floating-cart-widget.open .floating-cart-overlay {
    max-height: clamp(400px, 75vh, 600px);
    opacity: 1;
    visibility: visible;
}

/* Trip dates (current trip) – shown at top of overlay on single trip page */
.cart-trip-dates {
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.cart-trip-dates-title {
    margin: 0 0 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    opacity: 0.95;
}

.cart-trip-dates-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 160px;
    overflow-y: auto;
}

.cart-trip-dates-list::-webkit-scrollbar {
    width: 4px;
}

.cart-trip-dates-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.cart-trip-dates-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cart-trip-dates-item:last-child {
    border-bottom: none;
}

.cart-trip-dates-date {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    font-weight: 500;
}

.cart-trip-dates-price {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
}

.cart-trip-dates-add {
    flex-shrink: 0;
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
    min-height: 36px;
}

.cart-trip-dates-unavailable {
    font-size: 0.8125rem;
    opacity: 0.7;
}

/* Header */
.floating-cart-header {
    padding: 1.25rem 1.25rem 0.75rem;
    font-weight: 600;
}

.floating-cart-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

/* Body */
.floating-cart-body {
    padding: 1rem;
    max-height: clamp(280px, 50vh, 400px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.floating-cart-body::-webkit-scrollbar {
    width: 6px;
}

.floating-cart-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.floating-cart-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.floating-cart-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Empty State */
.cart-empty-state {
    text-align: center;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.cart-empty-state i {
    font-size: 3rem;
    opacity: 0.5;
}

.cart-empty-state h3 {
    margin: 0;
    font-size: 1.125rem;
}

.cart-empty-state p {
    margin: 0;
    opacity: 0.9;
    font-size: 0.9375rem;
}

.cart-empty-state .button {
    margin-top: 0.5rem;
    background: white;
    color: var(--color-green, #00400e);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.cart-empty-state .button:hover {
    transform: translateY(-2px);
}

/* Cart Items */
.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: background 0.2s ease;
}

.cart-item:hover {
    background: rgba(255, 255, 255, 0.15);
}

.cart-item-image {
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.cart-item-details {
    flex: 1;
    min-width: 0;
}

.cart-item-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

.cart-item-date {
    margin: 0 0 0.5rem 0;
    font-size: 0.875rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-date i {
    font-size: 0.75rem;
}

.cart-item-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.cart-item-price {
    font-weight: 600;
    font-size: 1rem;
}

.cart-item-quantity {
    font-size: 0.875rem;
    opacity: 0.8;
}

.cart-item-quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.cart-quantity-label {
    font-size: 0.875rem;
    opacity: 0.9;
    white-space: nowrap;
}

.cart-quantity-selector {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    color: white;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
    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='white' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 12px;
    padding-right: 2rem;
}

.cart-quantity-selector:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.cart-quantity-selector:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.cart-quantity-selector option {
    background: var(--color-green, #00400e);
    color: white;
}

.cart-item-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.cart-item-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cart-item-remove i {
    font-size: 0.875rem;
}

/* Footer */
.floating-cart-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cart-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.125rem;
    font-weight: 600;
}

.cart-total-label {
    opacity: 0.9;
}

.cart-total-amount {
    font-size: 1.25rem;
}

.cart-checkout-button {
    width: 100%;
    background: white;
    color: var(--color-green, #00400e);
    border: none;
    border-radius: 8px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cart-checkout-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.cart-checkout-button:active {
    transform: translateY(0);
}

.cart-clear-button {
    width: 100%;
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.cart-clear-button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Loading State - Now uses LoadingSpinner component */
.cart-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2000;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Legacy support - LoadingSpinner component will be used instead */
.cart-loading i {
    font-size: 2rem;
}

/* LoadingSpinner component styles are in loading-components.css */
/* The cart can use LoadingSpinner.show(cartLoading, { size: 'medium' }) */

/* Responsive */
@media (max-width: 768px) {
    .floating-cart-widget {
        width: calc(100vw - 1rem);
        bottom: 1rem;
        right: 0.5rem;
    }

    .floating-cart-trigger {
        padding: 0.875rem 1rem;
        font-size: 0.9375rem;
    }

    .cart-trigger-text {
        display: none;
    }

    .floating-cart-widget.open .floating-cart-overlay {
        max-height: clamp(400px, 70vh, 500px);
    }
}

@media (max-width: 480px) {
    .floating-cart-widget {
        width: calc(100vw - 1rem);
        bottom: 0.75rem;
        right: 0.5rem;
    }

    .floating-cart-trigger {
        padding: 0.75rem;
    }

    .cart-item {
        padding: 0.875rem;
    }

    .cart-item-image {
        width: 50px;
        height: 50px;
    }
}
