/* =============================================
   AMAZONIC ART - Cart, Modal, Checkout Styles
   Uses existing design system CSS variables
   ============================================= */

/* =============================================
   1. CART BADGE
   ============================================= */
.cart-btn {
    position: relative;
}

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, var(--color-salmon) 0%, var(--color-salmon-deep) 100%);
    color: white;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-body);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all var(--transition-bounce);
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(248, 168, 136, 0.4);
}

.cart-badge.visible {
    opacity: 1;
    transform: scale(1);
}

.cart-badge.bounce {
    animation: badgeBounce 0.5s var(--transition-bounce);
}

.cart-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
}

/* =============================================
   2. CART DRAWER (Slide-out Panel)
   ============================================= */
.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.cart-overlay.open {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100vh;
    background: var(--color-bg-cream);
    z-index: 1101;
    transform: translateX(100%);
    transition: transform var(--transition-smooth);
    display: flex;
    flex-direction: column;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.15);
}

.cart-drawer.open {
    transform: translateX(0);
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 28px 32px;
    border-bottom: 1px solid rgba(77, 92, 74, 0.12);
}

.cart-drawer-header h3 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 600;
    color: var(--color-olive-dark);
}

.cart-drawer-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--color-gray);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all var(--transition-fast);
    line-height: 1;
}

.cart-drawer-close:hover {
    color: var(--color-salmon-deep);
    background: rgba(248, 168, 136, 0.1);
}

.cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.cart-drawer-empty {
    text-align: center;
    padding: 60px 20px;
}

.cart-drawer-empty p {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-gray-light);
    margin-bottom: 24px;
}

/* Cart Item */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid rgba(77, 92, 74, 0.08);
    animation: fadeInUp 0.3s ease-out;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cart-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cart-item-name {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 600;
    color: var(--color-olive-dark);
    line-height: 1.3;
}

.cart-item-price {
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 600;
    color: var(--color-dark-text);
}

.cart-item-remove {
    background: none;
    border: none;
    color: var(--color-gray-light);
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 50%;
    transition: all var(--transition-fast);
    line-height: 1;
}

.cart-item-remove:hover {
    color: var(--color-accent-terracotta);
    background: rgba(200, 107, 78, 0.1);
}

/* Cart Footer */
.cart-drawer-footer {
    padding: 24px 32px;
    border-top: 1px solid rgba(77, 92, 74, 0.12);
    background: white;
}

.cart-drawer-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.cart-drawer-total span:first-child {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cart-drawer-total span:last-child {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--color-olive-dark);
}

.cart-checkout-btn {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
    padding: 18px;
    font-size: 15px;
}

/* =============================================
   3. PRODUCT DETAIL MODAL
   ============================================= */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 26, 26, 0.5);
    backdrop-filter: blur(6px);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
    padding: 40px;
}

.product-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.product-modal {
    background: var(--color-bg-cream);
    border-radius: 20px;
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.95) translateY(20px);
    transition: transform var(--transition-smooth);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.2);
}

.product-modal-overlay.open .product-modal {
    transform: scale(1) translateY(0);
}

.product-modal-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: white;
    border: none;
    font-size: 24px;
    color: var(--color-gray);
    cursor: pointer;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.product-modal-close:hover {
    color: var(--color-salmon-deep);
    transform: rotate(90deg);
}

.product-modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 500px;
}

/* Modal Image Side */
.product-modal-image {
    position: relative;
    background: white;
    border-radius: 20px 0 0 20px;
    overflow: hidden;
}

.product-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    min-height: 500px;
    transition: opacity 0.4s ease;
}

.image-toggle {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    padding: 4px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.toggle-btn {
    background: none;
    border: none;
    padding: 10px 24px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-gray);
    cursor: pointer;
    border-radius: 26px;
    transition: all var(--transition-fast);
}

.toggle-btn.active {
    background: var(--color-olive-dark);
    color: white;
}

/* Modal Info Side */
.product-modal-info {
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-category {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-olive);
    background: rgba(77, 92, 74, 0.08);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
    width: fit-content;
}

