/**
 * WooCommerce Styles for TEFL Theme V2
 * Integrates WooCommerce checkout with theme design system
 */

/* =========================================
   1. WOOCOMMERCE GLOBAL INTEGRATION
   ========================================= */

/* Use theme container */
.woocommerce,
.woocommerce-page {
    font-family: 'Raleway', sans-serif;
    color: var(--lp-grey);
}

/* Hide breadcrumbs */
.woocommerce .woocommerce-breadcrumb {
    display: none;
}

/* Hide ordering dropdown */
.woocommerce-ordering {
    display: none;
}

/* Hide result count */
.woocommerce-result-count {
    display: none;
}

/* =========================================
   2. CHECKOUT PAGE LAYOUT
   ========================================= */

/* Main checkout layout - use theme container */
.wc-block-checkout {
    position: relative;
    width: 100%;
    margin-top: 20px !important;
    padding: 0 clamp(20px, 4vw, 40px);
    box-sizing: border-box;
}

/* Two column layout - main and sidebar */
.wc-block-components-sidebar-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    box-sizing: border-box;
}

/* Main form area - takes 2/3 width */
.wc-block-components-main {
    flex: 0 0 calc(66.666% - 20px);
    box-sizing: border-box;
    max-width: calc(66.666% - 20px);
}

/* Sidebar - order summary - takes 1/3 width */
.wc-block-components-sidebar {
    flex: 0 0 calc(33.333% - 10px);
    box-sizing: border-box;
    max-width: calc(33.333% - 10px);
}

/* =========================================
   3. ORDER SUMMARY - Enhanced Styling
   ========================================= */

.wp-block-woocommerce-checkout-order-summary-block {
    background: var(--lp-white);
    border-radius: var(--lp-radius);
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 88, 98, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* Order summary title/header */
.wc-block-components-checkout-order-summary__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    background: var(--lp-mint);
    border-radius: 8px;
    margin-bottom: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wc-block-components-checkout-order-summary__title:hover {
    background: #E0F5F7;
}

.wc-block-components-checkout-order-summary__title-text {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--lp-dark);
    margin: 0;
}

.wc-block-components-checkout-order-summary__title-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--lp-teal);
}

.wc-block-components-checkout-order-summary__title-icon {
    display: flex;
    align-items: center;
    margin-left: 10px;
    color: var(--lp-teal);
    transition: transform 0.2s ease;
}

.wc-block-components-checkout-order-summary__title-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

/* Rotate icon when expanded */
.wc-block-components-checkout-order-summary__title[aria-expanded="true"] .wc-block-components-checkout-order-summary__title-icon {
    transform: rotate(180deg);
}

/* Order summary content */
.wc-block-components-checkout-order-summary__content {
    padding: 0;
}

/* =========================================
   4. ORDER ITEMS STYLING
   ========================================= */

.wc-block-components-order-summary {
    border-radius: 8px;
    padding: 0 !important;
}

.wc-block-components-order-summary__content {
    padding: 0;
}

.wc-block-components-order-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    background: #F9FBFB;
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.wc-block-components-order-summary-item:hover {
    background: var(--lp-mint);
}

.wc-block-components-order-summary-item__image {
    position: relative;
    flex-shrink: 0;
}

.wc-block-components-order-summary-item__image img {
    border-radius: 6px;
    border: 2px solid #E5E7EB;
}

.wc-block-components-order-summary-item__quantity {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--lp-orange);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(241, 142, 15, 0.4);
}

.wc-block-components-order-summary-item__description {
    flex: 1;
}

.wc-block-components-product-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--lp-dark);
    margin: 0 0 8px 0;
}

.wc-block-components-order-summary-item__individual-prices {
    color: var(--lp-grey);
    font-size: 0.95rem;
}

.wc-block-components-order-summary-item__total-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--lp-teal);
    align-self: center;
}

/* =========================================
   5. COUPON FORM STYLING
   ========================================= */

