/**
 * DN Vietnam Address - Checkout Styles
 * Force Layout using CSS Grid - Refined Spacing & Merged Input Group
 * Version 1.6.4
 */

/* Hide WooCommerce coupon success/error notices at top of checkout */
/* Requirement #8: Prevent viewport jumping to top notices */
/* NOTE: Do NOT hide .woocommerce-NoticeGroup-checkout - that shows validation errors! */
.woocommerce-checkout .woocommerce-message,
.woocommerce-checkout .woocommerce-info:not(.woocommerce-NoticeGroup-checkout .woocommerce-info),
.woocommerce-checkout .woocommerce-notices-wrapper:not(:has(.woocommerce-error)) .woocommerce-message,
.woocommerce-checkout .woocommerce-notices-wrapper:not(:has(.woocommerce-error)) .woocommerce-info,
.woocommerce-notices-wrapper:empty,
.woocommerce-form-coupon-toggle,
form.checkout_coupon {
    display: none !important;
}

/* Exception for vital notices - REMOVED: Replaced by Server-Side Toast Fragments */

/* ========================================
   FIXED TOAST NOTIFICATION - Checkout Errors
   White background, red border, positioned RIGHT of content area
   ======================================== */
.woocommerce-checkout .woocommerce-NoticeGroup,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout {
    position: fixed !important;
    top: 160px !important;
    /* Below fixed header + admin bar */
    left: auto !important;
    right: 30px !important;
    /* 30px from right edge */
    transform: none !important;
    width: auto !important;
    max-width: 450px !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #d32f2f !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08) !important;
    overflow: visible !important;
    /* Allow close button to overflow outside */
    animation: dn-slideDown 0.3s ease !important;
}

/* Responsive - adjust on smaller screens */
@media (max-width: 768px) {

    .woocommerce-checkout .woocommerce-NoticeGroup,
    .woocommerce-checkout .woocommerce-NoticeGroup-checkout {
        left: 25px !important;
        /* Extra space for X button */
        right: 15px !important;
        max-width: calc(100% - 50px) !important;
        /* Narrower on mobile */
        top: 120px !important;
        /* Adjust for mobile header */
    }

    /* Smaller X button on mobile */
    .woocommerce-checkout .woocommerce-NoticeGroup .dn-notice-close,
    .woocommerce-checkout .woocommerce-NoticeGroup-checkout .dn-notice-close {
        top: -8px !important;
        left: -8px !important;
        width: 22px !important;
        height: 22px !important;
        font-size: 14px !important;
    }
}

/* Toast animation */
@keyframes dn-slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Style the error list inside toast - keep WooCommerce default icon */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error {
    background: #fff !important;
    color: #333 !important;
    padding: 15px 20px 15px 50px !important;
    /* Extra left padding for icon */
    margin: 0 !important;
    border: none !important;
    border-radius: 8px !important;
    /* Match parent border-radius */
    font-size: 14px !important;
    line-height: 1.6 !important;
    position: relative !important;
}

/* Force ALL text inside notification to be dark - override any white text */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error,
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error *,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error * {
    color: #333 !important;
}

/* Error items - dark text color */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error li,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li {
    color: #333 !important;
    margin-bottom: 6px !important;
    display: block !important;
    text-align: left !important;
    padding-right: 0 !important;
}

/* Ensure strong/bold text is also dark */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error strong,
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error b,
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error a,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error strong,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error b,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error a {
    color: #333 !important;
}

.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error li:last-child,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error li:last-child {
    margin-bottom: 0 !important;
}

/* Fix text alignment - ensure it's not centered or messy */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error {
    text-align: left !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    display: block !important;
    width: 100% !important;
    flex-wrap: nowrap !important;
    float: none !important;
    position: relative !important;
    /* Ensure relative for absolute positioning if needed */
}

/* Ensure the text content takes full width */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error li {
    width: 100% !important;
    display: block !important;
    margin-bottom: 5px !important;
}

/* HIDE DEFAULT CLOSE BUTTON (The one on the right) */
/* This removes the duplicate X icon */
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error .close,
.woocommerce-checkout .woocommerce-NoticeGroup .woocommerce-error::after,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error .close,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .woocommerce-error::after {
    display: none !important;
    content: none !important;
}

/* Disable WooCommerce auto-scroll to notices */
html:has(.woocommerce-checkout) {
    scroll-behavior: auto !important;
}

/* Hide inline validation messages under fields - popup already shows errors */
/* These classes are from theme/WooCommerce - we only hide via CSS */
.woocommerce-checkout .checkout-inline-error-message,
.woocommerce-checkout .form-row.woocommerce-invalid .woocommerce-invalid-required-field {
    display: none !important;
}

/* Keep red border on invalid fields as visual indicator */
.woocommerce-checkout .form-row.woocommerce-invalid .select2-selection,
.woocommerce-checkout .form-row.woocommerce-invalid input,
.woocommerce-checkout .form-row.woocommerce-invalid select {
    border-color: #d32f2f !important;
}

/* Close button for notification popup - positioned top-left, outside popup */
.woocommerce-checkout .woocommerce-NoticeGroup .dn-notice-close,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .dn-notice-close {
    position: absolute !important;
    top: -10px !important;
    left: -10px !important;
    width: 24px !important;
    height: 24px !important;
    background: #fff !important;
    border: 1px solid #ddd !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: 300 !important;
    /* Thinner stroke */
    color: #888 !important;
    line-height: 1 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.2s ease !important;
    z-index: 10000 !important;
}

.woocommerce-checkout .woocommerce-NoticeGroup .dn-notice-close:hover,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout .dn-notice-close:hover {
    background: #f5f5f5 !important;
    color: #333 !important;
    border-color: #bbb !important;
}

/* Fade out animation for auto-hide */
@keyframes dn-fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.woocommerce-checkout .woocommerce-NoticeGroup.dn-hiding,
.woocommerce-checkout .woocommerce-NoticeGroup-checkout.dn-hiding {
    animation: dn-fadeOut 0.3s ease forwards !important;
}




