/* Controls Panel */
.controls-panel {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%; /* allow stretching to match preview height */
}

.controls-panel h2 {
    font-size: 1.25rem;
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

/* Control Groups */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.control-group select,
.control-group input[type="text"],
.control-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: 'Open Sans', sans-serif;
    background: white;
    transition: border-color 0.2s ease;
}

.control-group select:focus,
.control-group input[type="text"]:focus,
.control-group input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
}

.control-group input[type="text"]::placeholder {
    color: #bdc3c7;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    font-weight: 400;
    cursor: pointer;
    /* match checkbox spacing so controls align the same way */
    padding: 4px 0;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    /* Ensure consistent text sizing so radios align predictably */
    font-size: 0.95rem;
    line-height: 1.2;
}

.radio-label:hover {
    background: #f8f9fa;
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    display: inline-block;
    -webkit-appearance: radio;
    appearance: auto;
    vertical-align: middle;
}

/* Checkbox */
.checkbox-label {
    display: inline-flex; /* keep label width natural */
    align-items: center;
    gap: 12px;
    font-weight: 400;
    cursor: pointer;
    padding: 4px 0; /* reduced padding so it lines up with other controls */
    border-radius: 4px;
    transition: background-color 0.12s ease;
}

.checkbox-label:hover {
    background: transparent; /* avoid pill background on hover */
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .controls-panel {
        padding: 15px;
    }

    .button-group {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 15px;
        margin: -15px;
        margin-top: 20px;
        border-top: 1px solid #e0e0e0;
    }
}

/* Helpers to keep buttons at bottom when controls-panel stretches */
.controls-inner {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1 1 auto;
}

.controls-actions {
    margin-top: auto;
}

/* Higher-specificity overrides: ensure radio labels inside control groups use inline-flex
   so 'gap' works (overrides the more specific '.control-group label { display: block }'). */
.control-group .radio-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.2;
}

.control-group .radio-label input[type="radio"] {
    margin: 0;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

/* Ensure checkbox labels inside control groups keep inline-flex and spacing (override .control-group label { display: block }) */
.control-group .checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
    font-weight: 400;
    font-size: 0.95rem;
    line-height: 1.2;
}

.control-group .checkbox-label input[type="checkbox"] {
    margin: 0;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}
