/**
 * Balduturgus Theme Styles for Inkodus Manager Cart
 * Adapts the plugin UI to match the Balduturgus theme design
 */

/* Main wrapper for inkodus manager cart */
.inkodus-manager-cart-wrapper {
    font-family: 'Cabin', sans-serif;
    color: #353635;
    background: #ffffff;
    position: relative;
    z-index: 50;
}

/* Cart items container */
.cart__items {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Scope wrapper styles to cart plugin only to prevent conflicts with header */
.inkodus-manager-cart-wrapper .wrapper {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    padding: 0 16px;
}

/* Individual cart item */
.cart__item {
    background: #ffffff;
    border: 1px solid #C2C2C2;
    margin-bottom: 16px;
    position: relative;
}

.cart__top_pickup_courier h4, .cart__top_pickup_client h4, .cart__item_pickup h4, .cart__item_delivery h4, .cart__item_summary h4, .cart__item_warehouses h4, .cart__top_warehouses h4, .cart__top_delivery h4, .cart__top_services h4 {
    font-weight: 700;
    font-size: 14px;
    line-height: 17px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.cart__item .wrapper {
    padding: 24px;
    box-sizing: border-box;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.cart__totals {
    width: 100%;
    margin-bottom: 24px;
}

.cart__totals dl {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: baseline;
    -ms-flex-align: baseline;
    align-items: baseline;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    margin: 0;
    font-size: 16px;
    line-height: 22px;
}

.cart__totals dl div {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
}

.cart__totals_tax {
    font-size: 12px;
    line-height: 12px;
}

.cart__totals_sub {
    margin-right: 8px;
}


/* Cart item top section */
.cart__item_top {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin: 16px 0;
}

.cart__item_top a {
    display: flex;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    flex: 1;
}

/* Product thumbnail */
.cart__item_thumbnail {
    width: 80px;
    height: 80px;
    margin-right: 16px;
    flex-shrink: 0;
}

.cart__item_thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 1px solid #e1e1e1;
}

/* Product title */
.cart__item_title {
    flex: 1;
}

.cart__item_title h2 {
    font-family: 'Cabin', sans-serif;
    font-size: 18px !important;
    line-height: 22px;
    font-weight: 700;
    color: #353635;
    margin: 0 0 8px 0;
    text-align: left;
}

/* Remove button */
.cart__item_remove {
    margin-left: 16px;
}

.cart__item_remove button {
    background: transparent;
    border: none;
    color: #EE3A25;
    font-size: 40px !important;
    font-weight: 150 !important;
    cursor: pointer;
    padding: 4px;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart__item_remove button:hover {
    background: #EE3A25;
    color: white;
    border-radius: 2px;
}

/* Disabled remove button for mandatory items */
.cart__item_remove button.remove-cart-item--disabled {
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.cart__item_remove button.remove-cart-item--disabled:hover {
    background: transparent;
    color: #999;
    border-radius: 0;
}

/* Cart item content - main content area */
.cart__item_content {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin-bottom: 32px;
}

.cart__item_content_left {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    width: 50%;
}

.cart__item_content_right {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    width: calc(50% - 77px);
}

.cart__item_warehouses {
    width: 100%;
}

.cart__item_warehouse_name {
    font-size: 14px;
    line-height: 20px;
    -webkit-box-flex: 1;
    -ms-flex-positive: 1;
    flex-grow: 1;
}

.cart__item_warehouse_stock {
    font-weight: 700;
    font-size: 14px;
    line-height: 20px;
    margin-right: 23px;
}

.cart__item_warehouses ul li input {
    width: 60px;
    height: 40px;
    border: 1px solid #C2C2C2;
    text-align: center;
    outline: none;
    -webkit-transition: all 400ms cubic-bezier(0.22, 0.84, 0.33, 1.04);
    -o-transition: all 400ms cubic-bezier(0.22, 0.84, 0.33, 1.04);
    transition: all 400ms cubic-bezier(0.22, 0.84, 0.33, 1.04);
}

.cart__totals {
    width: 100%;
    margin-bottom: 24px;
}

.cart__controls {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

.cart__controls button,
.cart__controls .button,
.cart__controls a.button {
    width: 100%;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
}

.cart--section .wrapper {
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

/* Cart item summary */
.cart__item_summary {
    width: 100%;
    margin-bottom: 16px;
}

.cart__item_summary h4 {
    font-family: 'Cabin', sans-serif;
    font-size: 16px;
    line-height: 19px;
    font-weight: 700;
    color: #353635;
    margin: 0 0 16px 0;
}

.cart__item_summary_content {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    padding: 16px;
    width: 100%;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    border: 1px solid #C2C2C2;
}

.cart__top .wrapper {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
}

.cart__top_delivery_container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: horizontal;
    -webkit-box-direction: normal;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 16px;
}

/* Price display */
.cart__item_discount {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
}

/* Alignment fixes for cart summary content elements */
.cart__item_summary_content {
    align-items: flex-start;
}

/* Base price element styling - this is our reference alignment */
.cart__item_price, .cart__item_quantity_regular, .cart__item_quantity_boxes {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 35%;
    text-align: center;
}

.cart__item_price span, .cart__item_quantity_regular span, .cart__item_quantity_boxes span, .cart__item_box_discount span {
    font-size: 24px;
    line-height: 24px;
    color: #353635;
}

.cart__item_quantity_breakdown .cart__item_price {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;

}

.cart__item_price label, .cart__item_quantity_regular label,
.cart__item_discount label, .cart__item_box_discount label,
.cart__item_discount_inputs label {
    font-size: 11px !important;
    line-height: 14px;
    margin-bottom: 4px;
}

.cart__item_price span, .cart__item_discount span {
    font-size: 24px;
    line-height: 24px;
    color: #353635;
}

/* Discount summary alignment - labels align with bottom price */
.cart__item_discount_summary {
    display: flex;
    flex-direction: column;
}

.cart__item_discount_summary .cart__item_price {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cart__item_discount_summary .cart__item_price span {
    font-size: 16px;
    line-height: 18px;
    font-weight: 600;
    color: #EE3A25;
}

.cart__item_regular_price,
.cart__item_box_price,
.cart__item_quantity_regular,
.cart__item_quantity_boxes {
    font-size: 24px;
    line-height: 24px;
}


/* Select controls styling */
.cart__select {
    margin-bottom: 16px;
}

.cart__select h4 {
    font-family: 'Cabin', sans-serif;
    font-weight: 700;
    font-size: 14px;
    line-height: 17px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
    color: #353635;
}

.cart__select select {
    width: 100%;
    height: 44px;
    padding: 8px 12px;
    border: 2px solid #C2C2C2;
    background: #ffffff;
    font-family: 'Cabin', sans-serif;
    font-size: 14px;
    line-height: 20px;
    color: #353635;
    border-radius: 0;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23353635' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart__select select:focus {
    outline: none;
    border-color: #EE3A25;
    box-shadow: 0 0 0 2px rgba(238, 58, 37, 0.1);
}

.cart__select select:hover {
    border-color: #EE3A25;
}

.cart__select select option {
    padding: 8px 12px;
    font-family: 'Cabin', sans-serif;
    font-size: 14px;
    color: #353635;
}

/* Quantity controls inside summary content */

.cart__item_quantity label {
    font-weight: 400;
    color: #353635;
    margin: 0;
}

.cart__item_quantity_input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cart__item_quantity_subtract,
.cart__item_quantity_add {
    background: #353635 !important;
    border: 2px solid #353635;
    color: red;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.cart__item_quantity_subtract:hover,
.cart__item_quantity_add:hover {
    background: red !important;
    border-color: white !important;
    color: white !important;
}

.cart__quantity_input {
    width: 120px !important;
    height: 32px;
    text-align: center;
    border: 1px solid #C2C2C2;
    font-size: 14px;
    padding: 0 8px;
    box-sizing: border-box;
    margin-left: 9px;
    margin-right: 9px;
}

/* Discount controls for managers */
.cart__item_discount {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: #fff5f5;
    border: 1px solid #EE3A25;
}

/* Discount labels alignment is handled by the global rule above */

.cart__item_discount_input input {
    width: 80px;
    height: 32px;
    text-align: center;
    border: 1px solid #C2C2C2;
    font-size: 14px;
    padding: 0 8px;
    box-sizing: border-box;
}

.cart__item_discount_input input:disabled {
    background: #f5f5f5;
    color: #999;
}

/* Box discount and total display - matching cart_item_summary_content styling */
.cart__item_box_discount,
.cart__item_total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid #C2C2C2;
    border-top: none;
    width: 100%;
    box-sizing: border-box;
    font-weight: 200 !important;
    flex-direction: row !important;
}

/* Quantity element outside summary_content should match the same block styling */
.cart__item_quantity {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 1px solid #C2C2C2;
    border-bottom: none;
    width: 100%;
    box-sizing: border-box;
    font-weight: 200 !important;
    flex-direction: column !important;
}

.cart__item_box_discount label,
.cart__item_total label {
    margin: 0;
    width: 60%;
    color: #000000;
    text-align: center;
}

.cart__item_box_discount span,
.cart__item_total span {
    width: 40%;
    font-size: 22px;
    line-height: 18px;
    color: #000000 !important;
    text-align: center;
    font-weight: 200 !important;
}

/* Empty cart state */
.cart-empty {
    text-align: center;
    padding: 40px 20px;
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
}

.cart-empty p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Information notes */
.cart__item_info {
    background: white !important;
    border: 1px solid white;
    margin-bottom: 16px;
    border-radius: 2px;
    font-size: 18px;
}

.cart__item_info p {
    margin: 0;
    font-size: 14px;
    color: red;
}

/* Loading states */
.cart__item--loading {
    opacity: 0.6;
    pointer-events: none;
}

.cart__item--loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive design - Enhanced for better mobile experience */

/* Tablet and mobile improvements */
@media (max-width: 1024px) {
    .inkodus-manager-cart-wrapper .wrapper {
        padding: 0 12px;
    }

    .cart__item .wrapper {
        padding: 20px;
    }

    .cart__item_content_left,
    .cart__item_content_right {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .inkodus-manager-cart-wrapper .wrapper {
        padding: 0 8px;
    }

    .cart__item .wrapper {
        padding: 16px;
    }

    /* Stack cart content sections vertically on mobile */
    .cart__item_content {
        flex-direction: column;
        gap: 16px;
    }

    .cart__item_content_left,
    .cart__item_content_right {
        width: 100%;
    }

    .cart__item_content_right {
        margin-top: 0;
    }

    /* Optimize warehouse section for mobile */
    .cart__item_warehouses {
        width: 100%;
    }

    .cart__item_warehouses ul {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin: 0;
        padding: 0;
        list-style: none;
    }

    .cart__item_warehouses ul li {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 12px;
        border: 1px solid #e1e1e1;
        border-radius: 4px;
    }

    .cart__item_warehouse_name {
        flex: 1;
        margin-right: 12px;
        text-align: left;
    }

    .cart__item_warehouse_stock {
        width: 60px;
        text-align: center;
        font-weight: 700;
        font-size: 14px;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .cart__item_warehouses ul li input {
        width: 60px;
        height: 40px;
        font-size: 14px;
        text-align: center;
        flex-shrink: 0;
    }

    /* Mobile select styling */
    .cart__select select {
        height: 48px;
        font-size: 16px;
        padding: 12px 40px 12px 12px;
        background-size: 20px;
        background-position: right 16px center;
    }
}

@media (max-width: 480px) {
    /* Further mobile optimizations */
    .inkodus-manager-cart-wrapper .wrapper {
        padding: 0 4px;
    }

    .cart__item .wrapper {
        padding: 12px;
    }

    .cart__item_title h2 {
        font-size: 16px;
        line-height: 20px;
    }

    .cart__item_summary h4 {
        font-size: 14px;
        line-height: 16px;
    }

    /* Full width layout for very small screens */
    .cart__item_top {
        gap: 8px;
    }

    .cart__item_top a {
        flex-direction: column;
        align-items: stretch;
    }

    .cart__item_thumbnail {
        width: 100%;
        height: 160px;
        margin-right: 0;
        margin-bottom: 8px;
    }

    .cart__item_remove {
        align-self: center;
        margin-top: 8px;
    }

    .cart__item_remove button {
        padding: 8px 12px;
        font-size: 42px;
        border-radius: 4px;
        background: #f5f5f5;
        border: 1px solid #C2C2C2;
    }

    .cart__item_remove button:hover {
        background: #EE3A25;
        color: white;
        border-color: #EE3A25;
    }

    .cart__item_content_left,
    .cart__item_content_right {
        width: 100% !important;
    }

    /* Larger touch targets for mobile */
    .cart__item_quantity_subtract,
    .cart__item_quantity_add {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .cart__item_discount_input input {
        width: 120px;
        height: 44px;
        font-size: 18px;
    }

    .cart__item_warehouses ul li input {
        width: 60px;
        height: 40px;
        font-size: 14px;
        text-align: center;
    }

    /* Improve price display on mobile */
    .cart__item_price span,
    .cart__item_quantity_regular span,
    .cart__item_quantity_boxes span,
    .cart__item_box_discount span {
        font-size: 20px;
        line-height: 22px;
    }

    /* Better spacing for mobile */
    .cart__item_content {
        gap: 12px;
        margin-bottom: 20px;
    }

    .cart__totals {
        margin-bottom: 16px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .cart__item .wrapper {
        padding: 8px;
    }

    .cart__item_quantity,
    .cart__item_discount {
        padding: 8px;
        margin-bottom: 0 !important;
    }
}

/* Mobile header overlap prevention */
@media (max-width: 767px) {
    /* Ensure cart doesn't overlap with dynamic header - theme uses .body class with margin-top: 170px */
    .inkodus-manager-cart-wrapper {
        position: relative;
        z-index: 1;
        margin-top: 180px; /* Slightly more than theme's .body margin-top: 170px */
        padding-top: 10px;
    }

    /* Additional spacing for admin users with admin bar */
    .wpAdminBarMobile .inkodus-manager-cart-wrapper {
        margin-top: 200px; /* More space when admin bar is present */
        padding-top: 20px;
    }

    /* When header is scrolled (transformed), reduce spacing */
    body.header--scrolled .inkodus-manager-cart-wrapper {
        margin-top: 90px; /* Less space when header is hidden/scrolled */
        padding-top: 10px;
    }

    /* Override theme's body margin for cart pages to prevent double spacing */
    body .body.cart-page .inkodus-manager-cart-wrapper,
    body.cart-page .body .inkodus-manager-cart-wrapper {
        margin-top: 20px; /* Reset if theme's body margin is also applied */
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .inkodus-manager-cart-wrapper {
        margin-top: 15px;
    }

    /* Move delivery address form to next line when courier delivery type is selected */
    .cart__top_delivery_container--courier {
        -webkit-box-orient: vertical !important;
        -webkit-box-direction: normal !important;
        -ms-flex-direction: column !important;
        flex-direction: column !important;
    }

    .cart__top_delivery_container--courier .cart__top_delivery {
        width: 100% !important;
        margin-bottom: 16px;
    }

    .cart__top_delivery_container--courier .cart__top_pickup_container {
        width: 100% !important;
    }

    /* Keep all delivery address input fields in one horizontal line */
    .cart__top_delivery_container--courier .cart__top_input_group {
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-orient: horizontal;
        -webkit-box-direction: normal;
        -ms-flex-direction: row;
        flex-direction: row;
        gap: 8px;
        -ms-flex-wrap: nowrap;
        flex-wrap: nowrap;
    }

    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete,
    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete__input {
        -webkit-box-flex: 1;
        -ms-flex: 1 1 auto;
        flex: 1 1 auto;
        min-width: 0;
    }

    /* Adjust individual field widths for better fit */
    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete--residential_area {
        -webkit-box-flex: 2;
        -ms-flex: 2 1 auto;
        flex: 2 1 auto;
    }

    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete--street {
        -webkit-box-flex: 2;
        -ms-flex: 2 1 auto;
        flex: 2 1 auto;
    }

    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete--house_number {
        -webkit-box-flex: 1;
        -ms-flex: 1 1 auto;
        flex: 1 1 auto;
    }

    .cart__top_delivery_container--courier .cart__top_input_group .autocomplete--apartament_number {
        -webkit-box-flex: 1;
        -ms-flex: 1 1 auto;
        flex: 1 1 auto;
    }
}

/* Loading service option styling - ensure text is black */
.inkodus-manager-cart-wrapper label[for="loading_service_yes"],
.inkodus-manager-cart-wrapper label[for="loading_service_no"],
.inkodus-manager-cart-wrapper .cart__top_service--mandatory label[for="loading_service_yes"],
.inkodus-manager-cart-wrapper li label[for="loading_service_yes"],
.inkodus-manager-cart-wrapper li label[for="loading_service_no"],
.mandatory-loading-service label[for="loading_service_yes"],
.mandatory-loading-service label[for="loading_service_no"],
.mandatory-loading-service li label[for="loading_service_yes"],
.mandatory-loading-service li label[for="loading_service_no"],
#loading-services-placeholder label[for="loading_service_yes"],
#loading-services-placeholder label[for="loading_service_no"] {
    color: #000000 !important;
    font-weight: normal !important;
}

/* Override opacity for mandatory service labels - fix for gray text issue */
.cart__top_service--mandatory label[for="loading_service_yes"],
.cart__top_service--mandatory label[for="loading_service_no"] {
    color: #000000 !important;
    font-weight: normal !important;
    opacity: 1 !important;
}