/* ========================================
   GRID LAYOUT CONTAINER (Nuclear Specificity)
   ======================================== */
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper {
    display: grid !important;
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 15px !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ========================================
   OVERRIDE INLINE STYLES & THEME CSS
   ======================================== */

body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row,
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper p.form-row,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper p.form-row {
    width: auto !important;
    float: none !important;
    margin: 0 !important;
    display: block !important;
    flex: none !important;
    min-width: 0 !important;
}

/* Ensure inputs fill the grid cell */
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row input.input-text,
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row select,
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row .select2-container,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row input.input-text,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row select,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row .select2-container {
    width: 100% !important;
}

/* ========================================
   FIELD PLACEMENTS (High Specificity)
   ======================================== */

/* Fix Name Field Internal Layout (Merged Prefix + Input) */
body.woocommerce-checkout #billing_full_name_field .woocommerce-input-wrapper,
body.woocommerce-checkout #shipping_first_name_field .woocommerce-input-wrapper {
    display: flex !important;
    gap: 0 !important;
    width: 100% !important;
    /* No gap for merged look */
}

/* Prefix Select Styling - Fixed width */
body.woocommerce-checkout #billing_full_name_field select.dn-vn-name-prefix,
body.woocommerce-checkout #billing_full_name_field .select2-container {
    flex: 0 0 110px !important;
    width: 110px !important;
    min-width: 110px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: 0 !important;
}

/* Fix Select2 container box specifically */
body.woocommerce-checkout #billing_full_name_field .select2-container .select2-selection {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: 0 !important;
}

/* Input Key Styling - Flexible width */
body.woocommerce-checkout #billing_full_name_field input.input-text,
body.woocommerce-checkout #shipping_first_name_field input.input-text {
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

/* Name & Phone (3/6 = 50%) */
body.woocommerce-checkout #billing_full_name_field,
body.woocommerce-checkout #billing_phone_field,
body.woocommerce-checkout #shipping_first_name_field,
body.woocommerce-checkout #shipping_phone_field {
    grid-column: span 3 !important;
}

/* Fallback if First/Last Name used */
body.woocommerce-checkout #billing_first_name_field,
body.woocommerce-checkout #billing_last_name_field {
    grid-column: span 3 !important;
}

/* Full Width Fields (6/6) */
body.woocommerce-checkout #billing_company_field,
body.woocommerce-checkout #billing_country_field,
body.woocommerce-checkout #billing_address_1_field,
body.woocommerce-checkout #billing_address_2_field,
body.woocommerce-checkout #billing_email_field,
body.woocommerce-checkout #billing_city_field,
body.woocommerce-checkout #billing_state_field,
body.woocommerce-checkout #billing_postcode_field,
body.woocommerce-checkout #billing_address_search_field,
body.woocommerce-checkout #billing_note_field,
body.woocommerce-checkout #shipping_company_field,
body.woocommerce-checkout #shipping_country_field,
body.woocommerce-checkout #shipping_address_1_field,
body.woocommerce-checkout #shipping_address_2_field,
body.woocommerce-checkout #shipping_city_field,
body.woocommerce-checkout #shipping_state_field,
body.woocommerce-checkout #shipping_postcode_field,
body.woocommerce-checkout #shipping_address_search_field {
    grid-column: span 6 !important;
}

/* ========================================
   VIETNAM ADDRESS FIELDS
   ======================================== */

/* Default: Province (3/6) - District (3/6) */
body.woocommerce-checkout #billing_vn_province_field,
body.woocommerce-checkout #billing_vn_district_field,
body.woocommerce-checkout #shipping_vn_province_field,
body.woocommerce-checkout #shipping_vn_district_field {
    grid-column: span 3 !important;
}

/* Ward - Hidden by default */
body.woocommerce-checkout #billing_vn_ward_field,
body.woocommerce-checkout #shipping_vn_ward_field {
    display: none !important;
    grid-column: span 6 !important;
}

/* Ward - Visible */
body.woocommerce-checkout #billing_vn_ward_field.visible,
body.woocommerce-checkout #shipping_vn_ward_field.visible {
    display: block !important;
}

/* ========================================
   3-COLUMN MODE (When Ward is visible)
   ======================================== */

/* Province (2/6) - District (2/6) - Ward (2/6) */
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_province_field,
body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_district_field,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_province_field,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_district_field {
    grid-column: span 2 !important;
}

body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_ward_field.visible,
body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_ward_field.visible {
    grid-column: span 2 !important;
    display: block !important;
}

/* ========================================
   HIDE UNUSED BILLING FIELDS COMPLETELY
   These fields are hidden but still take up space
   ======================================== */
body.woocommerce-checkout #billing_address_1_field,
body.woocommerce-checkout #billing_address_2_field,
body.woocommerce-checkout #billing_city_field,
body.woocommerce-checkout #billing_state_field,
body.woocommerce-checkout #billing_country_field,
body.woocommerce-checkout #billing_postcode_field,
body.woocommerce-checkout #billing_gender_prefix_field,
body.woocommerce-checkout #billing_province_code_field,
body.woocommerce-checkout #billing_district_code_field,
body.woocommerce-checkout #billing_ward_code_field {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
}

/* Hide Jet Listing Grid elements that are visibility:hidden */
.woocommerce-checkout .jet-listing-grid[style*="visibility: hidden"],
.woocommerce-checkout .jet-listing-grid:empty {
    display: none !important;
}


/* ========================================
   RESPONSIVE
   ======================================== */

/* Tablet/Mobile (<= 1024px): Stack Name, Phone, and Address Fields */
@media (max-width: 1024px) {

    /* Stack Name & Phone */
    body.woocommerce-checkout #billing_full_name_field,
    body.woocommerce-checkout #billing_phone_field,
    body.woocommerce-checkout #shipping_first_name_field,
    body.woocommerce-checkout #shipping_phone_field {
        grid-column: span 6 !important;
    }

    /* Stack Address Fields */
    body.woocommerce-checkout #billing_vn_province_field,
    body.woocommerce-checkout #billing_vn_district_field,
    body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_province_field,
    body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_district_field,
    body.woocommerce-checkout .woocommerce-billing-fields__field-wrapper.dn-3-cols #billing_vn_ward_field.visible,
    body.woocommerce-checkout #shipping_vn_province_field,
    body.woocommerce-checkout #shipping_vn_district_field,
    body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_province_field,
    body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_district_field,
    body.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper.dn-3-cols #shipping_vn_ward_field.visible {
        grid-column: span 6 !important;
    }
}

/* ========================================
   SELECT2 SELECTION BOX - MATCH THEME INPUT
   Uses theme CSS variables for consistency
   ======================================== */

