/* ============================================
   BH COD Order System - Main Styles
   ============================================ */

:root {
    --pcod-btn-color: #28a745;
    --pcod-btn-hover: #218838;
}

/* ---- Product Page Buttons ---- */
.pcod-buttons-wrap {
    width: 100%;
    padding-top: 12px;
    margin-bottom: 10px;
    clear: both;
}

.pcod-cod-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 700;
    color: #fff !important;
    background: var(--pcod-btn-color) !important;
    border: none !important;
    outline: none !important;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.25);
    letter-spacing: 0.3px;
    line-height: 1.4;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.pcod-cod-btn:hover {
    background: var(--pcod-btn-hover);
    transform: translateY(-1px);
    box-shadow: 0 5px 16px rgba(40, 167, 69, 0.35);
}

.pcod-cod-btn:active {
    transform: translateY(0);
}

.pcod-cod-btn svg {
    flex-shrink: 0;
}

/* Contact Buttons */
.pcod-contact-btns {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.pcod-wa-btn,
.pcod-msg-btn,
.pcod-phone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 11px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.pcod-wa-btn {
    background: #25D366;
}

.pcod-wa-btn:hover {
    background: #1fb855;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.pcod-msg-btn {
    background: #0084FF;
}

.pcod-msg-btn:hover {
    background: #006fdb;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 132, 255, 0.35);
}

.pcod-wa-btn svg,
.pcod-msg-btn svg,
.pcod-phone-btn svg {
    flex-shrink: 0;
}

.pcod-phone-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    background: #199f4b;
    transition: all 0.2s ease;
}

.pcod-phone-btn:hover {
    background: #148a3f;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 159, 75, 0.35);
}


/* ============================================
   Popup Overlay & Modal
   ============================================ */
.pcod-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 999998;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.pcod-overlay.active {
    display: block;
    opacity: 1;
}

.pcod-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    width: 94%;
    max-width: 540px;
    max-height: 90vh;
    background: #fff;
    border-radius: 14px;
    z-index: 999999;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.04);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.pcod-popup.active {
    display: block;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.pcod-popup-close {
    position: absolute;
    top: 12px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 300;
    color: #666;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.pcod-popup-close:hover {
    background: #e0e0e0;
    color: #333;
}

/* ---- Popup Header ---- */
.pcod-popup-header {
    padding: 24px 28px 16px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #f8fdf9 0%, #fff 100%);
    border-radius: 14px 14px 0 0;
}

.pcod-popup-header h2 {
    margin: 0 0 2px;
    font-size: 22px;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.3;
}

.pcod-popup-header p {
    margin: 0;
    font-size: 15px;
    color: #555;
    font-weight: 500;
}

/* ---- Popup Body ---- */
.pcod-popup-body {
    padding: 20px 28px 28px;
}

/* Form Fields */
.pcod-form-section {
    margin-bottom: 20px;
}

.pcod-field {
    margin-bottom: 14px;
}

.pcod-field label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.pcod-field label .required {
    color: #e53e3e;
}

.pcod-input-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
}

.pcod-input-wrap:focus-within {
    border-color: var(--pcod-btn-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.12);
}

.pcod-input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 44px;
    color: #888;
    background: #f9f9f9;
    border-right: 1px solid #eee;
}

.pcod-input-wrap input {
    flex: 1;
    border: none;
    padding: 11px 14px;
    font-size: 15px;
    outline: none;
    background: transparent;
    color: #333;
    width: 100%;
    box-shadow: none;
}

.pcod-input-wrap input::placeholder {
    color: #aaa;
}

.pcod-input-wrap input:focus {
    outline: none;
    box-shadow: none;
}

/* Shipping Options */
.pcod-shipping-section {
    margin-bottom: 20px;
}

.pcod-shipping-section h3 {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 700;
    color: #333;
}

.pcod-shipping-options {
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    padding: 12px 16px;
    background: #fafafa;
}

.pcod-radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    font-size: 14px;
    color: #444;
    cursor: pointer;
    transition: color 0.2s;
}

.pcod-radio-label:hover {
    color: #222;
}

.pcod-radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--pcod-btn-color);
    cursor: pointer;
    margin: 0;
}

/* Summary Table */
.pcod-summary-section {
    margin-bottom: 20px;
}

.pcod-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-bottom: 14px;
}

.pcod-summary-table thead th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 700;
    color: #555;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pcod-summary-table tbody td {
    padding: 10px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    color: #333;
}

.pcod-product-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pcod-product-cell img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}

.pcod-product-cell span {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
}

.pcod-qty-input {
    width: 56px;
    padding: 6px 4px;
    text-align: center;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s;
}

.pcod-qty-input:focus {
    border-color: var(--pcod-btn-color);
    box-shadow: none;
    outline: none;
}

/* Totals */
.pcod-totals {
    border: 1.5px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
}

.pcod-total-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 16px;
    font-size: 14px;
    color: #555;
    border-bottom: 1px solid #eee;
}

.pcod-total-row:last-child {
    border-bottom: none;
}

.pcod-grand-total {
    background: #f0fdf4;
    font-weight: 800;
    font-size: 16px;
    color: #16a34a;
    padding: 12px 16px;
}

/* Submit Button — !important needed to override Elementor global button styles */
.pcod-submit-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px;
    width: 100%;
    padding: 15px 20px !important;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #fff !important;
    background: var(--pcod-btn-color) !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(40, 167, 69, 0.3);
    letter-spacing: 0.3px;
}

