/*
  Custom Shopify-style Checkout Layout
  Design: Two-column desktop, stacked mobile. Dedicated layout removing main header/footer.
*/

.shopify-checkout-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: var(--font-body), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    color: var(--text-color);
}

.checkout-left-column {
    padding: 2rem 1.5rem;
    background-color: var(--bg-color);
    flex: 1;
}

.checkout-right-column {
    padding: 2rem 1.5rem;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    flex: 1;
}

/* 
  Shopify typically puts the summary over the form on mobile, or hidden behind an accordion.
  Based on previous conversations, we leave it stacked below on mobile.
  On Desktop, it's side-by-side. 
*/
@media (min-width: 1000px) {
    .shopify-checkout-layout {
        flex-direction: row;
    }
    
    .checkout-left-column {
        flex: 1 1 55%;
        padding: 4rem 4% 4rem 10%;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        border-top: none;
    }
    
    .checkout-left-column > * {
        width: 100%;
        max-width: 600px; /* Aligns content to the split line */
    }
    
    .checkout-right-column {
        flex: 1 1 45%;
        padding: 4rem 10% 4rem 4%;
        border-top: none;
        border-left: 1px solid var(--border-color);
        /* Ensure background bleeds right completely */
    }
    
    .checkout-summary-content {
        max-width: 420px; /* Keep it constrained on wide screens */
    }
}

/* Header & Breadcrumbs */
.checkout-header {
    margin-bottom: 2.5rem;
}

.checkout-header .logo {
    display: inline-block;
    height: 48px;
    margin-bottom: 1.5rem;
    transition: opacity var(--transition-speed);
}

.checkout-header .logo:hover {
    opacity: 0.8;
}

.checkout-header .logo-svg {
    height: 100%;
    width: auto;
}

.checkout-breadcrumbs {
    font-size: 0.85rem;
    color: var(--slate);
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.breadcrumb-item {
    color: var(--cherry-red);
}

.breadcrumb-item.active {
    color: var(--text-color);
    font-weight: 600;
}

/* Form Sections */
.checkout-section {
    margin-bottom: 2.5rem;
}

.checkout-section h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--heading-color);
    letter-spacing: 0.5px;
}

.payment-subtitle {
    font-size: 0.85rem;
    color: var(--slate);
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

/* Form Fields */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    position: relative;
    flex: 1;
}

/* Hide labels for floating or placeholder look */
.form-group label {
    display: none; 
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.95rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--heading-color); /* Bright input text */
    font-size: 0.95rem;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-group input::placeholder {
    color: var(--slate);
}

.form-group input:focus {
    outline: none;
    border-color: var(--cherry-red);
    box-shadow: 0 0 0 2px rgba(210, 4, 45, 0.2);
}

/* Invalid Feedback */
.invalid-feedback {
    color: var(--cherry-red);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: none;
}

/* Specific Field Sizes */
.group-half {
    width: calc(50% - 0.5rem);
}
.group-full {
    width: 100%;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    .group-half {
        width: 100%;
    }
}

/* Actions */
.checkout-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.return-link {
    font-size: 0.9rem;
    color: var(--cherry-red);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.return-link:hover {
    color: var(--cherry-red-hover);
}

.btn-pay-now {
    padding: 1.2rem 2.5rem;
    font-size: 1.1rem;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

/* Footer */
.checkout-footer {
    margin-top: 4rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--slate);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links {
    display: flex;
    gap: 1rem;
}

.footer-links a {
    color: var(--cherry-red);
}

/* Right Sidebar: Summary */
.checkout-summary-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Slight separation line */
}
.light-theme .checkout-summary-section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.08); 
}
.checkout-summary-section:first-child {
    padding-top: 0;
}
.checkout-summary-section:last-child {
    border-bottom: none;
}

/* Customizing the cart summary injected by JS */
.cart-summary-items {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem; /* Space for scrollbar */
    margin-bottom: 1rem;
}
.cart-summary-items::-webkit-scrollbar {
    width: 6px;
}
.cart-summary-items::-webkit-scrollbar-track {
    background: transparent;
}
.cart-summary-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.shopify-style-items .summary-item {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* Image wrapper for quantity badge */
.shopify-style-items .summary-item-image-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
    flex-shrink: 0;
}

.shopify-style-items .summary-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    padding: 2px;
}

.shopify-style-items .summary-item-quantity {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--light-slate);
    color: var(--heading-color);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.75rem;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 0 0 1px var(--card-bg); /* Cutout effect */
}
.dark-theme .shopify-style-items .summary-item-quantity {
    color: var(--bg-color);
    background-color: var(--text-color);
}

.shopify-style-items .summary-item-info {
    flex-grow: 1;
}

.shopify-style-items .summary-item-info h4 {
    font-size: 0.95rem;
    margin: 0 0 0.2rem 0;
    font-weight: 600;
    color: var(--heading-color);
}

.shopify-style-items .summary-item-info p {
    font-size: 0.8rem;
    color: var(--slate);
    margin: 0;
}

.shopify-style-items .summary-item-price {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--heading-color);
}

/* Coupon */
.coupon-section {
    display: flex;
    gap: 0.5rem;
}

.coupon-section input {
    flex-grow: 1;
    padding: 0.9rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--heading-color);
}

.coupon-section .btn {
    padding: 0.9rem 1.5rem;
    border-radius: 5px;
    white-space: nowrap;
    background-color: var(--border-color); /* Light secondary look */
    color: var(--heading-color);
    border: 1px solid var(--border-color);
}
.coupon-section .btn:hover {
    background-color: var(--slate);
    color: var(--heading-color);
}

#coupon-feedback {
    margin-top: 0.5rem;
    font-size: 0.85rem;
}

/* Totals */
.shopify-totals .summary-line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.8rem;
    font-size: 0.95rem;
    color: var(--slate);
}

.shopify-totals .summary-line span:last-child {
    font-weight: 500;
    color: var(--heading-color);
}

.shopify-totals .total-line {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    align-items: center;
}

.shopify-totals .total-label {
    font-size: 1.1rem;
    color: var(--heading-color) !important;
}

.shopify-totals .total-value-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.shopify-totals .currency {
    font-size: 0.8rem;
    color: var(--slate);
}

.shopify-totals .total-amount {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--heading-color) !important;
}

.checkout-disclaimer {
    font-size: 0.85rem;
    color: var(--slate);
    background-color: rgba(210, 4, 45, 0.05); /* very soft cherry red background */
    padding: 1rem;
    border-radius: 5px;
    margin-top: 1.5rem;
    border: 1px solid rgba(210, 4, 45, 0.2);
    line-height: 1.5;
}

/* Privacy Consent alignment */
.privacy-consent-group {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}
.privacy-consent-group input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 18px;
    height: 18px;
    accent-color: var(--cherry-red);
}
.privacy-consent-group label {
    display: block; /* override the display:none from generic labels */
    font-size: 0.9rem;
    color: var(--slate);
    cursor: pointer;
}
