/**
 * Position Settings Styles
 *
 * Styles for the Position Settings section in popup editor
 * Scoped to .ipb-position-settings to avoid affecting other sections
 */

/* Position Settings Section - 2-Column Layout */
.ipb-position-settings {
    text-align: left;
}

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

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

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

.ipb-position-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: center;
    text-align: left;
}

/* Position Grid - Compact 3x3 Button Layout */
.ipb-position-grid {
    display: grid;
    grid-template-columns: repeat(3, 36px);
    grid-template-rows: repeat(3, 36px);
    gap: 8px;
    width: fit-content;
    padding: 0;
    margin: 0;
}

/* Position Cell - Compact Button Style */
.ipb-position-cell {
    position: relative;
    width: 36px;
    height: 36px;
    margin: 0;
}

.ipb-position-cell input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    z-index: 2;
}

.ipb-position-cell-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 1.5px solid #c3c4c7;
    border-radius: 6px;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    position: relative;
}

/* Center Dot Indicator */
.ipb-position-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #c3c4c7;
    opacity: 0.4;
    transition: opacity 0.15s ease-in-out;
}

/* Hover State */
.ipb-position-cell:hover .ipb-position-cell-label {
    border-color: #2271b1;
    background-color: #f0f6fc;
}

.ipb-position-cell:hover .ipb-position-dot {
    background-color: #2271b1;
    opacity: 0.6;
}

/* Focus State - Keyboard Accessibility */
.ipb-position-cell input[type="radio"]:focus + .ipb-position-cell-label {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
    border-color: #2271b1;
}

/* Selected State */
.ipb-position-cell input[type="radio"]:checked + .ipb-position-cell-label {
    border-color: #2271b1;
    background-color: #f0f6fc;
    box-shadow: 0 0 0 1px #2271b1 inset;
}

.ipb-position-cell input[type="radio"]:checked + .ipb-position-cell-label .ipb-position-dot {
    background-color: #2271b1;
    opacity: 1;
    width: 8px;
    height: 8px;
}

/* Selected State with Check Icon (Alternative) */
.ipb-position-cell input[type="radio"]:checked + .ipb-position-cell-label::after {
    content: '';
    position: absolute;
    top: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #2271b1;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.5 1L3 4.5 1.5 3l-1 1L3 6.5l5-5z'/%3E%3C/svg%3E");
    background-size: 8px 8px;
    background-position: center;
    background-repeat: no-repeat;
}

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

/* Responsive Adjustments */
@media (max-width: 782px) {
    .ipb-position-row {
        grid-template-columns: 1fr;
        gap: 8px;
        align-items: flex-start;
    }
    
    .ipb-position-label {
        align-self: flex-start;
    }
    
    .ipb-position-control {
        align-self: flex-start;
    }
    
    .ipb-position-grid {
        grid-template-columns: repeat(3, 32px);
        grid-template-rows: repeat(3, 32px);
        gap: 6px;
    }
    
    .ipb-position-cell {
        width: 32px;
        height: 32px;
    }
}