/* Selection Box - Match theme input using CSS variables */
body.woocommerce-checkout .select2-container--default .select2-selection--single {
    height: var(--theme-button-min-height, 40px) !important;
    border: 1px solid var(--theme-form-field-border-initial-color, #dadada) !important;
    border-radius: 3px !important;
    background-color: transparent !important;
    padding: 0 15px !important;
    display: flex !important;
    align-items: center !important;
    font-family: var(--theme-font-family, inherit) !important;
}

/* Selection text - Match theme font */
body.woocommerce-checkout .select2-container--default .select2-selection__rendered {
    line-height: calc(var(--theme-button-min-height, 40px) - 2px) !important;
    font-size: inherit !important;
    color: inherit !important;
    padding-left: 0 !important;
    padding-right: 30px !important;
    font-family: inherit !important;
}

/* Arrow positioning */
body.woocommerce-checkout .select2-container--default .select2-selection__arrow {
    height: calc(var(--theme-button-min-height, 40px) - 2px) !important;
    right: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Hide default Select2 arrow */
body.woocommerce-checkout .select2-container--default .select2-selection__arrow b {
    display: none !important;
}

/* Custom SVG arrow for Select2 - matching right column dropdown */
body.woocommerce-checkout .select2-container--default .select2-selection__arrow::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 6px;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    transition: transform 0.2s ease;
}

/* Rotate arrow when dropdown is open */
body.woocommerce-checkout .select2-container--default.select2-container--open .select2-selection__arrow::after {
    transform: rotate(180deg);
}

/* Loading state for Select2 - spinner on arrow */
body.woocommerce-checkout .select2-container--default.select2-loading .select2-selection__arrow::after {
    width: 12px;
    height: 12px;
    background-image: none;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: dn-spin 0.6s linear infinite;
}

/* Placeholder text color */
body.woocommerce-checkout .select2-container--default .select2-selection__placeholder {
    color: var(--theme-form-field-text-initial-color, #999) !important;
}

/* ========================================
   DROPDOWN HEIGHT LIMIT & PREMIUM STYLING
   ======================================== */
.select2-results__options {
    max-height: 250px !important;
    overflow-y: auto !important;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

/* ========================================
   DROPDOWN PREMIUM STYLING (High Specificity Overrides)
   ======================================== */

/* Dropdown Container - Using theme variables */
body.woocommerce-checkout .select2-container--default .select2-dropdown {
    border: 1px solid var(--theme-form-field-border-initial-color, #dadada) !important;
    border-radius: 3px !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.1) !important;
    padding: 6px !important;
    background-color: #fff !important;
    overflow: hidden !important;
    margin-top: 3px !important;
    z-index: 99999 !important;
}

/* Scrollbar styling */
body.woocommerce-checkout .select2-results__options::-webkit-scrollbar {
    width: 6px !important;
}

body.woocommerce-checkout .select2-results__options::-webkit-scrollbar-track {
    background: transparent !important;
}

body.woocommerce-checkout .select2-results__options::-webkit-scrollbar-thumb {
    background-color: #ccc !important;
    border-radius: 10px !important;
    border: 2px solid transparent !important;
    background-clip: content-box !important;
}

/* Options List Container */
body.woocommerce-checkout .select2-container--default .select2-results__options {
    padding: 6px !important;
    max-height: 250px !important;
}

/* Individual Option Item - DEFAULT: transparent background */
body.woocommerce-checkout .select2-container--default .select2-results__option {
    padding: 10px 14px !important;
    margin-bottom: 2px !important;
    font-size: 14px !important;
    color: #333 !important;
    border-radius: 3px !important;
    transition: all 0.1s ease !important;
    display: flex !important;
    align-items: center !important;
    font-weight: 400 !important;
    position: relative !important;
    background-color: transparent !important;
}

/* ========================================
   DROPDOWN OPTION STATES - USING .dn-selected CLASS
   ======================================== */

/* 1. HOVER on items: Grey background only */
body.woocommerce-checkout .select2-container--default .select2-results__option--highlighted {
    background-color: #f7f7f7 !important;
    color: #000 !important;
}

/* 2. TRULY SELECTED item (.dn-selected): Grey background + checkmark */
body.woocommerce-checkout .select2-container--default .select2-results__option.dn-selected {
    background-color: #f7f7f7 !important;
    color: #000 !important;
    font-weight: 400 !important;
}

/* 3. CHECKMARK for truly selected item only */
body.woocommerce-checkout .select2-container--default .select2-results__option.dn-selected::before {
    content: "" !important;
    display: inline-block !important;
    width: 5px !important;
    height: 10px !important;
    border: solid #000 !important;
    border-width: 0 2px 2px 0 !important;
    transform: rotate(45deg) !important;
    margin-right: 10px !important;
    flex-shrink: 0 !important;
}

/* 4. NO checkmark on non-selected items (all others) */
body.woocommerce-checkout .select2-container--default .select2-results__option:not(.dn-selected)::before {
    display: none !important;
    content: none !important;
}

/* 5. Hide any default pseudo elements */
body.woocommerce-checkout .select2-container--default .select2-results__option::after {
    display: none !important;
}

/* Search Box Container */
body.woocommerce-checkout .select2-container--default .select2-search--dropdown {
    padding: 10px !important;
}

/* Search Input Field */
body.woocommerce-checkout .select2-container--default .select2-search--dropdown .select2-search__field {
    border-radius: 3px !important;
    border: 1px solid #e5e7eb !important;
    padding: 6px 16px !important;
    outline: none !important;
    box-shadow: none !important;
    font-size: 14px !important;
}

/* ========================================
   VAT INVOICE SECTION
   ======================================== */

.dn-vat-checkbox-row {
    margin-bottom: 20px !important;
    font-size: 100%;
    /* Ensure h3 doesn't blow up font size if theme sets it high */
    /* Remove display: flex if h3 is block, but we want label inline-flex.
       Theme h3 usually block. Inside label is usually flex.
       So we keep margin, remove flex on h3 itself if it was there.
       Previous CSS had .dn-vat-checkbox-row { margin-bottom... }
       We keep that.
    */
}

/* Remove custom label styles to inherit theme defaults */

.dn-vat-label {
    margin-right: 5px;
}

/* Tooltip Styles */
.dn-vat-tooltip {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: help;
    margin-left: 5px;
    position: relative;
    color: #6b7280;
    font-size: 14px;
    /* Ensure icon size matches text roughly */
    font-weight: normal;
    /* Don't be bold like h3 */
}

/* ... tooltip box styles ... */
/* (Keeping existing tooltip box styles, assuming valid) */

/* Tooltip Box */
.dn-vat-tooltip:hover::after {
    content: attr(data-title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #333;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    font-size: 12px;
    white-space: pre-wrap;
    width: max-content;
    max-width: 250px;
    z-index: 9999;
    margin-bottom: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-weight: normal;
    text-transform: none;
    line-height: 1.4;
    text-align: center;
}

/* Tooltip Arrow */
.dn-vat-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #fff;
    /* White arrow */
    margin-bottom: -4px;
    z-index: 10000;
    /* Above the box border */
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
    /* Subtle shadow */
}

.dn-vat-fields {
    background: #f7f7f7;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

/* Ensure inputs inside VAT section are white */
.dn-vat-fields input.input-text {
    background-color: #fff !important;
}

.dn-vat-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.dn-vat-fields-grid p.form-row {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    float: none !important;
}

.dn-vat-important-notes {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
}

.dn-vat-important-notes strong {
    display: block;
    margin-bottom: 5px;
    color: #111827;
}



/* VAT Responsive */
@media (max-width: 768px) {
    .dn-vat-fields-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   PAYMENT METHODS SECTION (Coolmate Style)
   ======================================== */
.dn-payment-methods-section {
    margin-top: 30px;
    margin-bottom: 20px;
}

.dn-payment-methods-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #111;
}

.dn-payment-methods-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dn-payment-method-item {
    border: 1px solid #00000012;
    border-radius: 3px;
    background: #fff;
    padding: 15px 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dn-payment-method-item.selected {
    background: #f9fafb;
}

.dn-payment-method-label {
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    margin: 0;
    font-weight: normal;
}

/* Radio Button - Custom styling to match voucher radios */
.dn-payment-method-radio {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
}

.dn-payment-method-radio:checked {
    border-color: #105151;
    background: #fff;
}

.dn-payment-method-radio:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #105151;
    border-radius: 50%;
}

.dn-payment-method-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.dn-payment-method-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dn-payment-method-icon img {
    max-width: 50px;
    max-height: 35px;
    object-fit: contain;
}

.dn-payment-method-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dn-payment-method-title {
    font-size: 15px;
    font-weight: 500;
    color: #111;
}

.dn-payment-method-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

/* Hide description if too long */
.dn-payment-method-desc p {
    margin: 0;
}

/* Hide original WooCommerce payment methods in order review */
#payment .wc_payment_methods,
.woocommerce-checkout #payment .wc_payment_methods,
body.woocommerce-checkout #payment .wc_payment_methods,
#order_review #payment .wc_payment_methods,
.woocommerce-checkout-review-order #payment ul.wc_payment_methods {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Also hide payment method descriptions that may appear */
#payment .payment_methods,
#payment .payment_box {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .dn-payment-method-item {
        padding: 12px 15px;
    }

    .dn-payment-method-content {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .dn-payment-method-icon img {
        max-width: 40px;
        max-height: 28px;
    }
}

/* ========================================
   ORDER SUMMARY (Coolmate Style)
   ======================================== */

.dn-order-summary {
    background: #fff;
    border-radius: 8px;
}

/* Cart Items Section */
.dn-cart-items-section {
    margin-bottom: 20px;
}

.dn-cart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
}

.dn-cart-title {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    color: #111;
}

.dn-cart-clear-all {
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
}

.dn-cart-clear-all:hover {
    color: #ef4444;
    text-decoration: underline;
}

/* Cart Item */
.dn-cart-items-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.dn-cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 12px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    align-items: center;
}

/* Product image inside ct-media-container uses theme styling */
/* Border-radius added manually since layout uses div instead of table.shop_table */
.dn-cart-item .ct-media-container {
    width: 80px !important;
    min-width: 80px !important;
    height: auto !important;
    aspect-ratio: 3/4 !important;
    border-radius: var(--theme-border-radius, 3px);
    overflow: hidden;
    margin: 0 !important;
    display: block !important;
}


.dn-cart-item .ct-media-container img {
    width: 100% !important;
    height: auto !important;
    object-fit: cover;
}




.dn-cart-item-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    padding-right: 10px;
}