.wc-block-components-totals-coupon {
    margin: 20px 0;
}

.wc-block-components-panel__button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px !important;
    background: transparent;
    border: 2px dashed var(--lp-teal);
    border-radius: 8px;
    color: var(--lp-teal);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.wc-block-components-panel__button:hover {
    background: var(--lp-mint);
    border-style: solid;
}

.wc-block-components-panel__button-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.2s ease;
}

.wc-block-components-panel__button[aria-expanded="true"] .wc-block-components-panel__button-icon {
    transform: rotate(180deg);
}

/* =========================================
   6. TOTALS SECTION STYLING
   ========================================= */

.wc-block-components-totals-wrapper {
    margin: 15px 0;
}

.wc-block-components-totals-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #F9FBFB;
    border-radius: 8px;
    margin-bottom: 10px;
}

.wc-block-components-totals-item__label {
    font-weight: 600;
    color: var(--lp-dark);
    font-size: 1rem;
}

.wc-block-components-totals-item__value {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--lp-teal);
}

/* Footer total - larger and more prominent */
.wc-block-components-totals-footer-item {
    background: var(--lp-mint);
    border: 2px solid var(--lp-teal);
    padding: 20px 25px;
    margin-top: 20px;
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__label {
    font-size: 1.25rem;
    font-family: 'Poppins', sans-serif;
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
    font-size: 1.75rem;
}

/* =========================================
   7. CHECKOUT FORM SECTIONS - Match Theme Style
   ========================================= */

.wc-block-components-checkout-step:not(.wc-block-checkout__billing-fields):not(.wc-block-checkout__contact-fields) {
    background: var(--lp-white);
    border-radius: var(--lp-radius);
    padding: 35px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 88, 98, 0.06);
    border-top: 5px solid var(--lp-teal);
}

.wc-block-components-checkout-step__heading-container {
    margin-bottom: 25px;
}

.wc-block-components-checkout-step__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--lp-dark);
    margin: 0;
}

.wc-block-components-checkout-step__description {
    color: var(--lp-grey);
    font-size: 0.95rem;
    margin-top: 10px;
    line-height: 1.6;
}

/* =========================================
   8. FORM INPUTS - Modern Theme Style
   ========================================= */

/* Text inputs with floating labels */
.wc-block-components-text-input,
.wc-block-components-country-input,
.wc-block-components-state-input {
    position: relative;
    margin-bottom: 15px;
}

.wc-block-components-text-input input,
.wc-blocks-components-select__select {
    width: 100%;
    padding: 16px 18px;
    font-size: 1rem;
    font-family: 'Raleway', sans-serif;
    color: var(--lp-dark);
    background: #F9FBFB;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.wc-block-components-text-input input:focus,
.wc-blocks-components-select__select:focus {
    background: var(--lp-white);
    border-color: var(--lp-teal);
    box-shadow: 0 0 0 3px rgba(0, 88, 98, 0.1);
}

.wc-block-components-text-input input:hover,
.wc-blocks-components-select__select:hover {
    border-color: var(--lp-teal);
}

/* Floating labels - unified styling */
.wc-block-components-text-input label,
.wc-blocks-components-select__label,
.wc-block-components-country-input label,
.wc-block-components-state-input label,
.custom-checkout-field label,
.form-row label {
    position: absolute !important;
    left: 14px !important;
    top: -2px !important;
    transform: none !important;
    font-size: 0.75rem !important;
    color: var(--lp-teal) !important;
    background: var(--lp-white) !important;
    font-weight: 600 !important;
    pointer-events: none !important;
    transition: all 0.2s ease !important;
    padding: 0 4px !important;
    z-index: 1 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    max-width: calc(100% - 28px) !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    cursor: default !important;
}

/* Select dropdown styling */
.wc-blocks-components-select {
    position: relative;
}

.wc-blocks-components-select__container {
    position: relative;
}

.wc-blocks-components-select__expand {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--lp-grey);
}