.pcod-submit-btn:hover {
    background: var(--pcod-btn-hover) !important;
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.pcod-submit-btn:active {
    transform: translateY(0);
}

.pcod-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading State */
.pcod-loading {
    text-align: center;
    padding: 50px 20px;
}

.pcod-spinner {
    width: 42px;
    height: 42px;
    border: 4px solid #e8e8e8;
    border-top-color: var(--pcod-btn-color);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: pcod-spin 0.8s linear infinite;
}

@keyframes pcod-spin {
    to { transform: rotate(360deg); }
}

.pcod-loading p {
    font-size: 15px;
    color: #666;
    font-weight: 500;
}

/* Success State */
.pcod-success {
    text-align: center;
    padding: 40px 28px;
}

.pcod-success-icon {
    margin-bottom: 16px;
    animation: pcod-checkmark 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pcod-checkmark {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.pcod-success h3 {
    margin: 0 0 10px;
    font-size: 22px;
    font-weight: 800;
    color: #28a745;
}

.pcod-success-msg {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 24px;
}

.pcod-close-success-btn {
    padding: 12px 40px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--pcod-btn-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.pcod-close-success-btn:hover {
    background: var(--pcod-btn-hover);
}

/* Error state for inputs */
.pcod-input-wrap.pcod-error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.12);
}

.pcod-field-error {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 600px) {
    .pcod-popup {
        width: 96%;
        max-height: 92vh;
        border-radius: 12px;
    }

    .pcod-popup-header {
        padding: 20px 18px 14px;
    }

    .pcod-popup-header h2 {
        font-size: 19px;
    }

    .pcod-popup-body {
        padding: 16px 18px 22px;
    }

    .pcod-contact-btns {
        flex-direction: row;
    }

    .pcod-summary-table {
        font-size: 12px;
    }

    .pcod-product-cell img {
        width: 40px;
        height: 40px;
    }

    .pcod-submit-btn {
        font-size: 15px;
        padding: 13px 16px;
    }

    .pcod-cod-btn {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* ---- Prevent body scroll when popup open ---- */
body.pcod-popup-open {
    overflow: hidden;
}

/* ============================================
   Checkout Page Override Styles
   ============================================ */
.pcod-checkout-wrap {
    max-width: 680px;
    margin: 0 auto 40px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0,0,0,0.04);
    overflow: hidden;
}

.pcod-checkout-header {
    padding: 28px 32px 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    background: linear-gradient(180deg, #f8fdf9 0%, #fff 100%);
}

.pcod-checkout-header h2 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 800;
    color: #1a1a1a;
    line-height: 1.3;
}

.pcod-checkout-header p {
    margin: 0;
    font-size: 15px;
    color: #555;
    font-weight: 500;
}

.pcod-checkout-body {
    padding: 24px 32px 32px;
}

/* Reuse existing form/shipping/summary/button styles inside checkout wrap */
.pcod-checkout-wrap .pcod-form-section,
.pcod-checkout-wrap .pcod-shipping-section,
.pcod-checkout-wrap .pcod-summary-section,
.pcod-checkout-wrap .pcod-submit-btn,
.pcod-checkout-wrap .pcod-loading,
.pcod-checkout-wrap .pcod-success {
    /* Inherits all existing popup styles */
}

/* WooCommerce Notices on Checkout Page */
.woocommerce-notices-wrapper .woocommerce-message {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-left: 5px solid var(--pcod-btn-color, #28a745);
    border-radius: 10px;
    padding: 16px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #166534;
    box-shadow: 0 2px 12px rgba(40, 167, 69, 0.12);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

.woocommerce-notices-wrapper .woocommerce-message::before {
    content: "\2713";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    min-width: 28px;
    height: 28px;
    background: var(--pcod-btn-color, #28a745);
    color: #fff;
    border-radius: 50%;
    font-size: 15px;
    font-weight: 700;
    margin-right: 4px;
}

.woocommerce-notices-wrapper .woocommerce-message .button {
    background: var(--pcod-btn-color, #28a745);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.woocommerce-notices-wrapper .woocommerce-message .button:hover {
    background: var(--pcod-btn-hover, #218838);
    transform: translateY(-1px);
    color: #fff;
}

.woocommerce-notices-wrapper .woocommerce-error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1.5px solid #fca5a5;
    border-left: 5px solid #ef4444;
    border-radius: 10px;
    padding: 16px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #991b1b;
    box-shadow: 0 2px 12px rgba(239, 68, 68, 0.1);
    margin-bottom: 24px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.woocommerce-notices-wrapper .woocommerce-info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1.5px solid #93c5fd;
    border-left: 5px solid #3b82f6;
    border-radius: 10px;
    padding: 16px 22px;
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.1);
    margin-bottom: 24px;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 600px) {
    .woocommerce-notices-wrapper .woocommerce-message {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 16px;
        font-size: 13px;
    }

    .woocommerce-notices-wrapper .woocommerce-message .button {
        align-self: flex-end;
    }
}

/* Checkout success - add order ID style */
.pcod-checkout-order-id {
    font-size: 14px;
    color: #777;
    margin-top: 6px;
    font-weight: 600;
}

@media (max-width: 600px) {
    .pcod-checkout-wrap {
        margin: 0 auto 20px;
        border-radius: 10px;
    }

    .pcod-checkout-header {
        padding: 20px 18px 16px;
    }

    .pcod-checkout-header h2 {
        font-size: 20px;
    }

    .pcod-checkout-body {
        padding: 16px 18px 24px;
    }
}