.modal-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 38px);
    font-weight: 600;
    color: var(--color-black);
    line-height: 1.2;
    margin-bottom: 4px;
}

.modal-subtitle {
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-gray-light);
    font-style: italic;
    margin-bottom: 8px;
}

.modal-dimensions {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-gray-light);
    margin-bottom: 8px;
}

.modal-price {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    color: var(--color-olive-dark);
    margin: 20px 0;
}

.modal-price-original {
    text-decoration: line-through;
    color: var(--color-gray-light);
    font-size: 22px;
    font-weight: 400;
}

.modal-price-sale {
    color: var(--color-accent-terracotta);
    font-size: 32px;
    font-weight: 700;
}

.modal-description {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-gray);
    line-height: 1.8;
    margin-bottom: 32px;
    max-width: none;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.modal-add-to-cart {
    position: relative;
    overflow: hidden;
}

.modal-add-to-cart.added {
    background: var(--color-olive) !important;
    color: white !important;
}

.modal-inquiry {
    background: transparent;
    border: 2px solid var(--color-mint);
    color: var(--color-dark-text);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-smooth);
    text-align: center;
}

.modal-inquiry:hover {
    background: var(--color-mint);
    transform: translateY(-2px);
}

/* =============================================
   4. CHECKOUT PAGE
   ============================================= */
.checkout-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 60px;
    padding: 50px 80px;
    min-height: 70vh;
}

/* Progress Indicator */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 50px;
    padding: 0 40px;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 60%;
    width: 80%;
    height: 2px;
    background: var(--color-light-gray);
    z-index: 0;
}

.progress-step.completed:not(:last-child)::after {
    background: var(--color-olive);
}

.progress-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--color-light-gray);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-light-gray);
    position: relative;
    z-index: 1;
    transition: all var(--transition-smooth);
}

.progress-step.active .progress-circle {
    border-color: var(--color-salmon);
    background: linear-gradient(135deg, var(--color-salmon) 0%, var(--color-salmon-deep) 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(248, 168, 136, 0.3);
}

.progress-step.completed .progress-circle {
    border-color: var(--color-olive);
    background: var(--color-olive);
    color: white;
}

.progress-label {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-gray-light);
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color var(--transition-smooth);
}

.progress-step.active .progress-label {
    color: var(--color-salmon-deep);
    font-weight: 600;
}

.progress-step.completed .progress-label {
    color: var(--color-olive);
}

/* Checkout Form */
.checkout-form {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

.checkout-step {
    display: none;
    animation: fadeStep 0.4s ease-out;
}

.checkout-step.active {
    display: block;
}

.checkout-step h3 {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    color: var(--color-olive-dark);
    margin-bottom: 8px;
}

.checkout-step > p {
    font-size: 15px;
    color: var(--color-gray-light);
    margin-bottom: 32px;
}

/* Form Groups */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-olive);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(77, 92, 74, 0.15);
    border-radius: 10px;
    background: var(--color-bg-cream);
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-dark-text);
    transition: all var(--transition-smooth);
    -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-salmon);
    background: white;
    box-shadow: 0 4px 16px rgba(248, 168, 136, 0.15);
}

.form-group input.error,
.form-group select.error {
    border-color: var(--color-accent-terracotta);
}

.form-error {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-accent-terracotta);
    margin-top: 6px;
    display: none;
    animation: fadeInUp 0.2s ease;
}

.form-group.has-error .form-error {
    display: block;
}

/* Checkout Buttons */
.checkout-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 36px;
    gap: 16px;
}

.checkout-back {
    background: none;
    border: 2px solid var(--color-olive-light);
    color: var(--color-olive-dark);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    padding: 14px 36px;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-smooth);
}

.checkout-back:hover {
    background: var(--color-olive-dark);
    color: white;
    border-color: var(--color-olive-dark);
}

.checkout-next {
    flex: 1;
    max-width: 280px;
}

/* Tilopay Container */
#tilopay-form-container {
    background: white;
    border: 2px solid rgba(77, 92, 74, 0.1);
    border-radius: 16px;
    padding: 32px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#tilopay-form-container .loading-text {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-gray-light);
}

