/**
 * Size & Layout Settings Styles
 *
 * Styles for the Size & Layout Settings section in popup editor
 * Scoped to .ipb-size-layout to avoid affecting other sections
 */

/* Size & Layout Settings Section - 2-Column Layout */
.ipb-size-layout {
    text-align: left;
}

.ipb-size-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 16px;
}

.ipb-size-row:last-child {
    margin-bottom: 0;
}

.ipb-size-label {
    align-self: center;
    text-align: left;
}

.ipb-size-label label {
    font-size: 14px;
    font-weight: 500;
    color: #1d2327;
    margin: 0;
    line-height: 1.4;
    text-align: left;
}

.ipb-size-control {
    display: flex;
    flex-direction: column;
    gap: 0;
    align-self: center;
    text-align: left;
}

.ipb-size-control .regular-text {
    width: 100%;
    max-width: 100%;
}

/* Match Select Background horizontal sizing */
.ipb-size-layout #design_percentage_toggle.regular-text {
    width: 50%;
    max-width: 50%;
}

.ipb-size-layout #design_percentage {
    width: calc(50% - 92px) !important;
    flex: 0 0 calc(50% - 92px) !important;
}

.ipb-size-helper {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #646970;
    line-height: 1.4;
    text-align: left;
}

/* Input Styles */
.ipb-size-layout input[type="number"] {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #8c8f94;
    border-radius: 2px;
    font-size: 14px;
    color: #2c3338;
    background-color: #fff;
    transition: border-color 0.15s ease-in-out;
}

.ipb-size-layout input[type="number"]:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

.ipb-size-layout select.regular-text {
    height: 40px;
    padding: 0 12px;
    border: 1px solid #8c8f94;
    border-radius: 2px;
    font-size: 14px;
    color: #2c3338;
    background-color: #fff;
}

.ipb-size-layout select.regular-text:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Range Slider Styles */
.ipb-size-layout input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.ipb-size-layout input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2271b1;
    cursor: pointer;
}

.ipb-size-layout input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2271b1;
    cursor: pointer;
    border: none;
}

.ipb-size-layout input[type="range"]:focus {
    outline: none;
}

.ipb-size-layout input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

.ipb-size-layout input[type="range"]:focus::-moz-range-thumb {
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.2);
}

/* Lock Button Styles */
.ipb-size-layout #lock_aspect_ratio_btn {
    flex-shrink: 0;
}

.ipb-size-layout #lock_aspect_ratio_btn:hover {
    background: #f0f0f1;
    border-color: #2271b1;
}

.ipb-size-layout #lock_aspect_ratio_btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Detect Button Styles */
.ipb-size-layout #detect_popup_size_btn {
    margin: 0;
}

.ipb-size-layout #detect_size_status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Section Wrappers */
.ipb-size-fixed-section,
.ipb-size-percentage-section {
    margin-top: 0;
}

/* Responsive Adjustments */
@media (max-width: 782px) {
    .ipb-size-layout #design_percentage_toggle.regular-text {
        width: 100%;
        max-width: 100%;
    }

    .ipb-size-layout #design_percentage {
        width: 100% !important;
        flex: 1 1 auto !important;
    }

    .ipb-size-row {
        grid-template-columns: 1fr;
        gap: 8px;
        align-items: flex-start;
    }
    
    .ipb-size-label {
        align-self: flex-start;
    }
    
    .ipb-size-control {
        align-self: flex-start;
    }
    
    /* Stack slider and numeric input on mobile */
    .ipb-size-control > div[style*="display: flex"] {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ipb-size-control input[type="range"] {
        width: 100%;
    }
    
    .ipb-size-control input[type="number"] {
        width: 100%;
    }
}

/* Advanced subsection (Z-index) — collapsible, aligned with closing-tab pattern */
.ipb-size-layout .ipb-size-collapsible-subsection {
    margin-top: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.ipb-size-layout .ipb-size-collapsible-subsection__summary {
    list-style: none;
    cursor: pointer;
    margin: 0;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #1e1f21;
}

.ipb-size-layout .ipb-size-collapsible-subsection__summary::-webkit-details-marker {
    display: none;
}

.ipb-size-layout .ipb-size-collapsible-subsection__summary::after {
    content: "\25BE";
    font-size: 12px;
    color: #646970;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.ipb-size-layout .ipb-size-collapsible-subsection[open] .ipb-size-collapsible-subsection__summary::after {
    transform: rotate(180deg);
}

.ipb-size-layout .ipb-size-collapsible-subsection__body {
    padding: 0 16px 16px;
    border-top: 1px solid #f0f0f1;
}

.ipb-size-layout .ipb-size-collapsible-subsection__body .ipb-zindex-settings {
    margin-top: 12px;
}