.wc-blocks-components-select__select {
    appearance: none;
    cursor: pointer;
    padding-right: 45px;
}

/* Error states */
.wc-block-components-text-input input[aria-invalid="true"],
.wc-blocks-components-select__select[aria-invalid="true"] {
    border-color: #EF4444;
    background: #FEF2F2;
}

.wc-block-components-validation-error {
    color: #EF4444;
    font-size: 0.85rem;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =========================================
   9. ADDRESS CARDS
   ========================================= */

.wc-block-components-address-card-wrapper {
    margin-bottom: 20px;
}

.wc-block-components-address-card {
    background: var(--lp-mint);
    border-radius: 8px;
    padding: 20px;
    position: relative;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.wc-block-components-address-card:hover {
    border-color: var(--lp-teal);
}

.wc-block-components-address-card address {
    font-style: normal;
    color: var(--lp-dark);
    line-height: 1.8;
    padding-right: 60px;
}

.wc-block-components-address-card__address-section {
    display: block;
}

.wc-block-components-address-card__edit {
    position: absolute;
    top: 15px;
    right: 15px;
    color: var(--lp-teal);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 8px 16px;
    background: var(--lp-white);
    border-radius: 6px;
    border: 2px solid var(--lp-teal);
}

.wc-block-components-address-card__edit:hover {
    background: var(--lp-teal);
    color: var(--lp-white);
}

/* Address form toggle */
.wc-block-components-address-form__address_2-toggle {
    display: inline-block;
    color: var(--lp-teal);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.wc-block-components-address-form__address_2-toggle:hover {
    color: var(--lp-orange);
}

/* =========================================
   10. CUSTOM PERSONAL INFO SECTION (from plugin)
   ========================================= */

.custom-personal-info,
.woocommerce-additional-fields,
.wc-block-checkout__billing-fields.wc-block-components-checkout-step,
.wc-block-checkout__contact-fields.wc-block-components-checkout-step,
.wp-block-woocommerce-checkout-billing-address-block.wc-block-components-checkout-step,
.wp-block-woocommerce-checkout-contact-information-block.wc-block-components-checkout-step {
    background: var(--lp-white) !important;
    border-radius: var(--lp-radius) !important;
    padding: 35px !important;
    margin-bottom: 30px !important;
    box-shadow: 0 10px 30px rgba(0, 88, 98, 0.06) !important;
    border: none !important;
    border-top: 5px solid var(--lp-orange) !important;
}

.custom-personal-info h2,
.custom-personal-info h3,
.woocommerce-additional-fields h3,
.wc-block-checkout__billing-fields.wc-block-components-checkout-step .wc-block-components-checkout-step__title,
.wc-block-checkout__contact-fields.wc-block-components-checkout-step .wc-block-components-checkout-step__title,
.wp-block-woocommerce-checkout-billing-address-block.wc-block-components-checkout-step .wc-block-components-checkout-step__title,
.wp-block-woocommerce-checkout-contact-information-block.wc-block-components-checkout-step .wc-block-components-checkout-step__title {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 700 !important;
    font-size: 1.5rem !important;
    color: var(--lp-dark) !important;
    margin: 0 0 10px 0 !important;
}

.custom-personal-info p,
.woocommerce-additional-fields p,
.wc-block-checkout__billing-fields.wc-block-components-checkout-step .wc-block-components-checkout-step__description,
.wc-block-checkout__contact-fields.wc-block-components-checkout-step .wc-block-components-checkout-step__description,
.wp-block-woocommerce-checkout-billing-address-block.wc-block-components-checkout-step .wc-block-components-checkout-step__description,
.wp-block-woocommerce-checkout-contact-information-block.wc-block-components-checkout-step .wc-block-components-checkout-step__description {
    color: var(--lp-grey) !important;
    font-size: 0.95rem !important;
    margin-bottom: 25px !important;
    line-height: 1.6 !important;
}

/* Custom field styling */
.custom-checkout-field,
.form-row {
    position: relative;
    margin-bottom: 25px;
}

.custom-checkout-field input,
.custom-checkout-field select,
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row select,
.form-row textarea {
    width: 100%;
    padding: 16px 18px;
    font-size: 1rem;
    font-family: 'Raleway', sans-serif;
    color: var(--lp-dark);
    background: #F9FBFB;
    border: 2px solid #E5E7EB;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.custom-checkout-field input:focus,
.custom-checkout-field select:focus,
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    background: var(--lp-white);
    border-color: var(--lp-orange);
    box-shadow: 0 0 0 3px rgba(241, 142, 15, 0.1);
}

.custom-checkout-field label,
.form-row label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--lp-dark);
    margin-bottom: 8px;
}

/* =========================================
   11. BUTTONS - Use Theme Button Styles
   ========================================= */

.wc-block-components-button,
.wc-block-components-checkout-place-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 40px;
    background-color: var(--lp-orange) !important;
    color: #ffffff !important;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    border: 2px solid var(--lp-orange) !important;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(241, 142, 15, 0.3);
    width: 100%;
    margin-top: 20px;
}

