/* Preorder Message Styling */
.preorder-message-container {
    position: relative;
    display: inline-block;
}

.preorder-message {
    font-style: italic;
    color: #e67e22 !important;
    margin-bottom: 1em;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.3s ease;
}

.preorder-message:hover {
    color: #d35400;
}

/* Modal Styling */
.preorder-modal {
    position: fixed;
    top: 100%;
    left: 0;
    z-index: 99999;
    background: #fff !important;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0;
    min-width: 280px;
    max-width: 350px;
    font-size: 14px;
    line-height: 1.4;
    display: none !important;
}

.preorder-modal-content {
    padding: 16px;
}

.preorder-modal h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}

.preorder-details p {
    margin: 0 0 12px 0;
    color: #555;
}

.preorder-details p:last-child {
    margin-bottom: 0;
}

.preorder-details strong {
    color: #333;
    font-weight: 600;
}

/* Arrow pointer */
.preorder-modal {
    --arrow-left: 20px;
}

.preorder-modal::before {
    content: '';
    position: absolute;
    top: -8px;
    left: var(--arrow-left, 20px);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #ddd;
}

.preorder-modal::after {
    content: '';
    position: absolute;
    top: -7px;
    left: var(--arrow-left, 20px);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .preorder-modal {
        position: fixed;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    .preorder-modal::before,
    .preorder-modal::after {
        display: none;
    }
}

/* Animation */
.preorder-modal.show {
    display: block !important;
    animation: fadeInUp 0.2s ease-out;
}

.preorder-modal.visible {
    display: block !important;
}

/* Ensure modal visibility when shown */
.preorder-modal[style*="display: block"] {
    display: block !important;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Checkout page specific styling */
.woocommerce-checkout .preorder-message {
    color: #fff !important;
    font-weight: normal !important;
    font-style: normal !important;
    text-decoration: none !important;
    border: none !important;
}

/* WooCommerce notice styling for preorder messages */
.woocommerce-info .preorder-message-container,
.woocommerce-message .preorder-message-container {
    display: inline-block;
    position: relative;
}

.woocommerce-info .preorder-message,
.woocommerce-message .preorder-message {
    color: #fff !important;
    text-decoration: none !important;
    cursor: pointer;
    border: none !important;
    font-style: normal !important;
    font-weight: normal !important;
}

.woocommerce-info .preorder-message:hover,
.woocommerce-message .preorder-message:hover {
    color: #fff !important;
    text-decoration: none !important;
}

/* Ensure modals in notices have proper z-index */
.woocommerce-info .preorder-modal,
.woocommerce-message .preorder-modal {
    z-index: 999999;
}

/* Shop/Product list page specific styling */
body.woocommerce-shop .preorder-message,
body.archive.woocommerce .preorder-message,
body.woocommerce.archive .preorder-message,
.woocommerce ul.products li.product .preorder-message,
.woocommerce-page ul.products li.product .preorder-message {
    font-style: normal !important;
    color: inherit !important;
    text-decoration: none !important;
    font-weight: normal !important;
}

body.woocommerce-shop .preorder-message:hover,
body.archive.woocommerce .preorder-message:hover,
body.woocommerce.archive .preorder-message:hover,
.woocommerce ul.products li.product .preorder-message:hover,
.woocommerce-page ul.products li.product .preorder-message:hover {
    color: inherit !important;
    text-decoration: none !important;
}

/* Override for any preorder message NOT on single product pages */
body:not(.single-product) .preorder-message {
    font-style: normal !important;
    color: inherit !important;
    text-decoration: none !important;
    font-weight: normal !important;
}

body:not(.single-product) .preorder-message:hover {
    color: inherit !important;
    text-decoration: none !important;
}

/* =============================================
   Product page box styling — Travessia Design
   ============================================= */
.preorder-product-box {
    background-color: rgba(82, 94, 66, 0.06);
    border: 1px solid rgba(82, 94, 66, 0.18);
    border-radius: 9999px;
    padding: 14px 24px;
    margin: 0 0 8px 0;
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.preorder-product-box:hover {
    background-color: rgba(82, 94, 66, 0.10);
    border-color: rgba(82, 94, 66, 0.30);
}

.preorder-product-box::before {
    content: '';
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    position: static;
    transform: none;
    border: none;
    background: transparent;
    /* Calendar icon via SVG data URI */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23525E42' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    opacity: 0.7;
}

.preorder-product-message {
    font-family: 'Montserrat', sans-serif !important;
    font-style: normal !important;
    color: #525E42 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    letter-spacing: 0.02em;
    margin: 0 !important;
    padding-left: 0;
    cursor: pointer;
}

/* When the template wraps the PHP output (which uses .preorder-message, not .preorder-product-message) */
.preorder-product-box .preorder-message-container {
    display: contents;
}

.preorder-product-box .preorder-message {
    font-family: 'Montserrat', sans-serif !important;
    font-style: normal !important;
    color: #525E42 !important;
    text-decoration: none !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    letter-spacing: 0.02em;
    margin: 0 !important;
    padding: 0 !important;
    cursor: pointer;
}

.preorder-product-message:hover {
    color: #525E42 !important;
    text-decoration: none !important;
}

.preorder-product-box .preorder-modal {
    z-index: 999999;
}

/* Modal styling refinements for product page */
.preorder-product-box .preorder-modal {
    border-radius: 12px;
    border: 1px solid rgba(82, 94, 66, 0.15);
    box-shadow: 0 8px 30px rgba(45, 45, 45, 0.1);
}

.preorder-product-box .preorder-modal h4 {
    color: #525E42;
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 18px;
    border-bottom: 1px solid rgba(82, 94, 66, 0.12);
}

.preorder-product-box .preorder-details strong {
    color: #525E42;
}