.dn-cart-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #111;
    line-height: 1.2;
}

.dn-cart-item-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.dn-cart-item-title a:hover {
    color: #105151;
    text-decoration: underline;
}

/* Variant text display like "Be VÃ ng / M" */
.dn-cart-item-variant-text {
    font-size: 12px;
    color: #6b7280;
}


.dn-cart-item-variants {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    align-items: center;
}

/* ========================================
   VARIANT SELECT - UNIFIED STYLING
   High specificity with body.woocommerce-checkout
   ======================================== */

/* Native select - MUST match Select2 exactly to prevent FOUC */
body.woocommerce-checkout .dn-variant-select {
    padding: 4px 28px 4px 10px !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 3px !important;
    font-size: 13px !important;
    font-family: inherit !important;
    line-height: 1.4 !important;
    min-height: 26px !important;
    height: auto !important;
    background-color: #f5f5f5 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 12px !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    color: #282828 !important;
    outline: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}


/* Select2 Container - auto width */
body.woocommerce-checkout .dn-cart-item-variants .select2-container {
    min-width: auto !important;
    width: auto !important;
}

/* Select2 Selection box - SAME as native select */
body.woocommerce-checkout .dn-cart-item-variants .select2-container--default .select2-selection--single {
    background-color: #f5f5f5 !important;
    border: 1px solid #e0e0e0 !important;
    border-radius: 3px !important;
    height: auto !important;
    min-height: unset !important;
    padding: 4px 28px 4px 10px !important;
    cursor: pointer !important;
    position: relative !important;
}


/* Select2 text inside */
body.woocommerce-checkout .dn-cart-item-variants .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #333 !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    padding: 0 !important;
    padding-left: 0 !important;
}


/* Select2 Arrow */
body.woocommerce-checkout .dn-cart-item-variants .select2-container--default .select2-selection__arrow {
    top: 0 !important;
    right: 8px !important;
    bottom: 0 !important;
    height: 100% !important;
    width: 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
}


body.woocommerce-checkout .dn-cart-item-variants .select2-container--default .select2-selection__arrow b {
    border-color: #666 transparent transparent transparent !important;
    border-width: 4px 3px 0 3px !important;
    border-style: solid !important;
    margin: 0 !important;
    position: static !important;
    top: auto !important;
    left: auto !important;
}


/* Arrow rotation when open */
body.woocommerce-checkout .dn-cart-item-variants .select2-container--default.select2-container--open .select2-selection__arrow b {
    border-color: transparent transparent #666 transparent !important;
    border-width: 0 3px 4px 3px !important;
}

/* ========================================
   VARIANT DROPDOWN - COMPACT STYLING
   High specificity to override address dropdown styles
   ======================================== */

/* Dropdown container - override body.woocommerce-checkout styles */
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown.select2-dropdown {
    border: 1px solid #e0e0e0 !important;
    border-radius: 4px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    padding: 0 !important;
    background-color: #fff !important;
    margin-top: 2px !important;
    overflow: hidden !important;
}

