/**
 * Path: assets/css/components/floating-bar.css
 * Description: Styles for the Floating Save Button (Restyled as requested).
 */

/* --- FLOATING SAVE BUTTON CONTAINER --- */
#fep-floating-save-container {
    position: fixed;
    bottom: 30px;
    left: 30px;
    z-index: 9998;
    animation: fepSlideUpBar 0.5s ease-out;
    
    background-color: #ffffff;
    padding: 10px; 
    border-radius: 3px; 
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15); 
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 200px;
    box-sizing: border-box; /* Prevent padding from adding to width */
}

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

/* Button Styling Inside Container */
#fep-floating-save-container .big-next-btn {
    font-size: 15px !important; /* Slightly smaller text */
    padding: 12px 25px !important;
    border-radius: 3px !important; 
    box-shadow: none !important; 
    display: flex;
    align-items: center;
    justify-content: center; 
    gap: 12px;
    width: 100%; 
    margin: 0;
    white-space: nowrap; /* Prevent wrapping unless necessary */
    
    background-color: var(--fep-gold, #AC9653) !important;
    color: #fff !important;
    border: none !important;
    font-weight: 500 !important;
}

#fep-floating-save-container .big-next-btn:hover {
    background-color: var(--fep-gold-hover, #96834d) !important;
}

/* Thinner Arrow (Using Angle Right) */
#fep-floating-save-container .big-next-btn::after {
    content: '\f105'; /* FontAwesome Angle Right (Thinner than Arrow) */
    font-family: "Font Awesome 5 Free", "FontAwesome";
    font-weight: 900;
    font-size: 14px;
    opacity: 0.8;
}

/* --- SUMMARY LIST STYLES (Used in Static Summary) --- */
.wsq-container { width: 100%; }

/* FIX: Prevent narrow table on load by ensuring item container takes full width */
#wuden-saved-quote-page.wsq-container {
    width: 100% !important;
    max-width: 100% !important; /* Allow full container width */
    min-width: 100%; /* Force width */
    box-sizing: border-box; /* Ensure padding doesn't affect width */
    display: block; /* Ensure block display */
}

/* Ensure inner items expand */
#wuden-saved-quote-page .wsq-item {
    width: 100% !important;
    box-sizing: border-box;
}

.wsq-item {
    display: flex;
    align-items: flex-start;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    gap: 15px;
    width: 100%; /* Explicit width */
    box-sizing: border-box;
}
.wsq-item:last-child { border-bottom: none; }

.wsq-item-image {
    width: 80px; 
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-main, 3px);
    background-color: #f0f0f0;
    flex-shrink: 0;
    border: 1px solid #eee;
}

.wsq-item-details {
    flex-grow: 1;
    min-width: 0;
    width: 100%; /* Ensure details take up remaining space */
}

.wsq-item-details h3 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: var(--fep-dark-grey, #333);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%; /* Force header to full width */
}

.wsq-sub-container {
    margin-top: 5px;
    width: 100%; /* Ensure sub-container is full width */
}

.wsq-sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #555;
    width: 100%; /* Essential for proper spacing */
    margin-top: 4px;
}

.wsq-edit-link {
    font-size: 12px;
    color: var(--fep-gold, #AC9653);
    margin-left: 8px;
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.wsq-edit-link:hover { text-decoration: underline; }

.wsq-item-price {
    font-weight: 600;
    color: var(--fep-dark-grey, #333);
    white-space: nowrap;
    margin-left: 15px;
}

/* CHANGED: Superscript Color to Dark Grey per user request */
.wsq-item-details sup {
    color: var(--fep-dark-grey, #4E4E4E); /* Was gold */
    font-weight: 600;
    margin-left: 2px;
}

.wsq-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #333;
    background-color: transparent;
    width: 100%; /* Force total row to full width */
    box-sizing: border-box;
}

.wsq-total h3 {
    margin: 0;
    font-size: 22px;
    font-family: var(--fep-font-serif, serif);
    color: #333;
}

.wsq-total-price {
    font-size: 28px;
    font-weight: 700;
    color: #444; 
    font-family: var(--fep-font-serif, serif);
}

/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
    #fep-floating-save-container {
        left: 20px;
        right: 20px;
        bottom: 20px;
        width: auto !important; /* Allow auto width */
        max-width: calc(100% - 40px) !important; /* Ensure it doesn't overflow horizontally */
        min-width: 0 !important; /* Reset min-width if needed */
        box-sizing: border-box !important;
    }
    
    #fep-floating-save-container .big-next-btn {
        padding: 12px 15px !important; /* Reduce padding slightly on small screens */
        font-size: 14px !important;
        white-space: normal !important; /* Allow wrap if text is very long */
        text-align: center !important;
        width: 100% !important;
    }
}

/* --- PRINT STYLES (Fixed White Page Issue) --- */
@media print {
    /* 1. Global Reset - Hide everything by default */
    body * {
        visibility: hidden;
    }

    /* 2. Reset Layout Constraints for Blank Page Fix */
    body, html {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important; /* Was 100%, causing blank pages */
        min-height: 0 !important;
        overflow: visible !important;
        background: #fff !important;
    }

    /* 3. Target the Quote Container and ALL its children for Visibility */
    #wuden-saved-quote-page,
    #wuden-saved-quote-page * {
        visibility: visible !important;
    }

    /* 4. Position the Quote Container Properly */
    #wuden-saved-quote-page {
        position: static !important; /* Changed from absolute to static to respect flow */
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: white !important;
        display: block !important;
        float: none !important;
    }

    /* 5. Hide Interactive/Edit Elements specifically inside the visible container */
    #wuden-saved-quote-page .wsq-edit-actions,
    #wuden-saved-quote-page .wsq-edit-link,
    #wuden-saved-quote-page .wsq-accordion-header::after {
        display: none !important;
    }

    /* 6. Force Layouts for Printing */
    .wsq-item, 
    .wsq-total,
    .wsq-sub-row {
        display: flex !important;
        page-break-inside: avoid;
    }

    /* 7. Accordion Logic - Attempt to force visibility */
    /* Note: If <details> is closed, CSS cannot force it open. JS is required for that. */
    /* We ensure the content DIV is visible if the browser allows it */
    .wsq-accordion-content {
        display: block !important;
        height: auto !important;
        opacity: 1 !important;
        overflow: visible !important;
        visibility: visible !important;
    }
    
    /* 8. Show Custom Print Header */
    .fep-print-only-header {
        display: block !important;
        text-align: center !important;
        margin-bottom: 20px !important;
        visibility: visible !important; 
    }
    .fep-print-only-header * {
        visibility: visible !important;
    }
    
    /* 9. Typography Adjustments */
    #wuden-saved-quote-page {
        font-size: 11pt !important;
        color: #000 !important;
    }
    a { 
        text-decoration: none !important; 
        color: #000 !important; 
    }
    
    /* 10. Page Setup */
    @page {
        margin: 1cm;
        size: auto;
    }
}