/**
 * Path: assets/css/components/modals.css
 * Description: Full integrated styles for Coffin Details, Summary Modal, and Navigation.
 */

/* --- SHARED MODAL OVERLAY --- */
.product-modal-overlay,
.fep-modal-overlay,
.coffin-popup-overlay {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 100001 !important; /* Ensure it's above the floating bar (9998) */
    display: none; /* Default hidden */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

/* Visibility State - Handled by JS toggling these classes */
.product-modal-overlay.open,
.product-modal-overlay.is-visible, 
.fep-modal-overlay.open,
.coffin-popup-overlay.is-visible,
.fep-modal-overlay.is-visible {
    display: flex !important;
    opacity: 1;
    pointer-events: auto;
}

/* --- MODAL CONTAINERS --- */
.product-modal-container,
.fep-modal-container-summary,
.fep-modal-content,
.coffin-popup-content {
    background-color: var(--fep-white, #FFFFFF);
    width: 90%;
    max-width: 800px;
    border-radius: var(--radius-main, 3px);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    max-height: 90vh; /* Critical for scrolling */
    position: relative;
    animation: fepSlideUp 0.3s ease-out;
}

/* Specific Width for Summary Modal */
.fep-modal-container-summary, .fep-modal-content {
    max-width: 600px; /* Match new mockup width */
}

@keyframes fepSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- CLOSE BUTTONS (Reset & Standardization) --- */
/* Target all close buttons aggressively to override theme styles */
.pm-close,
.fep-modal-close,
.coffin-popup-close,
button.pm-close {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    background: rgba(255, 255, 255, 0.8) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 32px !important;
    height: 32px !important;
    font-size: 24px !important;
    line-height: 1 !important;
    color: var(--fep-dark-grey, #4E4E4E) !important;
    cursor: pointer !important;
    z-index: 20 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
    box-shadow: none !important;
    outline: none !important;
}

.pm-close:hover,
.fep-modal-close:hover,
.coffin-popup-close:hover,
button.pm-close:hover {
    background-color: var(--fep-gold, #AC9653) !important;
    color: #fff !important;
}

/* --- MODAL HEADER (Summary) --- */
.fep-modal-header {
    background-color: #fff; /* White background per mockup */
    padding: 20px 30px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0; /* Don't shrink header on scroll */
}

.fep-modal-title {
    font-family: var(--fep-font-serif, serif);
    font-weight: 400;
    font-size: 24px;
    color: var(--fep-dark-grey, #4E4E4E);
    margin: 0;
}

/* --- MODAL BODY (Scrollable Area) --- */
.fep-modal-body {
    padding: 0 30px 30px 30px; /* Padding inside scroll area */
    overflow-y: auto; /* Enable vertical scroll */
    flex-grow: 1; /* Take available space */
}

/* --- COFFIN DETAILS SPECIFICS --- */
.product-modal-body {
    display: flex;
    flex-direction: row;
    overflow-y: auto;
    height: 100%;
}

/* Updated Zoom Styles for Magnifier */
.product-modal-img-col {
    flex: 1;
    background-color: #f4f4f4;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    overflow: hidden; /* Prevent glass from overflowing container if logic fails */
    position: relative; /* Context for absolute zoom */
    touch-action: none; /* Prevent scrolling while dragging glass */
}

.product-modal-img {
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
    display: block;
}

/* Magnifier Glass Style */
.img-magnifier-glass {
    position: absolute;
    width: 150px;
    height: 150px;
    border: 3px solid #ffffff;
    border-radius: 10px; /* Rounded corners for window feel */
    box-shadow: 0 4px 8px rgba(0,0,0,0.3), 0 6px 20px rgba(0,0,0,0.25);
    cursor: none;
    background-repeat: no-repeat;
    pointer-events: none; /* Let clicks pass through */
    z-index: 100;
    display: none; /* Hidden by default */
}

/* Zoom Icon (Optional - kept if desired for cue) */
.coffin-zoom-icon {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: rgba(255, 255, 255, 0.8);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    color: var(--fep-dark-grey, #4E4E4E);
    font-size: 16px;
    pointer-events: none; 
    transition: opacity 0.3s ease;
    z-index: 5;
}

/* Hide icon when zooming */
.product-modal-img-col:hover .coffin-zoom-icon {
    opacity: 0;
}

.product-modal-info-col {
    flex: 1;
    padding: 50px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.pm-title {
    font-family: var(--fep-font-serif, serif);
    font-weight: 400;
    font-size: 34px;
    color: var(--fep-dark-grey, #4E4E4E);
    margin-bottom: 5px;
    line-height: 1.2;
}

.pm-price {
    font-family: var(--fep-font-main, sans-serif);
    font-size: 16px;
    color: #444;
    font-weight: 600;
    margin-bottom: 25px;
}

/* --- TABS & SCROLLABLE CONTENT --- */
/* Reset container for tabs */
.pm-tabs-nav {
    display: flex;
    width: 100%;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    justify-content: center;
    gap: 20px;
    padding: 0;
    background: transparent !important;
}

/* Aggressively reset button styles for tabs */
button.pm-tab-btn,
.pm-tab-btn {
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 10px 15px !important;
    margin: 0 !important;
    font-family: var(--fep-font-main, sans-serif) !important;
    font-size: 14px !important;
    font-weight: 500 !important; /* Made less bold per request */
    color: var(--fep-medium-grey, #767676) !important;
    cursor: pointer !important;
    border-bottom: 2px solid transparent !important;
    transition: all 0.3s ease !important;
    box-shadow: none !important;
    outline: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    text-align: center !important; /* Centered text per request */
}

button.pm-tab-btn:hover,
.pm-tab-btn:hover {
    color: var(--fep-gold, #AC9653) !important;
    background: transparent !important;
}

button.pm-tab-btn.active,
.pm-tab-btn.active {
    color: var(--fep-dark-grey, #4E4E4E) !important;
    border-bottom-color: var(--fep-gold, #AC9653) !important;
    background: transparent !important;
}

.pm-tab-content {
    display: none;
    width: 100%;
}

.pm-tab-content.active {
    display: block;
}

/* Scrollable Description Container */
.pm-desc {
    font-family: var(--fep-font-main, sans-serif);
    font-size: 15px;
    line-height: 1.6;
    color: var(--fep-medium-grey, #767676);
    margin-bottom: 35px;
    max-width: 400px;
    width: 100%;
    text-align: left; /* Ensure text alignment is readable */
    
    /* Scroll Logic */
    max-height: 300px; /* Limit height */
    overflow-y: auto;  /* Scroll if overflow */
    padding-right: 10px; /* Space for scrollbar */
    
    /* Scrollbar Styling (Webkit) */
    scrollbar-width: thin;
    scrollbar-color: #ddd transparent;
}

.pm-desc::-webkit-scrollbar {
    width: 6px;
}
.pm-desc::-webkit-scrollbar-track {
    background: transparent; 
}
.pm-desc::-webkit-scrollbar-thumb {
    background-color: #ddd; 
    border-radius: 3px;
}

/* --- INNER ACCORDION STYLES (Match .accordion-item) --- */
/* For Elementor or custom accordions inside the modal description */
.pm-desc .elementor-accordion-item,
.pm-desc .accordion-item {
    border: 1px solid #e0e0e0;
    border-radius: var(--radius-main, 3px);
    background-color: var(--fep-white, #FFFFFF);
    margin-bottom: 10px;
    overflow: hidden;
}

.pm-desc .elementor-tab-title,
.pm-desc .accordion-header {
    width: 100%;
    padding: 15px 20px;
    background: #fff;
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-family: var(--fep-font-serif, serif);
    font-size: 16px;
    color: var(--fep-dark-grey, #4E4E4E);
    font-weight: 500;
    transition: background 0.2s;
}

.pm-desc .elementor-tab-title:hover,
.pm-desc .accordion-header:hover {
    background-color: #fcfcfc;
}

.pm-desc .elementor-tab-content,
.pm-desc .accordion-content {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #fff;
    font-family: var(--fep-font-main, sans-serif);
    font-size: 14px;
    line-height: 1.6;
    color: var(--fep-medium-grey, #767676);
}

/* --- MODAL FOOTER --- */
.fep-modal-footer {
    padding: 15px 20px;
    background-color: var(--fep-white, #FFFFFF);
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.footer-nav-btn {
    background: transparent;
    border: 1px solid #ddd;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-main, 3px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fep-gold, #AC9653);
    cursor: pointer;
    transition: all 0.2s;
}

.footer-nav-btn:hover {
    background-color: var(--fep-gold-light, #f4f1ea);
    border-color: var(--fep-gold, #AC9653);
}

.footer-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    visibility: hidden;
}

.footer-step-text {
    font-weight: 600;
    color: var(--fep-dark-grey, #4E4E4E);
    font-size: 14px;
}

/* --- COMPONENT OVERRIDES --- */
/* Smaller Font for Action Buttons inside Modals & Grids */
.product-modal-container .btn-add,
.location-popup-buttons .elementor-button,
.plot-choice-option .elementor-button {
    background-color: var(--fep-gold, #AC9653) !important;
    color: #fff !important;
    border-color: var(--fep-gold, #AC9653) !important;
    font-family: var(--fep-font-serif, serif) !important;
    text-transform: capitalize !important;
    font-size: 14px !important; /* Enforced smaller size */
    padding: 10px 20px !important; /* Slightly reduced padding */
}

.location-popup-buttons .elementor-button:hover,
.plot-choice-option .elementor-button:hover {
    background-color: var(--fep-gold-hover, #96834d) !important;
}

/* Fix for Modal Checkbox Icon - Using Check class from tiles */
.modal-checkbox-row .estimate-checkbox {
    width: 20px;
    height: 20px;
    border: 1px solid #ccc;
    border-radius: var(--radius-main, 3px);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-checkbox-row.active .estimate-checkbox {
    background-color: var(--fep-gold);
    border-color: var(--fep-gold);
}

/* Use exact same check icon logic as tiles */
.modal-checkbox-row.active .estimate-checkbox::after {
    content: '\f00c';
    font-family: "Font Awesome 5 Free", "FontAwesome" !important;
    font-weight: 900 !important;
    color: white;
    font-size: 11px;
    display: block;
    line-height: 1;
}

/* --- FOOTER NOTES ACCORDION (Moved from inline JS) --- */
.static-footer-notes {
    margin-top: 0px; 
    border-top: 1px solid #eee; 
    padding-top: 20px;
}

.fep-notes-accordion {
    background: #f9f9f9; 
    border-radius: 3px; 
    overflow: hidden;
}

.fep-notes-accordion-btn {
    width: 100%; 
    text-align: left; 
    padding: 15px; 
    border: none; 
    background: none; 
    cursor: pointer; 
    font-weight: 600; 
    color: #444; 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}

.fep-notes-content {
    display: none; 
    padding: 15px; 
    border-top: 1px solid #eee; 
    font-size: 12px; 
    color: #666; 
    line-height: 1.6;
}

.fep-notes-content p {
    margin-bottom: 8px;
}

.fep-notes-content.open {
    display: block;
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    .product-modal-body {
        flex-direction: column;
    }
    .product-modal-img-col {
        min-height: 250px;
    }
    .product-modal-info-col {
        padding: 30px 20px;
    }
    .pm-title {
        font-size: 28px;
    }
    .pm-desc {
        max-height: 200px; /* Reduce scroll height on mobile */
    }
    
    /* Ensure glass visible on mobile if logic triggers */
    .img-magnifier-glass {
        display: none; /* Logic toggles this */
    }
}