/* Order Summary Sidebar */
.order-summary {
    position: sticky;
    top: 120px;
    background: white;
    border-radius: 20px;
    padding: 36px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    height: fit-content;
}

.order-summary h3 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--color-olive-dark);
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(77, 92, 74, 0.1);
}

.summary-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 12px 0;
}

.summary-item img {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
}

.summary-item-name {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-olive-dark);
}

.summary-item-price {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    color: var(--color-dark-text);
}

.summary-totals {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(77, 92, 74, 0.1);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-gray);
}

.summary-row.total {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    color: var(--color-olive-dark);
    padding-top: 16px;
    margin-top: 8px;
    border-top: 2px solid var(--color-olive-dark);
}

.summary-edit {
    display: inline-block;
    margin-top: 16px;
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-salmon-deep);
    text-decoration: underline;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.summary-edit:hover {
    color: var(--color-accent-terracotta);
}

/* =============================================
   5. ORDER CONFIRMATION PAGE
   ============================================= */
.confirmation-container {
    max-width: 680px;
    margin: 80px auto;
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}

.success-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-olive) 0%, var(--color-olive-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s var(--transition-bounce);
}

.success-icon svg {
    width: 44px;
    height: 44px;
    stroke: white;
    stroke-width: 3;
    fill: none;
    stroke-dasharray: 50;
    stroke-dashoffset: 50;
    animation: checkmarkDraw 0.6s ease-out 0.3s forwards;
}

.confirmation-container h1 {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    color: var(--color-olive-dark);
    margin-bottom: 12px;
}

.confirmation-order-number {
    font-family: var(--font-decorative);
    font-size: 20px;
    color: var(--color-gray);
    margin-bottom: 40px;
}

.confirmation-items {
    text-align: left;
    border-top: 1px solid rgba(77, 92, 74, 0.1);
    padding-top: 24px;
    margin-bottom: 24px;
}

.confirmation-total {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    color: var(--color-olive-dark);
    padding: 16px 0;
    border-top: 2px solid var(--color-olive-dark);
    margin-bottom: 32px;
}

.confirmation-email {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-gray);
    margin-bottom: 40px;
    line-height: 1.7;
}

/* =============================================
   6. ORDER FAILED PAGE
   ============================================= */
.failure-container {
    max-width: 580px;
    margin: 100px auto;
    text-align: center;
    padding: 60px 40px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}

.error-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-salmon) 0%, var(--color-accent-terracotta) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    animation: scaleIn 0.5s var(--transition-bounce);
}

.failure-container h1 {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 600;
    color: var(--color-dark-text);
    margin-bottom: 16px;
}

.failure-container > p {
    font-size: 16px;
    color: var(--color-gray);
    margin-bottom: 36px;
    max-width: none;
}

.failure-actions {
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
}

/* =============================================
   7. ANIMATIONS
   ============================================= */
@keyframes badgeBounce {
    0% { transform: scale(1); }
    30% { transform: scale(1.4); }
    50% { transform: scale(0.9); }
    70% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes checkmarkDraw {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes fadeStep {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* =============================================
   8. RESPONSIVE
   ============================================= */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100vw;
    }

    .product-modal-overlay {
        padding: 0;
    }

    .product-modal {
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }

    .product-modal-grid {
        grid-template-columns: 1fr;
    }

    .product-modal-image {
        border-radius: 0;
        max-height: 40vh;
    }

    .product-modal-image img {
        min-height: 280px;
        max-height: 40vh;
    }

    .product-modal-info {
        padding: 30px 24px;
    }

    .checkout-layout {
        grid-template-columns: 1fr;
        padding: 30px 20px;
        gap: 30px;
    }

    .checkout-form {
        padding: 28px 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .checkout-progress {
        padding: 0;
    }

    .progress-label {
        font-size: 10px;
    }

    .order-summary {
        position: static;
    }

    .confirmation-container,
    .failure-container {
        margin: 40px 16px;
        padding: 40px 24px;
    }
}