/* Options list */
body.woocommerce-checkout .dn-variant-dropdown .select2-results,
body.woocommerce-checkout .dn-variant-dropdown .select2-results__options {
    max-height: none !important;
    overflow: visible !important;
    margin: 0 !important;
}

/* Individual option */
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown .select2-results__option {
    padding: 6px 10px !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    color: #333 !important;
    border-radius: 3px !important;
    margin: 0 !important;
    cursor: pointer !important;
    background: transparent !important;
    display: block !important;
}

/* Remove the checkmark from address dropdown */
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown .select2-results__option::before {
    display: none !important;
    content: none !important;
}

/* Hover state */
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown .select2-results__option--highlighted,
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown .select2-results__option:hover {
    background-color: #f5f5f5 !important;
    color: #000 !important;
}

/* Selected state */
body.woocommerce-checkout .select2-container--default .dn-variant-dropdown .select2-results__option[aria-selected="true"] {
    background-color: #eee !important;
    font-weight: 500 !important;
}






.dn-cart-item-remove {
    display: inline-flex;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
    margin-top: 4px;
    width: fit-content;
}

.dn-cart-item-remove svg {
    flex-shrink: 0;
}

.dn-cart-item-remove:hover {
    color: #ef4444;
}

/* Qty and Price container */
.dn-cart-item-qty-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    text-align: right;
}

/* Let Blocksy theme's .quantity styles apply naturally but override size to match checkout compact style */
.dn-cart-item .quantity {
    margin: 0;
    max-width: 80px;
    /* Reference site width */
    --quantity-height: 36px;
    /* Critical override for theme positioning calculation */
}

/* Force height and font adjustments for checkout context */
body.woocommerce-checkout .dn-cart-item .quantity {
    height: 30px !important;
    min-height: 30px !important;
}

body.woocommerce-checkout .dn-cart-item .quantity input.qty {
    height: 30px !important;
    font-size: 13px !important;
    border: 1px solid #c8c8c8 !important;
}

/* Fix quantity button vertical centering - high specificity */
body.woocommerce-checkout .dn-cart-item .quantity .ct-decrease,
body.woocommerce-checkout .dn-cart-item .quantity .ct-increase {
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin-top: 0 !important;
}

/* Fix icon margin that causes vertical offset */
body.woocommerce-checkout .dn-cart-item .quantity .ct-decrease::before,
body.woocommerce-checkout .dn-cart-item .quantity .ct-decrease::after,
body.woocommerce-checkout .dn-cart-item .quantity .ct-increase::before,
body.woocommerce-checkout .dn-cart-item .quantity .ct-increase::after {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Price */
.dn-cart-item-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.dn-price-current {
    font-size: 15px;
    color: #111;
}

.dn-price-original {
    font-size: 13px;
    color: #9ca3af;
    text-decoration: line-through;
}

/* Urgency Message */
.dn-urgency-message {
    padding: 12px 15px;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 13px;
    color: #92400e;
    margin-bottom: 20px;
}

/* Voucher Carousel Section */
.dn-voucher-section {
    margin-bottom: 20px;
    overflow: hidden;
}

.dn-voucher-carousel {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 12px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 10px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    width: 100%;
}

.dn-voucher-carousel::-webkit-scrollbar {
    height: 6px;
}

.dn-voucher-carousel::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.dn-voucher-carousel::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 3px;
}

/* Coolmate-style Voucher Card */
.dn-voucher-carousel .dn-voucher-card {
    flex: 0 0 290px !important;
    min-width: 290px !important;
    max-width: 290px !important;
}

.dn-voucher-card {
    display: flex;
    align-items: center;
    /* Width handled by grid/carousel container */
    flex-grow: 1;
    border: none;
    border-radius: 8px;
    padding: 15px 20px 15px 40px;
    background: #f2f2f2;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Circle cutout on left (ticket effect) */
.dn-voucher-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 20px;
    height: 20px;
    background-color: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
}

/* Dashed divider line on left (Coolmate style) */
.dn-voucher-card::after {
    content: "";
    position: absolute;
    left: 25px;
    top: 10px;
    bottom: 10px;
    width: 0;
    border-left: 1px dashed #ccc;
    z-index: 2;
}

.dn-voucher-card.invalid {
    opacity: 0.6;
    cursor: not-allowed;
}

.dn-voucher-label {
    display: flex;
    gap: 12px;
    cursor: pointer;
    position: relative;
    z-index: 2;
    align-items: center;
    width: 100%;
}

/* Radio button styled with #105151 and aligned with title */
.dn-voucher-label input[type="radio"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #105151;
    cursor: pointer;
}

/* Custom radio appearance for better control */
.dn-voucher-label input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1px solid #ccc;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    position: relative;
}

.dn-voucher-label input[type="radio"]:checked {
    border-color: #105151;
    background: #fff;
}

.dn-voucher-label input[type="radio"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: #105151;
    border-radius: 50%;
}

.dn-voucher-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dn-voucher-code {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-bottom: 5px;
}

.dn-voucher-remaining {
    font-weight: normal;
    color: #6b7280;
    font-size: 12px;
}

.dn-voucher-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    margin-bottom: 5px;
}

.dn-voucher-expiry {
    font-size: 11px;
    color: #9ca3af;
}

/* Hide "Äiá»u kiá»‡n" link completely */
.dn-voucher-conditions {
    display: none !important;
}

.dn-voucher-conditions:hover {
    display: none !important;

}

.dn-voucher-invalid-msg {
    font-size: 11px;
    color: #ef4444;
    margin-top: 5px;
}

/* Coupon Input Section */
.dn-coupon-input-section {
    margin-bottom: 20px;
}

.dn-coupon-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

/* Input - let theme handle most styles, only set flex */
.dn-coupon-input {
    flex: 1;
    min-width: 0;
    font-weight: 500;
    text-transform: uppercase;
}

.dn-coupon-input:focus {
    outline: none;
}

/* Button - Hidden since coupons auto-apply on voucher click */
/* Kept in DOM for Enter key support, just hidden visually */
body.woocommerce-checkout #dn-apply-coupon-btn,
#dn-apply-coupon-btn,
.dn-apply-coupon-btn {
    display: none !important;
}

body.woocommerce-checkout #dn-apply-coupon-btn:hover,
#dn-apply-coupon-btn:hover,
.dn-apply-coupon-btn:hover {
    display: none !important;
}

