/*
  =============================================
  COD Plugin Stylesheet - Improved Version
  =============================================
  - Uses CSS Variables for easy theme management.
  - Reduced usage of !important.
  - Simplified selectors.
  - Added comments for better readability.
  - Replaced floats with Flexbox for layout.
*/

:root {
    --primary-color: #25d366;
    --secondary-color: #25d366;
    --text-color: #545454;
    --light-text-color: #888;
    --white-color: #fff;
    --light-background: #fff5f4;
    --border-color-light: #25d366;
    --border-color-dark: #ddd;
    --error-color: red;
    --success-color: #25d366;
    --disabled-color: #bababa;
}


/* ===================================
   Main Checkout Container
   =================================== */
#codplugin-checkout {
    position: relative;
    padding: 30px;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    margin-top: 50px;
}

.codplugin-checkout-title {
    text-align: center;
    padding: 0 20px;
    display: block;
    color: var(--text-color);
    font-size: 16px;
    margin: 0 20px 20px;
}

/* ===================================
   Form Styles
   =================================== */
#codplugin_woo_single_form input,
#codplugin_woo_single_form textarea,
#codplugin_woo_single_form select {
    border: 1px solid var(--primary-color);
    height: 50px;
    border-radius: 3px;
}

#codplugin_woo_single_form #order-notes {
    margin-top: 10px;
}

.codplugin-field {
    margin: 0;
}

.two-col-inputs {
    display: grid;
    grid-gap: 15px;
    grid-template-columns: repeat(2, 1fr);
}

.payment-proof {
    display: grid;
    grid-gap: 15px;
    grid-template-columns: repeat(2, 1fr);
}

.payment-proof label {
    margin-top: 5px;
}

.payment-proof input {
    border: none;
}


/* ===================================
   Order History Header
   =================================== */
#codplugin_order_history {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    cursor: pointer;
    border-bottom: 2px solid var(--primary-color);
    background: var(--light-background);
    padding: 0 10px;
    margin-bottom: 0;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
}

#codplugin_h_o {
    line-height: 50px;
    font-size: 16px;
}

#codplugin_h_o i {
    font-size: 20px;
    color: var(--primary-color);
    margin-right: 5px;
}

#codplugin_h_left i {
    color: var(--primary-color);
    font-size: 25px;
}

/* ===================================
   Order Summary Toggle
   =================================== */
#codplugin_show_hide {
    background: var(--light-background);
    padding: 10px;
    margin-top: 0;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
}

#codplugin_show_hide table {
    margin-bottom: 0;
}

/* ===================================
   Quantity Controls & Footer
   =================================== */
.form-footer {
    display: grid;
    grid-gap: 15px;
    grid-template-columns: 125px 1fr;
    margin-top: 10px;
}

.form-qte {
    display: grid;
    grid-template-columns: 35px 50px 35px;
    border: 2px solid var(--primary-color);
    border-radius: 3px;
}

#codplugin_add_button,
#codplugin_count_button,
#codplugin_remove_button {
    color: var(--text-color);
    font-size: 20px;
    text-align: center;
    line-height: 46px;
    cursor: pointer;
}

#codplugin_remove_button {
    border-left: 2px solid var(--primary-color);
}

#codplugin_add_button {
    border-right: 2px solid var(--primary-color);
}

/* ===================================
   Confirmation Button
   =================================== */
#nrwooconfirm {
    background-color: var(--primary-color);
    border: none;
    color: var(--white-color) !important; /* Important kept for potential plugin overrides */
    height: 50px;
    line-height: 50px;
    padding: 0;
    overflow: hidden;
    border-radius: 3px;
}

#nrwooconfirm.atc-buy-button {
    display: grid;
    grid-gap: 15px;
    grid-template-columns: repeat(2, 1fr);
    background: none !important; /* Important kept for potential plugin overrides */
}

#nrwooconfirm.atc-buy-button .button,
#nrwooconfirm.atc-buy-button input {
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    white-space: normal;
    padding: 3px;
    font-size: 15px;
}

/* ===================================
   Variation & Price Tables
   =================================== */
#codplugin-checkout table {
    border: none;
    width: 100%;
    margin: 0 0 1.5em;
    border-collapse: separate;
    border-spacing: 0;
}

#codplugin-checkout td {
    border: none;
    border-bottom: 2px dotted var(--primary-color);
    padding: 8px;
}

#codplugin-checkout .full-price td {
    font-weight: bold;
    border-bottom: 0;
}

#codplugin-checkout .full-price td:last-child {
    color: var(--primary-color);
}

#codplugin-checkout .variation-prices {
    font-size: 16px;
}

#codplugin-checkout .variation-prices bdi {
    font-weight: bold;
    color: var(--primary-color);
}

#codplugin-checkout .variation-prices .crossed-price bdi {
    font-weight: normal;
    color: #aeaeae;
}

