/**
 * MW Prepopulate Product Page Fields - Frontend Styles
 */

/* Gear Icon Styles */
.mw-pppp-gear-icon-wrapper {
    display: inline-block;
    margin-left: 10px;
    position: relative;
}

#mw-pppp-gear-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: transform 0.3s ease;
}

#mw-pppp-gear-icon:hover {
    transform: rotate(45deg);
    color: #7f54b3; /* WooCommerce purple */
}

/* Sidebar Styles */
.mw-pppp-sidebar {
    position: fixed;
    top: 0;
    right: -350px; /* Start off-screen */
    width: 350px;
    height: 100%;
    background-color: #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 999999;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.mw-pppp-sidebar.active {
    right: 0;
}

.mw-pppp-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.mw-pppp-sidebar-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.mw-pppp-close-sidebar {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    padding: 0;
    line-height: 1;
}

.mw-pppp-sidebar-content {
    padding-top: 10px;
}

.mw-pppp-field-group {
    margin-bottom: 20px;
}

.mw-pppp-error-message {
    color: #d63638;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

.mw-pppp-field-caption {
    color: #6c757d;
    font-size: 12px;
    margin-top: 4px;
    font-style: normal;
}

.mw-pppp-field-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

/* Use sidebar ID for higher specificity without !important */
#mw-pppp-sidebar .mw-pppp-field-group input[type="text"],
#mw-pppp-sidebar .mw-pppp-field-group input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.mw-pppp-section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 25px 0 15px;
    padding-bottom: 5px;
    border-bottom: 1px solid #f0f0f0;
}

.mw-pppp-loading-text {
    font-style: italic;
    color: #666;
    text-align: center;
    padding: 10px 0;
}

.mw-pppp-select-option {
    margin-bottom: 15px;
    border-bottom: 1px solid #f9f9f9;
    padding-bottom: 15px;
}

.mw-pppp-select-option:last-child {
    border-bottom: none;
}

.mw-pppp-select-option label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.mw-pppp-select-wrapper {
    position: relative;
    width: 100%;
    background-color: #fff;
}

/* Use sidebar ID and select class for higher specificity without !important */
#mw-pppp-sidebar .mw-pppp-select-option select.mw-pppp-select,
#mw-pppp-sidebar .mw-pppp-select-option select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    background-color: #fff;
    -webkit-appearance: menulist; /* Fixes rendering issues in Chrome/Safari */
    -moz-appearance: menulist; /* Fixes rendering issues in Firefox */
    appearance: menulist; /* Standard syntax */
    background-image: none;
    color: #333;
}

/* Additional specificity for select options within the sidebar */
#mw-pppp-sidebar select[id^="mw-pppp-pewc_"],
#mw-pppp-sidebar select[class*="mw-pppp-"] {
    font-size: 14px;
    line-height: 1.5;
}

.mw-pppp-actions {
    margin-top: 30px;
    text-align: center;
}

.mw-pppp-apply-button {
    background-color: #7f54b3; /* WooCommerce purple */
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.mw-pppp-apply-button:hover {
    background-color: #673ab7;
}

/* Overlay */
.mw-pppp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mw-pppp-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   PEWC Field Image (Thumbnail) Size Overrides
   Increases the Product Size section thumbnail images next to number inputs.
   The default is width:20% in PEWC style.css line 276-278.
   See CLAUDE.md in project root for documentation.
   ========================================================================== */
.pewc-item-field-image-wrapper {
    width: 100px !important;
    min-width: 100px;
}
.pewc-item-field-image-wrapper img {
    width: 100px;
    height: auto;
}

/* ==========================================================================
   Collapsible PEWC Group Sections
   Makes "Additional Information" header collapsible with a chevron toggle.
   JS: initCollapsibleGroups() in mw-pppp-frontend.js
   ========================================================================== */
.mw-collapsible-heading {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.mw-collapsible-heading h3 {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mw-collapse-chevron {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
    flex-shrink: 0;
    margin-left: 4px;
    position: relative;
    top: -2px;
}
/* Chevron points right when collapsed */
.mw-collapsible-heading.mw-collapsed .mw-collapse-chevron {
    transform: rotate(-45deg);
    top: 1px;
}
/* Content wrapper collapse/expand */
.pewc-group-content-wrapper {
    transition: max-height 0.3s ease, opacity 0.25s ease;
    overflow: hidden;
}
.pewc-group-content-wrapper.mw-collapsed {
    max-height: 0 !important;
    opacity: 0;
    overflow: hidden;
}

/* Responsive Styles */
@media screen and (max-width: 600px) {
    .mw-pppp-sidebar {
        width: 300px;
    }
}