.dn-coupon-message {
    margin-top: 8px;
    font-size: 13px;
}

.dn-coupon-message.success {
    color: #059669;
}

.dn-coupon-message.success strong {
    font-weight: 600;
}

.dn-coupon-message.error {
    color: #ef4444;
}

/* Remove coupon link (above input) */
.dn-coupon-remove-link {
    margin-bottom: 10px;
}

.dn-coupon-remove-link a {
    color: #333;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.dn-coupon-remove-link a:hover {
    text-decoration: underline;
}

.dn-coupon-remove-link a strong {
    font-weight: 600;
}



/* Payment Details Section */
.dn-payment-details-section {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.dn-payment-details-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #111;
}

.dn-payment-details-rows {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.dn-payment-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dn-payment-label {
    font-size: 14px;
    color: #4b5563;
}

.dn-payment-value {
    font-size: 14px;
    color: #111;
}

.dn-discount-value {
    color: #059669;
}

.dn-total-row {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
    margin-top: 5px;
}

.dn-total-row .dn-payment-label {
    font-size: 16px;
    font-weight: 600;
    color: #111;
}

.dn-total-row .dn-payment-value {
    font-size: 18px;
    font-weight: 700;
    color: #111;
}

.dn-savings-message {
    text-align: right;
    font-size: 13px;
    color: #ea580c;
}

/* Cart Empty */
.dn-cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
    font-size: 14px;
}

/* Order Summary Responsive */
@media (max-width: 768px) {
    .dn-cart-item {
        grid-template-columns: 60px 1fr;
        gap: 10px;
    }

    .dn-cart-item .ct-media-container {
        width: 60px !important;
        min-width: 60px !important;
        height: auto !important;
        aspect-ratio: 3/4 !important;
    }

    .dn-cart-item-qty-price {
        grid-column: 1 / -1;
        width: 100%;
        flex-direction: row !important;
        justify-content: space-between;
        align-items: center !important;
        margin-top: 10px;
    }

    .dn-cart-item-price {
        flex-direction: column;
        align-items: flex-end;
    }

    /* Input fix: Ensure it doesn't collapse */
    .dn-cart-item .quantity {
        flex-shrink: 0;
    }

    /* Remove Button Positioning */
    .dn-cart-item-details {
        position: relative !important;
        padding-right: 60px !important;
        /* Prevent overlap with absolute remove btn */
    }

    .dn-cart-item-remove {
        position: absolute !important;
        top: 0 !important;
        right: 0 !important;
        margin-top: 0 !important;
    }

    .dn-voucher-card {
        flex: 0 0 250px;
    }
}

/* Place Order Button Section */
.dn-place-order-section {
    margin-top: 20px;
}

/* Place order button - HIGH SPECIFICITY to override theme */
body.woocommerce-checkout #dn_place_order,
body.woocommerce-checkout .dn-place-order-btn,
#dn_place_order,
.dn-place-order-btn {
    width: 100% !important;
    height: 50px !important;
    padding: 16px 24px !important;
    border: none !important;
    cursor: pointer !important;
    text-transform: uppercase !important;
    font-weight: 400 !important;
}

/* Let theme handle hover and active states */


/* Hide default WooCommerce elements in order review */
.woocommerce-checkout #order_review .shop_table,
.woocommerce-checkout .order_review_heading,
.woocommerce-checkout #payment .place-order,
#order_review #place_order,
.woocommerce-checkout #payment .woocommerce-terms-and-conditions-wrapper {
    display: none !important;
}

/* Keep only our custom summary visible */
.woocommerce-checkout #order_review {
    background: #fff;
    border-radius: 12px;
    padding: 0;

    position: relative;
    z-index: 10;
}

/* Loading states */
.dn-order-summary.loading {
    opacity: 0.6;
    pointer-events: none;
}

.dn-cart-item.loading {
    opacity: 0.5;
}

.dn-voucher-section.loading {
    opacity: 0.6;
}

/* Hide theme's duplicate order review title */
.woocommerce-checkout .order_review_heading,
.woocommerce-checkout h3#order_review_heading,
.woocommerce-checkout .woocommerce-column--2>h3:first-child,
#order_review_heading,
.woocommerce-checkout-review-order h3 {
    display: none !important;
}

/* Product thumbnails in cart - sizing only, let theme handle border-radius */
/* (Now using ct-media-container from theme) */

/* ========================================
   CUSTOM DROPDOWN FOR VARIANTS
   Pure CSS dropdown to replace Select2
   ======================================== */

/* Wrapper for native select + custom dropdown */
.dn-select-wrapper {
    position: relative;
    display: inline-block;
}

/* Hide native select but keep accessible */
.dn-select-hidden {
    position: absolute !important;
    opacity: 0 !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* FOUC FIX: Hide native variant select immediately on page load
   This prevents the flash of unstyled content before JS runs 
   ONLY apply on checkout page, not on product page gift box */
body.woocommerce-checkout .dn-variant-select {
    opacity: 0;
    position: absolute;
    pointer-events: none;
}

/* Custom dropdown container */
.dn-custom-dropdown {
    position: relative;
    display: inline-block;
    min-width: 80px;
}

/* Trigger button - looks like native select */
.dn-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid var(--theme-form-field-border-initial-color, #dadada);
    border-radius: 3px;
    font-size: 14px;
    color: inherit;
    cursor: pointer;
    white-space: nowrap;
    min-height: 32px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
}

.dn-dropdown-trigger:focus {
    outline: none;
}

/* Dropdown text */
.dn-dropdown-text {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Arrow icon */
.dn-dropdown-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    color: #666;
    transition: transform 0.2s ease;
}

.dn-custom-dropdown.open .dn-dropdown-arrow {
    transform: rotate(180deg);
}

/* Options list - hidden by default */
.dn-dropdown-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--theme-form-field-border-initial-color, #dadada);
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.dn-custom-dropdown.open .dn-dropdown-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Individual option */
.dn-dropdown-option {
    padding: 8px 12px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: background-color 0.1s ease;
    white-space: nowrap;
}

.dn-dropdown-option:hover {
    background-color: #f5f5f5;
}

/* Selected option - match province dropdown style (grey background, black text) */
.dn-dropdown-option.selected {
    background-color: #f7f7f7;
    color: #333;
    font-weight: 400;
}

/* Focused option (keyboard nav) */
.dn-dropdown-option.focused {
    background-color: #f5f5f5;
    outline: 1px dashed #999;
    outline-offset: -2px;
}

/* Disabled option */
.dn-dropdown-option.disabled {
    color: #999;
    cursor: not-allowed;
    background: transparent;
}

.dn-dropdown-option.disabled:hover {
    background: transparent;
}

/* Scrollbar styling */
.dn-dropdown-options::-webkit-scrollbar {
    width: 6px;
}

.dn-dropdown-options::-webkit-scrollbar-track {
    background: transparent;
}

.dn-dropdown-options::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 3px;
}

