/**
 * WooCommerce Blocks Styles
 * For block-based cart and checkout pages
 */

/* Prevent Horizontal Scroll on Cart & Checkout Pages */
body.woocommerce-cart,
body.woocommerce-checkout {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
}

body.woocommerce-cart .site,
body.woocommerce-checkout .site {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

/* Fix Header on Cart & Checkout Pages - Match Other Pages (Contained) */
body.woocommerce-cart .trojan-header,
body.woocommerce-checkout .trojan-header {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Header Container - Match Other Pages (Contained, Not Full Width) */
body.woocommerce-cart .trojan-header-container,
body.woocommerce-checkout .trojan-header-container {
    max-width: 1400px !important; /* Match other pages */
    width: 100% !important;
    margin: 0 auto !important;
    padding: 1rem 2rem !important; /* Match other pages */
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Fix Footer on Cart & Checkout Pages - Match Other Pages */
body.woocommerce-cart .trojan-footer,
body.woocommerce-checkout .trojan-footer {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    margin-top: 5rem !important;
}

/* Footer Container - Match Other Pages (Contained, Not Full Width) */
body.woocommerce-cart .trojan-footer .trojan-container,
body.woocommerce-checkout .trojan-footer .trojan-container {
    max-width: 1200px !important; /* Match other pages */
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 2rem !important; /* Match other pages */
    box-sizing: border-box !important;
}

body.woocommerce-cart .trojan-footer-main,
body.woocommerce-cart .trojan-footer-bottom,
body.woocommerce-checkout .trojan-footer-main,
body.woocommerce-checkout .trojan-footer-bottom {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Cart & Checkout Page Container - Full Width with Centered Container */
body.woocommerce-cart .trojan-main,
body.woocommerce-checkout .trojan-main {
    max-width: 100% !important;
    width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

body.woocommerce-cart .trojan-main .entry-content,
body.woocommerce-checkout .trojan-main .entry-content {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 3rem 4rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Cart Container Wrapper */
.wp-block-woocommerce-cart {
    max-width: 1400px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Checkout Container Wrapper */
.wp-block-woocommerce-checkout {
    max-width: 1400px !important;
    margin: 0 auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Ensure checkout uses the same sidebar layout grid - Desktop Only */
@media (min-width: 1025px) {
    .wp-block-woocommerce-checkout .wc-block-components-sidebar-layout {
        display: grid !important;
        grid-template-columns: 2.2fr 480px !important;
        gap: 1.5rem !important;
        align-items: start !important;
        max-width: 1400px !important;
        margin: 0 auto !important;
        padding: 0 4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
}

/* Ensure all checkout containers are properly constrained */
.wp-block-woocommerce-checkout,
.wc-block-checkout__main-container {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* WooCommerce Cart Block */
.wp-block-woocommerce-cart {
    max-width: 100%;
    margin: 0;
}

/* Cart & Checkout Page Title - Centered */
body.woocommerce-cart .entry-title,
body.woocommerce-cart h1.page-title,
body.woocommerce-cart h1,
body.woocommerce-checkout .entry-title,
body.woocommerce-checkout h1.page-title,
body.woocommerce-checkout h1 {
    text-align: center !important;
    width: 100% !important;
    margin-bottom: 2.5rem !important;
}

/* Cart Layout - WooCommerce Blocks - Product Section Wider - Desktop Only */
@media (min-width: 1025px) {
    .wc-block-components-sidebar-layout {
        display: grid !important;
        grid-template-columns: 2.2fr 480px !important;
        gap: 1.5rem !important;
        align-items: start !important;
        max-width: 1400px !important;
        margin: 0 auto !important;
        padding: 0 4rem !important;
        width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
}

.wc-block-cart {
    display: grid;
    grid-template-columns: 1fr 550px;
    gap: 5rem;
    align-items: start;
}

/* Cart Items Block - More Spacious */
.wc-block-components-main,
.wc-block-cart__main {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    backdrop-filter: blur(20px) !important;
    padding: 2.5rem !important;
    border-radius: 1.5rem !important;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    position: relative !important;
    overflow: visible !important;
}

.wc-block-components-main::before,
.wc-block-cart__main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem 1.5rem 0 0;
}

/* Cart Items Table - More Spacing */
.wc-block-cart-items {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.wc-block-cart-items__header {
    border-bottom: 2px solid #e5e7eb;
}

.wc-block-cart-items__header th {
    padding: 1.5rem 1rem !important;
    font-weight: 700;
    color: #1a1a1a;
    font-size: 0.9375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: right;
}

.wc-block-cart-items__row {
    border-bottom: 1px solid #f3f4f6;
}

.wc-block-cart-items__row:last-child {
    border-bottom: none;
}

.wc-block-cart-items__row td {
    padding: 1.5rem 1rem !important;
    vertical-align: middle !important;
}

/* Fix product cell to contain quantity selector */
.wc-block-cart-item__product {
    position: relative !important;
    overflow: visible !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding-right: 1rem !important;
}

/* Fix quantity selector overflow */
.wc-block-cart-item__quantity {
    margin-top: 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.wc-block-components-quantity-selector {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 200px !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
}

.wc-block-cart-item__image img {
    width: 100px !important;
    height: 100px !important;
    object-fit: cover;
    border-radius: 0.75rem;
    border: 2px solid #e5e7eb;
}

.wc-block-components-product-name {
    font-weight: 700;
    font-size: 1.25rem !important;
    color: #1a1a1a;
    text-decoration: none;
    display: block;
    margin-bottom: 0.75rem !important;
    line-height: 1.4 !important;
}

.wc-block-components-product-name:hover {
    color: #667eea;
}

.wc-block-cart-item__quantity {
    margin-top: 1rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
}

.wc-block-components-quantity-selector {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    width: auto !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
}

.wc-block-components-quantity-selector__input {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    padding: 0.875rem 0.5rem !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 0.5rem;
    text-align: center;
    font-weight: 700;
    font-size: 1rem !important;
    background: #ffffff;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.wc-block-components-quantity-selector__input:focus {
    outline: none;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.wc-block-components-quantity-selector__button {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    font-size: 1.125rem !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    border: 2px solid #e5e7eb !important;
    background: #ffffff !important;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wc-block-components-quantity-selector__button:hover:not(:disabled) {
    border-color: #667eea !important;
    background: #f9fafb !important;
}

.wc-block-cart-item__remove-link {
    margin-top: 0.5rem;
    color: #dc2626;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
}

.wc-block-cart-item__remove-link:hover {
    text-decoration: underline;
}

/* Cart Sidebar - Wider */
.wc-block-components-sidebar,
.wc-block-cart__sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    backdrop-filter: blur(20px) !important;
    padding: 2.5rem !important;
    border-radius: 1.5rem !important;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    position: sticky !important;
    top: calc(72px + 2rem) !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    min-width: 480px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.wc-block-components-sidebar::before,
.wc-block-cart__sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem 1.5rem 0 0;
}

.wc-block-cart__totals-title {
    font-size: 1.75rem !important;
    font-weight: 800;
    margin-bottom: 1.5rem !important;
    color: #1a1a1a;
    padding-top: 0.5rem;
    line-height: 1.2 !important;
}

/* Totals - More Spacing */
.wc-block-components-totals-item {
    display: flex;
    justify-content: space-between;
    padding: 0.875rem 0 !important;
    border-bottom: 1px solid #f3f4f6;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

.wc-block-components-totals-item:last-child {
    border-bottom: none;
}

.wc-block-components-totals-footer-item {
    padding-top: 1.5rem !important;
    margin-top: 1.5rem !important;
    border-top: 2px solid #e5e7eb;
    font-size: 1.375rem !important;
    font-weight: 800;
    line-height: 1.4 !important;
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 1.375rem !important;
}

/* Proceed to Checkout Button - Larger */
.wc-block-cart__submit-button {
    width: 100% !important;
    padding: 1.25rem 2rem !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    border-radius: 0.75rem;
    font-size: 1.125rem !important;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px 0 rgba(102, 126, 234, 0.4);
    text-decoration: none;
    display: block;
    text-align: center;
    margin-top: 1.5rem !important;
    line-height: 1.4 !important;
}

.wc-block-cart__submit-button .wc-block-components-button__text {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
}

.wc-block-cart__submit-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px 0 rgba(102, 126, 234, 0.5);
    color: #ffffff;
}

/* Checkout Layout - Similar to Cart */
.wc-block-checkout__main,
.wp-block-woocommerce-checkout-form-block {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    backdrop-filter: blur(20px) !important;
    padding: 2.5rem !important;
    border-radius: 1.5rem !important;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    position: relative !important;
    overflow: visible !important;
}

.wc-block-checkout__main::before,
.wp-block-woocommerce-checkout-form-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem 1.5rem 0 0;
}

/* Checkout Sidebar - Outer Container Only */
.wc-block-checkout__sidebar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.98) 100%) !important;
    backdrop-filter: blur(20px) !important;
    padding: 2.5rem !important;
    border-radius: 1.5rem !important;
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    position: sticky !important;
    top: calc(72px + 2rem) !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    min-width: 480px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.wc-block-checkout__sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 1.5rem 1.5rem 0 0;
}

/* Inner Order Summary Block - Remove Glass Styling (Already Styled by Parent) */
.wp-block-woocommerce-checkout-order-summary-block {
    background: transparent !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    position: relative !important;
}

/* Checkout Layout Grid - Use sidebar-layout for consistency */
.wc-block-checkout__main-container {
    grid-column: 1 / 2 !important; /* Ensure main content is in the first column */
}

.wc-block-checkout__sidebar {
    grid-column: 2 / 3 !important; /* Ensure sidebar is in the second column */
}

/* Checkout Order Summary Title */
.wc-block-checkout__totals-title,
.wp-block-woocommerce-checkout-order-summary-block h2,
.wc-block-components-checkout-order-summary__title {
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    margin-bottom: 1.5rem !important;
    color: #1a1a1a !important;
    padding-top: 0.5rem !important;
    line-height: 1.2 !important;
}

/* Ensure order summary content doesn't have double padding */
.wc-block-components-checkout-order-summary__content {
    padding: 0 !important;
    margin: 0 !important;
}

/* Checkout Totals - Match Cart Totals Styling */
.wc-block-checkout__totals .wc-block-components-totals-item {
    display: flex !important;
    justify-content: space-between !important;
    padding: 0.875rem 0 !important;
    border-bottom: 1px solid #f3f4f6 !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

.wc-block-checkout__totals .wc-block-components-totals-item:last-child {
    border-bottom: none !important;
}

.wc-block-checkout__totals .wc-block-components-totals-footer-item {
    padding-top: 1.5rem !important;
    margin-top: 1.5rem !important;
    border-top: 2px solid #e5e7eb !important;
    font-size: 1.375rem !important;
    font-weight: 800 !important;
    line-height: 1.4 !important;
}

.wc-block-checkout__totals .wc-block-components-totals-footer-item .wc-block-components-totals-item__label,
.wc-block-checkout__totals .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 1.375rem !important;
}

/* Checkout Place Order Button - Match Cart Submit Button */
.wc-block-checkout__actions_row .wc-block-components-button,
.wc-block-checkout__actions_row button {
    width: 100% !important;
    padding: 1.25rem 2rem !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 0.75rem !important;
    font-size: 1.125rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 14px 0 rgba(102, 126, 234, 0.4) !important;
    text-decoration: none !important;
    display: block !important;
    text-align: center !important;
    margin-top: 1.5rem !important;
    line-height: 1.4 !important;
}

.wc-block-checkout__actions_row .wc-block-components-button .wc-block-components-button__text {
    font-size: 1.125rem !important;
    font-weight: 700 !important;
}

.wc-block-checkout__actions_row .wc-block-components-button:hover,
.wc-block-checkout__actions_row button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px 0 rgba(102, 126, 234, 0.5) !important;
    color: #ffffff !important;
}

/* Center Place Order Button Container */
.wc-block-checkout__actions_row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    margin-top: 2rem !important;
    width: 100% !important;
}

.wc-block-checkout__actions_row .wc-block-components-button,
.wc-block-checkout__actions_row button,
.wc-block-components-checkout-place-order-button {
    max-width: 400px !important;
    width: 100% !important;
    margin: 0 auto !important;
    display: block !important;
}

/* Center Place Order Button Text - Remove Display Flex */
.wc-block-components-checkout-place-order-button__text,
.wc-block-components-checkout-place-order-button .wc-block-components-checkout-place-order-button__text {
    text-align: center !important;
    display: block !important;
    align-items: unset !important;
}

/* Return to Cart Link - Center Below Button */
.wc-block-components-checkout-return-to-cart-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    color: #6b7280 !important;
    text-decoration: none !important;
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    margin-top: 0.5rem !important;
    transition: color 0.2s ease !important;
}

.wc-block-components-checkout-return-to-cart-button:hover {
    color: #667eea !important;
}

.wc-block-components-checkout-return-to-cart-button svg {
    width: 18px !important;
    height: 18px !important;
}

/* Terms and Conditions Checkbox Styling */
.wc-block-checkout__terms {
    text-align: center !important;
    margin: 1.5rem 0 !important;
    padding: 1rem 0 !important;
}

.wc-block-checkout__terms .wc-block-components-checkbox {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    text-align: right !important;
    direction: rtl !important;
    cursor: pointer !important;
}

/* Ensure checkbox input is visible */
.wc-block-checkout__terms .wc-block-components-checkbox__input,
.wc-block-checkout__terms input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    appearance: checkbox !important;
    -webkit-appearance: checkbox !important;
    -moz-appearance: checkbox !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.wc-block-checkout__terms .wc-block-components-checkbox__input:checked,
.wc-block-checkout__terms input[type="checkbox"]:checked {
    background-color: #667eea !important;
    border-color: #667eea !important;
    accent-color: #667eea !important;
}

.wc-block-checkout__terms .wc-block-components-checkbox__label {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: #4b5563 !important;
    line-height: 1.6 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    direction: rtl !important;
}

/* If checkbox is inside label */
.wc-block-checkout__terms label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    cursor: pointer !important;
    direction: rtl !important;
    text-align: right !important;
}

.wc-block-checkout__terms label input[type="checkbox"] {
    order: 2 !important; /* Checkbox on the right for RTL */
}

/* Ensure all checkboxes in terms section are visible */
.wc-block-checkout__terms input[type="checkbox"],
.wc-block-checkout__terms .wc-block-components-checkbox__input {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Ensure Place Order button container is properly centered */
.wc-block-checkout__actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
}

.wc-block-checkout__actions_row {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 1rem !important;
    margin-top: 2rem !important;
    width: 100% !important;
}

/* Terms and Privacy Policy Links */
.trojan-terms-link,
.trojan-privacy-link {
    color: #667eea !important;
    text-decoration: underline !important;
    font-weight: 700 !important;
    transition: color 0.2s ease !important;
}

.trojan-terms-link:hover,
.trojan-privacy-link:hover {
    color: #764ba2 !important;
    text-decoration: underline !important;
}

/* Classic WooCommerce Terms Checkbox (for non-block checkout) */
.woocommerce-terms-and-conditions-wrapper {
    text-align: center !important;
    margin: 1.5rem 0 !important;
    padding: 1rem 0 !important;
}

.woocommerce-terms-and-conditions-wrapper .woocommerce-form__label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.75rem !important;
    text-align: right !important;
    direction: rtl !important;
    cursor: pointer !important;
}

.woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    color: #4b5563 !important;
    line-height: 1.6 !important;
}

.woocommerce-terms-and-conditions-wrapper input[type="checkbox"] {
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

/* Center Place Order Button for Classic Checkout */
.woocommerce-checkout .form-row.place-order {
    text-align: center !important;
    margin-top: 2rem !important;
}

.woocommerce-checkout #place_order {
    max-width: 400px !important;
    margin: 0 auto !important;
    display: block !important;
    width: 100% !important;
}

/* Ensure all checkout block elements are contained */
.wc-block-checkout__main,
.wc-block-checkout__sidebar,
.wp-block-woocommerce-checkout-form-block,
.wp-block-woocommerce-checkout-order-summary-block,
.wc-block-components-sidebar,
.wc-block-components-main {
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
}

/* Checkout Form Fields - Match Site Style */
.wc-block-checkout__form .wc-block-components-text-input input,
.wc-block-checkout__form .wc-block-components-text-input textarea,
.wc-block-checkout__form .wc-block-components-select select {
    padding: 0.875rem 1rem !important;
    border: 2px solid #e5e7eb !important;
    border-radius: 0.5rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    background: #ffffff !important;
    transition: all 0.2s ease !important;
    box-sizing: border-box !important;
    max-width: 100% !important;
}

.wc-block-checkout__form .wc-block-components-text-input input:focus,
.wc-block-checkout__form .wc-block-components-text-input textarea:focus,
.wc-block-checkout__form .wc-block-components-select select:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

.wc-block-checkout__form .wc-block-components-text-input label,
.wc-block-checkout__form .wc-block-components-select label {
    font-weight: 700 !important;
    font-size: 0.9375rem !important;
    color: #1a1a1a !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
}

/* Responsive - Tablet and Mobile */
@media (max-width: 1024px) {
    /* Change from Grid to Flex Column on Mobile/Tablet */
    .wc-block-components-sidebar-layout,
    .wp-block-woocommerce-checkout .wc-block-components-sidebar-layout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
        gap: 2rem !important;
        padding: 0 !important;
    }
    
    .wc-block-cart {
        grid-template-columns: 1fr;
    }
    
    .wc-block-checkout__main-container,
    .wp-block-woocommerce-checkout {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: none !important;
    }
    
    .wc-block-components-sidebar,
    .wc-block-cart__sidebar,
    .wc-block-checkout__sidebar,
    .wp-block-woocommerce-checkout-order-summary-block {
        position: static !important;
        max-height: none !important;
        min-width: 100% !important;
        width: 100% !important;
    }
    
    /* Footer Container - Match Other Pages Tablet Padding */
    body.woocommerce-cart .trojan-footer .trojan-container,
    body.woocommerce-checkout .trojan-footer .trojan-container {
        max-width: 1200px !important;
        padding: 0 1.5rem !important; /* Match other pages tablet padding */
    }
    
    /* Header Container - Match Other Pages Tablet */
    body.woocommerce-cart .trojan-header-container,
    body.woocommerce-checkout .trojan-header-container {
        max-width: 1400px !important;
        padding: 1rem 2rem !important; /* Match other pages tablet padding */
    }
}

@media (max-width: 768px) {
    /* Center title on mobile */
    body.woocommerce-cart .entry-title,
    body.woocommerce-cart h1.page-title,
    body.woocommerce-cart h1,
    body.woocommerce-checkout .entry-title,
    body.woocommerce-checkout h1.page-title,
    body.woocommerce-checkout h1 {
        text-align: center !important;
        margin-bottom: 2rem !important;
    }
    
    /* Fix header/footer padding on mobile - Match Other Pages */
    body.woocommerce-cart .trojan-header-container,
    body.woocommerce-checkout .trojan-header-container {
        max-width: 1400px !important; /* Keep contained on mobile */
        padding: 0.875rem 1rem !important; /* Match other pages mobile padding */
    }
    
    /* Footer Container - Match Other Pages Mobile Padding */
    body.woocommerce-cart .trojan-footer .trojan-container,
    body.woocommerce-checkout .trojan-footer .trojan-container {
        max-width: 1200px !important; /* Keep contained on mobile too */
        padding: 0 1.25rem !important; /* Match other pages mobile padding */
    }
    
    body.woocommerce-cart .trojan-main .entry-content,
    body.woocommerce-checkout .trojan-main .entry-content {
        padding: 2rem 1.5rem !important;
    }
    
    .wc-block-checkout__main-container,
    .wp-block-woocommerce-checkout {
        padding: 0 !important;
        gap: 2rem !important;
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
    }
    
    /* Checkout Form Container - Wider on Mobile */
    .wc-block-checkout__main,
    .wp-block-woocommerce-checkout-form-block {
        padding: 2rem !important;
        width: 100% !important;
        min-width: 100% !important;
        position: static !important;
        max-height: none !important;
        margin: 0 auto !important;
    }
    
    /* Hide Duplicate Order Summary at Bottom on Mobile */
    .checkout-order-summary-block-fill-wrapper,
    .wc-block-checkout__actions .checkout-order-summary-block-fill-wrapper {
        display: none !important;
    }
    
    /* Order Summary Sidebar - Centered and Visible on Mobile */
    .wc-block-checkout__sidebar,
    .wp-block-woocommerce-checkout-order-summary-block {
        padding: 2rem !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        position: static !important;
        max-height: none !important;
        margin: 0 auto !important;
        display: block !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }
    
    /* Ensure Order Summary Content is Always Visible on Mobile */
    .wc-block-components-checkout-order-summary__content {
        display: block !important;
        max-height: none !important;
        overflow: visible !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Fix Order Summary Container Overflow */
    .wp-block-woocommerce-checkout-order-summary-block,
    .wc-block-components-checkout-order-summary__content,
    .wc-block-components-order-summary,
    .wc-block-components-order-summary__content {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
    }
    
    /* Ensure Order Summary Items Don't Overflow */
    .wc-block-components-order-summary-item {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    /* Fix Product Name and Description Overflow */
    .wc-block-components-order-summary-item__description {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    .wc-block-components-product-name {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }
    
    .wc-block-components-product-metadata__description {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }
    
    /* Fix Totals Wrapper Overflow */
    .wc-block-components-totals-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* Force Order Summary to be Expanded on Mobile */
    .wc-block-components-checkout-order-summary__title[aria-expanded="false"] + .wc-block-components-checkout-order-summary__content,
    .wc-block-components-checkout-order-summary__title[aria-expanded="true"] + .wc-block-components-checkout-order-summary__content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        max-height: none !important;
    }
    
    /* Hide the collapse/expand icon on mobile since it's always expanded */
    .wc-block-components-checkout-order-summary__title-icon {
        display: none !important;
    }
    
    /* Order Summary Title - Always Expanded on Mobile */
    .wc-block-components-checkout-order-summary__title {
        cursor: pointer !important;
        padding: 1rem 0 !important;
        margin-bottom: 1rem !important;
        border-bottom: 2px solid #e5e7eb !important;
    }
    
    /* Order Summary Title - Centered Layout */
    .wc-block-components-checkout-order-summary__title {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }
    
    /* Order Summary Title Text - Centered */
    .wc-block-components-checkout-order-summary__title-text {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
        font-size: 1.5rem !important;
        font-weight: 800 !important;
        margin-bottom: 0.5rem !important;
    }
    
    /* Order Summary Title Price - Centered */
    .wc-block-components-checkout-order-summary__title-price {
        text-align: center !important;
        display: block !important;
        width: 100% !important;
        font-size: 1.25rem !important;
        font-weight: 700 !important;
        margin-top: 0.5rem !important;
    }
    
    .wc-block-checkout__totals-title,
    .wp-block-woocommerce-checkout-order-summary-block h2,
    .wc-block-components-checkout-order-summary__title {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem !important;
        text-align: center !important;
    }
    
    .wc-block-checkout__actions_row .wc-block-components-button,
    .wc-block-checkout__actions_row button {
        padding: 1.125rem 1.5rem !important;
        font-size: 1rem !important;
        max-width: 100% !important;
        width: 100% !important;
    }
    
    .wc-block-checkout__actions_row .wc-block-components-button .wc-block-components-button__text {
        font-size: 1rem !important;
        font-weight: 700 !important;
    }
    
    /* Terms Checkbox - Mobile */
    .wc-block-checkout__terms {
        margin: 1.25rem 0 !important;
        padding: 0.75rem 0 !important;
    }
    
    .wc-block-checkout__terms .wc-block-components-checkbox {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    
    .wc-block-checkout__terms .wc-block-components-checkbox__label {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
    }
    
    /* Classic Checkout Terms - Mobile */
    .woocommerce-terms-and-conditions-wrapper {
        margin: 1.25rem 0 !important;
        padding: 0.75rem 0 !important;
    }
    
    .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    
    .woocommerce-terms-and-conditions-wrapper .woocommerce-form__label-for-checkbox {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
    }
    
    .woocommerce-checkout #place_order {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    /* Override Grid Layout on Mobile - Use Flex Column Instead */
    .wc-block-components-sidebar-layout,
    .wp-block-woocommerce-checkout .wc-block-components-sidebar-layout {
        padding: 0 !important;
        gap: 2rem !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        grid-template-columns: none !important;
    }
    
    /* Ensure Checkout Sidebar is Centered and Full Width on Mobile */
    .wc-block-checkout__sidebar {
        margin: 0 auto !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    /* Ensure All Order Summary Containers Are Properly Contained */
    .wc-block-checkout__sidebar *,
    .wp-block-woocommerce-checkout-order-summary-block * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Ensure Checkout Main Form is Full Width on Mobile */
    .wc-block-checkout__main {
        margin: 0 auto !important;
        width: 100% !important;
    }
    
    .wc-block-components-main,
    .wc-block-components-sidebar,
    .wc-block-cart__main,
    .wc-block-cart__sidebar {
        padding: 1.5rem !important;
        width: 100% !important;
        min-width: 100% !important;
    }
    
    .wc-block-cart-items__header {
        display: none;
    }
    
    .wc-block-cart-items__row {
        display: flex !important;
        flex-direction: column !important;
        margin-bottom: 1.5rem;
        padding: 1.5rem !important;
        background: #f9fafb;
        border-radius: 0.75rem;
        border: 1px solid #e5e7eb;
        gap: 1rem !important;
    }
    
    .wc-block-cart-item__image {
        display: flex !important;
        justify-content: center !important;
        width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .wc-block-cart-item__image img {
        width: 120px !important;
        height: 120px !important;
    }
    
    .wc-block-cart-item__product {
        display: block !important;
        width: 100% !important;
        margin-bottom: 1rem;
    }
    
    .wc-block-cart-item__total {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
        padding: 1rem 0 !important;
        border-top: 2px solid #e5e7eb;
        margin-top: 1rem;
    }
    
    .wc-block-cart-item__quantity {
        width: 100% !important;
        margin-top: 1rem !important;
    }
    
    .wc-block-components-quantity-selector {
        max-width: 100% !important;
        justify-content: center !important;
    }
    
    .wc-block-cart__totals-title {
        font-size: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    .wc-block-cart__submit-button {
        padding: 1.125rem 1.5rem !important;
        font-size: 1rem !important;
    }
    
    /* Checkout Order Summary Items - Mobile Styling with Smooth Scrolling */
    .wc-block-components-order-summary-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        padding: 1rem 0 !important;
        border-bottom: 1px solid #f3f4f6 !important;
        gap: 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: thin !important;
        scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
    }
    
    /* Smooth scrollbar styling for webkit browsers */
    .wc-block-components-order-summary-item::-webkit-scrollbar {
        height: 4px !important;
    }
    
    .wc-block-components-order-summary-item::-webkit-scrollbar-track {
        background: transparent !important;
    }
    
    .wc-block-components-order-summary-item::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.2) !important;
        border-radius: 2px !important;
    }
    
    .wc-block-components-order-summary-item:last-child {
        border-bottom: none !important;
    }
    
    .wc-block-components-order-summary-item__image {
        flex-shrink: 0 !important;
        width: 60px !important;
        min-width: 60px !important;
        height: 60px !important;
        box-sizing: border-box !important;
    }
    
    .wc-block-components-order-summary-item__image img {
        width: 60px !important;
        height: 60px !important;
        object-fit: cover !important;
        border-radius: 0.5rem !important;
        max-width: 100% !important;
    }
    
    .wc-block-components-order-summary-item__description {
        flex: 1 !important;
        min-width: 0 !important;
        max-width: none !important;
        box-sizing: border-box !important;
        overflow-x: visible !important;
        overflow-y: visible !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }
    
    /* Product Name - Better Wrapping */
    .wc-block-components-product-name {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-bottom: 0.5rem !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        max-width: 100% !important;
    }
    
    /* Product Price - Inline with Name */
    .wc-block-components-order-summary-item__individual-prices {
        display: block !important;
        margin-bottom: 0.5rem !important;
        font-size: 0.9375rem !important;
        font-weight: 700 !important;
    }
    
    /* Product Description - Better Wrapping */
    .wc-block-components-product-metadata__description {
        font-size: 0.875rem !important;
        line-height: 1.5 !important;
        color: #6b7280 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        max-width: 100% !important;
    }
    
    .wc-block-components-product-metadata__description p {
        margin: 0 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
    }
    
    .wc-block-components-order-summary-item__total-price {
        flex-shrink: 0 !important;
        font-weight: 700 !important;
        font-size: 1.125rem !important;
        white-space: nowrap !important;
        margin-left: auto !important;
        padding-left: 0.75rem !important;
    }
    
    /* Very Small Screens - Stack Vertically */
    @media (max-width: 480px) {
        .wc-block-components-order-summary-item {
            flex-direction: column !important;
            align-items: stretch !important;
            gap: 1rem !important;
            overflow-x: visible !important;
        }
        
        .wc-block-components-order-summary-item__image {
            align-self: center !important;
            margin-bottom: 0.5rem !important;
        }
        
        .wc-block-components-order-summary-item__description {
            max-width: 100% !important;
            text-align: center !important;
        }
        
        .wc-block-components-order-summary-item__total-price {
            margin-left: 0 !important;
            padding-left: 0 !important;
            text-align: center !important;
            margin-top: 0.5rem !important;
            padding-top: 0.75rem !important;
            border-top: 1px solid #e5e7eb !important;
        }
    }
    
    /* Checkout Form Fields - Wider on Mobile */
    .wc-block-checkout__form .wc-block-components-text-input,
    .wc-block-checkout__form .wc-block-components-select,
    .wc-block-components-address-form > div {
        width: 100% !important;
        max-width: 100% !important;
        margin-bottom: 1rem !important;
    }
    
    .wc-block-checkout__form .wc-block-components-text-input input,
    .wc-block-checkout__form .wc-block-components-text-input textarea,
    .wc-block-checkout__form .wc-block-components-select select {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        font-size: 1rem !important;
    }
    
    /* Checkout Step Headings - Better Spacing */
    .wc-block-components-checkout-step__title {
        font-size: 1.25rem !important;
        font-weight: 800 !important;
        margin-bottom: 1rem !important;
    }
    
    /* Checkout Totals - Better Spacing on Mobile */
    .wc-block-components-totals-item {
        padding: 0.75rem 0 !important;
        font-size: 1rem !important;
    }
    
    .wc-block-components-totals-footer-item {
        padding-top: 1.25rem !important;
        margin-top: 1.25rem !important;
        font-size: 1.25rem !important;
    }
    
    /* Ensure Order Summary Wrapper is Visible */
    .wc-block-components-totals-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Order Summary Container - Centered */
    .wp-block-woocommerce-checkout-order-summary-block {
        text-align: center !important;
    }
    
    .wp-block-woocommerce-checkout-order-summary-block > * {
        text-align: right !important; /* RTL for Arabic content */
    }
    
    .wc-block-components-checkout-order-summary__title-text {
        text-align: center !important;
    }
}

