/**
 * 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;
}

.ipb-size-layout .ipb-border-settings {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.ipb-size-layout .ipb-border-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ipb-size-layout .ipb-border-toggle,
.ipb-size-layout .ipb-border-width-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-weight: 400;
}

.ipb-size-layout .ipb-border-width-control span {
    color: #646970;
    font-size: 13px;
}

.ipb-size-layout .ipb-border-settings input[type="color"] {
    width: 48px;
    height: 40px;
    padding: 2px;
    border: 1px solid #8c8f94;
    border-radius: 2px;
    cursor: pointer;
}

/* 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%;
    }
}