/* ========================================
   VARIANT SELECT SPECIFIC STYLING
   For cart item variants on checkout
   ======================================== */

/* Make variant dropdowns fit content */
.dn-cart-item-variants .dn-select-wrapper {
    display: inline-flex;
}

.dn-cart-item-variants .dn-custom-dropdown {
    min-width: auto;
}

.dn-cart-item-variants .dn-dropdown-trigger {
    padding: 4px 10px;
    min-height: 28px;
    font-size: 13px;
}

/* Smaller arrow for compact variant select */
.dn-cart-item-variants .dn-dropdown-arrow svg {
    width: 10px;
    height: 5px;
}

/* Options list positioning for variants */
.dn-cart-item-variants .dn-dropdown-options {
    padding: 5px;
}

.dn-cart-item-variants .dn-dropdown-option {
    padding: 3px 10px;
    font-size: 13px;
}

/* ========================================
   DROPDOWN LOADING STATE (Race Condition Fix)
   ======================================== */

/* Loading state on dropdown - show spinner and reduce opacity */
.dn-custom-dropdown.loading .dn-dropdown-trigger {
    opacity: 0.6;
    pointer-events: none;
}

.dn-custom-dropdown.loading .dn-dropdown-options {
    pointer-events: none;
    background: #fff;
}

/* Show proper circular spinner instead of rotating arrow */
.dn-custom-dropdown.loading .dn-dropdown-arrow svg {
    display: none;
}

.dn-custom-dropdown.loading .dn-dropdown-arrow::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #ddd;
    border-top-color: #666;
    border-radius: 50%;
    animation: dn-spin 0.6s linear infinite;
}

@keyframes dn-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Prevent all clicks on variants section during cart loading */
.dn-order-summary.loading .dn-cart-item-variants {
    pointer-events: none;
    opacity: 0.7;
}

.dn-voucher-condition-btn {
    font-size: 12px;
    color: #111;
    text-decoration: underline;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    position: relative;
    z-index: 10;
    align-self: flex-end;
}

.dn-voucher-condition-btn:hover {
    color: #105151;
}

.dn-voucher-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
}

.dn-voucher-icon svg {
    width: 100%;
    height: 100%;
}

/* ========================================
   ORDER DETAILS TABLE STYLING
   Match Checkout Design
   ======================================== */

.woocommerce-order-details .woocommerce-table--order-details {
    width: 100%;
    margin-bottom: 0;
    border-collapse: collapse;
}

/* Product Row Styling */
.woocommerce-order-details .woocommerce-table--order-details td.product-name {
    padding: 20px 0;
    border-top: 1px solid #f0f0f0;
}