.wc-block-components-button:hover,
.wc-block-components-checkout-place-order-button:hover {
    background-color: #d67a00 !important;
    border-color: #d67a00 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(241, 142, 15, 0.4);
}

.wc-block-components-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Secondary buttons */
.wc-block-components-button--outlined {
    background-color: transparent !important;
    color: var(--lp-teal) !important;
    border: 2px solid var(--lp-teal) !important;
    box-shadow: none;
}

.wc-block-components-button--outlined:hover {
    background-color: var(--lp-teal) !important;
    color: #ffffff !important;
}

/* =========================================
   12. NOTICES & ALERTS
   ========================================= */

.wc-block-components-notices {
    margin-bottom: 20px;
}

.wc-block-components-notice-banner {
    padding: 18px 22px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.wc-block-components-notice-banner--error {
    background: #FEF2F2;
    border-left: 4px solid #EF4444;
    color: #991B1B;
}

.wc-block-components-notice-banner--success {
    background: var(--lp-mint);
    border-left: 4px solid var(--lp-teal);
    color: var(--lp-teal);
}

.wc-block-components-notice-banner--info {
    background: #EFF6FF;
    border-left: 4px solid #3B82F6;
    color: #1E40AF;
}

/* =========================================
   13. LOADING STATES
   ========================================= */

.wc-block-components-spinner {
    border-color: var(--lp-mint);
    border-top-color: var(--lp-teal);
}

.wc-block-components-loading-mask {
    background: rgba(255, 255, 255, 0.9);
}

/* =========================================
   14. PRODUCT COLUMNS
   ========================================= */

/* Override default 4 column layout */
.woocommerce ul.products {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.woocommerce ul.products li.product {
    width: 100%;
    margin: 0;
}

/* =========================================
   15. MOBILE RESPONSIVENESS
   ========================================= */

@media (max-width: 900px) {
    /* Stack main and sidebar on tablets */
    .wc-block-components-main,
    .wc-block-components-sidebar {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .wc-block-components-checkout-step,
    .wp-block-woocommerce-checkout-totals-block,
    .custom-personal-info,
    .woocommerce-additional-fields,
    .wp-block-woocommerce-checkout-order-summary-block {
        padding: 25px 20px;
    }

    .wc-block-components-checkout-step__title,
    .custom-personal-info h2,
    .custom-personal-info h3 {
        font-size: 1.25rem;
    }

    .wc-block-components-button,
    .wc-block-components-checkout-place-order-button {
        padding: 16px 32px;
        font-size: 1rem;
    }

    /* Order summary adjustments */
    .wc-block-components-checkout-order-summary__title {
        padding: 16px 20px;
    }

    .wc-block-components-checkout-order-summary__title-text {
        font-size: 1.1rem;
    }

    .wc-block-components-checkout-order-summary__title-price {
        font-size: 1.25rem;
    }

    /* Products - 2 columns on tablet */
    .woocommerce ul.products {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    /* Products - 1 column on mobile */
    .woocommerce ul.products {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Stack order items vertically on small screens */
    .wc-block-components-order-summary-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .wc-block-components-order-summary-item__description {
        width: 100%;
    }

    .wc-block-components-order-summary-item__total-price {
        width: 100%;
        text-align: center;
        margin-top: 10px;
    }

    /* Smaller address card edit button on mobile */
    .wc-block-components-address-card__edit {
        position: static;
        display: block;
        margin-top: 15px;
        text-align: center;
    }

    .wc-block-components-address-card address {
        padding-right: 0;
    }
}
.woocommerce.columns-4{display: none;}

/* =========================================
   16. THANK YOU PAGE STYLING
   ========================================= */

/* Thank you page header */
.thankyou-header {
    text-align: center;
    padding: 60px 0 40px 0;
}

.thankyou-congrats-img {
    max-width: 200px;
    height: auto;
    margin: 0 auto 20px auto;
    display: block;
}

.thankyou-header .lp-h1 {
    margin: 0;
}

/* Thank you grid - content + image */
.thankyou-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
    margin-bottom: 40px;
}

.thankyou-content {
    font-family: 'Raleway', sans-serif;
    color: var(--lp-grey);
    line-height: 1.8;
}

.thankyou-content p {
    margin-bottom: 20px;
}

.thankyou-content ul {
    margin: 20px 0;
    padding-left: 25px;
}

.thankyou-content ul li {
    margin-bottom: 10px;
    color: var(--lp-grey);
}

.thankyou-content a {
    color: var(--lp-teal);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.thankyou-content a:hover {
    color: var(--lp-orange);
}

.thankyou-content b,
.thankyou-content strong {
    color: var(--lp-dark);
    font-weight: 700;
}

.thankyou-image {
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.thankyou-image img {
    width: 100%;
    max-width: 450px;
    height: auto;
    border-radius: var(--lp-radius);
    box-shadow: 0 15px 40px rgba(0, 88, 98, 0.1);
}

/* Additional content section */
.thankyou-additional {
    background: var(--lp-bg-light);
    border-radius: var(--lp-radius);
    padding: 40px;
    margin-bottom: 40px;
    border-left: 5px solid var(--lp-teal);
}

.thankyou-additional p {
    margin-bottom: 15px;
    line-height: 1.8;
    color: var(--lp-grey);
}

.thankyou-additional p:last-child {
    margin-bottom: 0;
}

.thankyou-additional a {
    color: var(--lp-teal);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.thankyou-additional a:hover {
    color: var(--lp-orange);
}

/* Product card summary */
.thankyou-product-card {
    background: var(--lp-white);
    border-radius: var(--lp-radius);
    padding: 35px;
    box-shadow: 0 10px 30px rgba(0, 88, 98, 0.08);
    border-top: 5px solid var(--lp-orange);
    text-align: center;
}

.thankyou-product-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--lp-dark);
    margin-bottom: 15px;
}

.thankyou-product-price {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    color: var(--lp-teal);
    margin-bottom: 20px;
}

.thankyou-product-description {
    color: var(--lp-grey);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Mobile responsiveness for thank you page */
@media (max-width: 900px) {
    .thankyou-header {
        padding: 40px 0 30px 0;
    }

    .thankyou-congrats-img {
        max-width: 150px;
    }

    .thankyou-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .thankyou-image {
        order: -1;
    }

    .thankyou-image img {
        max-width: 350px;
    }

    .thankyou-additional {
        padding: 25px;
    }

    .thankyou-product-card {
        padding: 25px;
    }

    .thankyou-product-name {
        font-size: 1.25rem;
    }

    .thankyou-product-price {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .thankyou-image img {
        max-width: 100%;
    }
}