/* Custom Radio Buttons */
#codplugin_woo_radio,
#codplugin-checkout .variation-prices input[type="radio"] {
    position: relative;
    width: 15px !important; /* Important kept for potential plugin overrides */
    height: 15px !important;
}

#codplugin-checkout .variation-prices input[type="radio"]:before {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--white-color);
    border: 2px solid var(--border-color-dark);
    transition: all .1s ease-in-out;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#codplugin-checkout .variation-prices input[type="radio"]:checked::before {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

#codplugin-checkout .variation-prices input[type="radio"]:checked::after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 9px;
    height: 17px;
    border: solid var(--white-color);
    border-width: 0 3px 3px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}


/* ===================================
   Upsell Modal
   =================================== */
#cod-upsell {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

#cod-upsell-box {
    background-color: var(--white-color);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 6px;
}

#cod-upsell-loader {
    display: none;
}

#cod-upsell-box .cod-upsell-heading {
    color: var(--error-color);
    text-align: center;
    font-weight: bold;
    font-size: 45px;
    margin: 0 0 20px;
    padding-bottom: 20px;
    border-bottom: 3px dotted #eee;
}

.cod-upsell-product-title {
    text-align: center;
    font-size: 24px;
    color: var(--text-color);
}

.cod-upsell-product img {
    margin: 20px auto;
    display: block;
    max-width: 100%;
    height: auto;
}

.cod-upsell-product .price {
    display: block;
    text-align: center;
    color: var(--error-color);
    margin-bottom: 25px;
    font-size: 22px;
}

#upsell-submit {
    text-align: center;
}

#upsell-submit button {
    display: block;
    margin: 20px auto;
    color: var(--white-color);
    background-color: var(--success-color);
    padding: 15px 50px;
    font-size: 30px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#upsell-submit #cod-upsell-cancel {
    background-color: transparent;
    color: var(--disabled-color);
    padding: 0;
    font-size: 20px;
    transition: color 0.3s;
}

#upsell-submit button:hover {
    filter: brightness(0.9);
}

#upsell-submit #cod-upsell-cancel:hover {
    color: #555;
}


/* ===================================
   Misc & Helper Classes
   =================================== */
#codplugin_gif {
    margin: auto;
    width: 50px;
    height: 50px;
    display: none;
}

#codplugin_state,
#codplugin_city {
    cursor: pointer;
    color: var(--light-text-color);
}

.woocommerce div.product .product_meta,
#codplugin-checkout .woocommerce-variation-add-to-cart {
    display: none !important; /* Kept for forceful override */
}

.summary-product-title {
    font-weight: bold;
}

.summary-select-state {
    font-size: 14px;
    opacity: .8;
}

.blink-me {
    animation: blinker 1s linear infinite;
}

@keyframes blinker {
    50% {
        opacity: 0;
    }
}

.whatsapp-order-section {
    margin: 0 auto 15px;
    text-align: center;
}

.whatsapp-order-section #whatsapp-orders {
    color: var(--white-color);
    display: inline-block;
    background: var(--primary-color);
    border-radius: 50px;
    padding: 10px 20px;
    border: none;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
}

/* ===================================
   Responsive Media Queries
   =================================== */

@media (max-width: 767px) {
    #codplugin-checkout {
        padding: 30px 10px;
    }

    #upsell-submit button {
        padding: 12px 25px;
        font-size: 20px;
    }

    #cod-upsell-box .cod-upsell-heading {
        font-size: 36px;
    }
}

@media (max-width: 488px) {
    .codplugin-checkout-title {
        margin-bottom: 15px;
    }
    
    #codplugin-checkout .variation-prices {
        font-size: 14px;
    }

    div#codplugin_order_history,
    #codplugin_show_hide {
        font-size: 14px;
    }

    #codplugin-checkout td,
    #codplugin_show_hide {
        padding: 5px;
    }

    #codplugin-checkout .variation-prices .woocommerce-Price-amount {
        display: block;
        font-size: 14px;
    }

    #codplugin-checkout .variation-prices input[type="radio"]:checked::before,
    #codplugin-checkout .variation-prices input[type="radio"]:before {
        width: 25px;
        height: 25px;
    }

    #codplugin-checkout .variation-prices input[type="radio"]:checked::after {
        width: 7px;
        height: 13px;
        transform: translate(-50%, -60%) rotate(45deg);
    }
    
    #codplugin_woo_single_form,
    .two-col-inputs {
        grid-gap: 13px;
        grid-template-columns: 1fr;
    }
    
    #codplugin-checkout {
        padding: 15px;
    }
    
    div#codplugin_order_history {
        margin-top: 10px;
    }
}

@media (max-width: 417px) {
    #nrwooconfirm.atc-buy-button {
        grid-gap: 10px;
    }
    
    #codplugin-checkout .form-footer {
        grid-gap: 10px;
        grid-template-columns: 95px 1fr;
    }
}