/* Product Image Formatting to Match Checkout */
.woocommerce-order-details .woocommerce-table--order-details img.dn-order-img {
    width: 65px !important;
    height: auto !important;
    border-radius: 4px;
    object-fit: contain;
    background-image: linear-gradient(180deg, #c4c4c4 0, #fff 100%);
    aspect-ratio: 3 / 4;
}

/* Hide the default WC product quantity and use our custom one if needed */
.woocommerce-order-details .product-quantity {
    display: none;
}

.dn-item-details-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Link Styling */
.woocommerce-order-details .woocommerce-table--order-details td.product-name a {
    color: var(--theme-link-initial-color, #111);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
}

.woocommerce-order-details .woocommerce-table--order-details td.product-name a:hover {
    color: var(--theme-link-hover-color, #666);
}

.woocommerce-order-details .woocommerce-table--order-details td.product-total,
.woocommerce-order-details .woocommerce-table--order-details th {
    padding: 20px 0;
    text-align: right;
    vertical-align: middle;
}

.woocommerce-order-details .woocommerce-table--order-details thead th {
    border-bottom: 2px solid #eee;
    padding-bottom: 12px;
    text-align: left;
    color: #111;
    font-weight: 600;
}

.woocommerce-order-details .woocommerce-table--order-details thead th.product-total {
    text-align: right;
}

/* Table Footer (Totals) */
.woocommerce-order-details .woocommerce-table--order-details tfoot th {
    text-align: left;
    font-weight: normal;
    color: #666;
    border-top: 1px solid #f0f0f0;
    width: 40%;
}

.woocommerce-order-details .woocommerce-table--order-details tfoot td {
    text-align: right;
    border-top: 1px solid #f0f0f0;
    font-weight: 500;
}

.woocommerce-order-details .woocommerce-table--order-details tfoot .woocommerce-table__row--order_total th,
.woocommerce-order-details .woocommerce-table--order-details tfoot .woocommerce-table__row--order_total td {
    font-weight: 600;
    color: #111;
    font-size: 1.1em;
}

/* Customer Details Styling */
.woocommerce-customer-details {
    margin-top: 0;
    font-size: 14px;
    line-height: 1.6;
}

.woocommerce-table--customer-details {
    width: 100%;
    border-collapse: collapse;
}

.woocommerce-table--customer-details th {
    text-align: left;
    font-weight: normal;
    color: #666;
    border-top: 1px solid #f0f0f0;
    width: 40%;
    padding: 20px 0;
    vertical-align: top;
}

.woocommerce-table--customer-details td {
    text-align: right;
    border-top: 1px solid #f0f0f0;
    font-weight: 500;
    padding: 20px 0;
    vertical-align: top;
    color: #111;
}

/* ========================================
   CHECKOUT - ADDRESS BOOK PICKER
   ======================================== */

.dn-checkout-ab-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #000;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #000;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.dn-checkout-ab-trigger:hover {
    background: #000;
    color: #fff;
}

.dn-checkout-ab-trigger svg {
    width: 16px;
    height: 16px;
}

/* Checkout selected address indicator */
.dn-checkout-ab-selected {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: #f0f7ff;
    border: 1px solid #2f5acf;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 13px;
}

.dn-checkout-ab-selected.active {
    display: flex;
}

.dn-checkout-ab-selected-text {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.dn-checkout-ab-selected-text strong {
    color: #000;
}

.dn-checkout-ab-clear {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    font-weight: 700;
}

.dn-checkout-ab-clear:hover {
    color: #a71d2a;
}

/* Checkout address popup list */
.dn-checkout-ab-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.45);
    align-items: center;
    justify-content: center;
}

.dn-checkout-ab-popup.active {
    display: flex;
}

.dn-checkout-ab-popup-content {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    animation: dnModalIn 0.2s ease;
    padding: 24px;
}

.dn-checkout-ab-popup-title {
    font-size: 18px;
    font-weight: 700;
    color: #000;
    margin: 0 0 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dn-checkout-ab-popup-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.dn-checkout-ab-popup-close:hover {
    color: #333;
}

.dn-checkout-ab-popup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dn-checkout-ab-popup-item {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.15s;
}

.dn-checkout-ab-popup-item:hover {
    border-color: #000;
    background: #fafafa;
}

.dn-checkout-ab-popup-item--default {
    border-color: #000;
    border-width: 2px;
}

.dn-checkout-ab-popup-item-name {
    font-weight: 700;
    font-size: 14px;
    color: #000;
    margin-bottom: 2px;
}

.dn-checkout-ab-popup-item-phone {
    font-weight: 400;
    color: #555;
    margin-left: 8px;
}

.dn-checkout-ab-popup-item-addr {
    font-size: 13px;
    color: #666;
}

/* Locked/readonly state for billing form when address is selected */
.dn-billing-locked .form-row input:not([type="hidden"]),
.dn-billing-locked .form-row select,
.dn-billing-locked .form-row textarea,
.dn-billing-locked .select2-selection,
.dn-billing-locked .dn-vn-name-prefix {
    pointer-events: none;
    background-color: #f5f5f5 !important;
    opacity: 0.7;
    color: #666;
}

/* ========================================
   CHECKOUT - LOYALTY POINTS REDEMPTION
   ======================================== */
.dn-loyalty-checkout-wrap {
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.dn-loyalty-checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 15px;
    position: relative;
}

.dn-loyalty-checkbox-inner {
    position: relative;
    width: 22px;
    height: 22px;
    margin-right: 10px;
    flex-shrink: 0;
}

.dn-loyalty-checkbox-text {
    color: #000;
}

.dn-loyalty-checkbox-subtext {
    color: #888;
    font-weight: 400;
    font-size: 14px;
    margin-left: 5px;
}

.dn-loyalty-max-wrap {
    font-size: 14px;
    color: #333;
    margin-bottom: 12px;
}

.dn-loyalty-max-btn {
    font-weight: 600;
    color: #2f5aca;
    cursor: pointer;
}

.dn-loyalty-input-row {
    display: flex;
    gap: 15px;
    align-items: stretch;
    height: 44px;
    margin-bottom: 20px;
}

.dn-loyalty-stepper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 22px;
    width: 100%;
    max-width: 350px;
    overflow: hidden;
}

.dn-loyalty-stepper-btn {
    background: transparent;
    border: none;
    width: 44px;
    height: 100%;
    font-size: 20px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dn-loyalty-stepper-btn:hover {
    background: #f5f5f5 !important;
}

.dn-loyalty-stepper-input {
    flex-grow: 1;
    border: none;
    text-align: center;
    background: transparent;
    font-size: 16px;
    font-weight: 500;
    padding: 0;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
    box-shadow: none;
}

.dn-loyalty-apply-btn {
    border-radius: 22px;
    padding: 0 25px;
    font-weight: 600;
    background: #000;
    color: #fff;
    border: none;
    cursor: pointer;
    letter-spacing: 0.3px;
    font-size: 14px;
    white-space: nowrap;
}

.dn-loyalty-apply-btn:hover {
    background: #333 !important;
}

.dn-loyalty-message {
    font-size: 13px;
    margin-bottom: 20px;
}

.dn-loyalty-earned-points {
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.dn-loyalty-earned-label {
    font-weight: 600;
    color: #111;
}

.dn-loyalty-earned-value {
    color: #2f5aca;
    font-weight: 500;
}

/* ========================================
   LOYALTY REDEMPTION
   ======================================== */

/* Remove number input arrows */
#dn_loyalty_input::-webkit-outer-spin-button,
#dn_loyalty_input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#dn_btn_apply_points:hover {
    background: #333 !important;
}

#dn_loyalty_minus:hover,
#dn_loyalty_plus:hover {
    background: #f5f5f5 !important;
}

/* Custom Checkbox Styles */
.dn-loyalty-custom-checkbox {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
    z-index: 1;
}

.dn-loyalty-custom-checkbox-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 22px;
    height: 22px;
    background-color: #fff;
    border: 1px solid #c5c5c5;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2;
}

.dn-loyalty-custom-checkbox-label::after {
    content: "";
    position: absolute;
    display: none;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dn-loyalty-custom-checkbox:checked~.dn-loyalty-custom-checkbox-label {
    background-color: #105151;
    border-color: #105151;
}

.dn-loyalty-custom-checkbox:checked~.dn-loyalty-custom-checkbox-label::after {
    display: block;
}

.dn-loyalty-checkbox-container:hover .dn-loyalty-custom-checkbox-label {
    border-color: #105151;
    box-shadow: 0 0 0 2px rgba(16, 81, 81, 0.1);
}

/* Tooltip Styles */
.dn-loyalty-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.dn-loyalty-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    /* Align to the right to prevent going out of bounds on mobile screens */
    background: #fff;
    color: #000;
    border: 1px solid #e0e0e0;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 280px;
    display: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
    pointer-events: none;
}

/* Small triangle for tooltip */
.dn-loyalty-tooltip::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 4px);
    right: 5px;
    /* Adjust according to tooltip alignment */
    border-width: 6px;
    border-style: solid;
    border-color: #e0e0e0 transparent transparent transparent;
    display: none;
    z-index: 101;
}

.dn-loyalty-tooltip:hover::after,
.dn-loyalty-tooltip:hover::before {
    display: block;
}

@media (min-width: 768px) {
    .dn-loyalty-tooltip::after {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }

    .dn-loyalty-tooltip::before {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

/* Toast Notification - Matching dn-checkout-ultimate style */
#dn_points_toast {
    position: fixed;
    top: 160px;
    right: 30px;
    z-index: 100000;
    padding: 14px 24px;
    background: #fff;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    border-radius: 5px;
    border-left: 2px solid #105151;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    align-items: center;
    gap: 10px;
    animation: dn-toast-slide-in 0.3s ease;
}

#dn_points_toast::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #105151;
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    flex-shrink: 0;
}

#dn_points_toast.dn-toast-hiding {
    animation: dn-toast-slide-out 0.3s ease forwards;
}

@keyframes dn-toast-slide-in {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes dn-toast-slide-out {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}