/* Main Content Layout - Two Column */
.main-content {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.main-content.show {
    display: flex;
}

/* Control Panel (Question Types) - Right Side */
.control-panel {
    flex: 0 0 600px;
    max-width: 500px;
    order: 2;
}

/* Chapter Panel - Left Side */
.chapter-panel {
    flex: 1;
    min-width: 400px;
    max-width: 480px;
    order: 1;
}

/* Question Types Container */
#question-types-container {
    display: flex;
    flex-direction: column; /* Vertical layout */
    gap: 20px;
    width: 100%;
    margin: 0 0 20px 0;
    padding: 0;
}

.question-types-segment {
    padding: 20px;
    border: 2px dashed #d0d0d0;
    border-radius: 10px;
    position: relative;
    transition: all 0.3s ease;
}

#segment1 {
    min-height: 100px;
}

#segment2 {
    min-height: 60px; /* Reduced height */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* When segment 2 has items, it behaves like segment 1 */
#segment2:not(.empty) {
    min-height: 100px;
    align-items: stretch;
    justify-content: flex-start;
}

.question-types-segment.drag-over {
    border-color: #5d4037;
    border-style: solid;
}

.segment-placeholder {
    color: #999;
    font-style: italic;
    text-align: center;
    font-size: 0.7em; /* Reduced font size by 30% */
    pointer-events: none; /* Make sure it doesn't interfere with drop events */
}

#question-types-container * {
    box-sizing: border-box;
}

/* Question Types Grid */
.question-types-grid {
    display: block;
}

/* Individual Question Type Card */
.question-type-card {
    background: #ffffff;
    border: 2px solid #d0d0d0;
    border-radius: 8px;
    padding: 20px 20px 15px 20px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
}

.question-type-card.dragging {
    opacity: 0.5;
    border-style: dashed;
}

.drag-handle {
    width: 24px;
    height: 24px;
    color: #999;
    margin-right: 15px;
    cursor: grab;
    display: none; /* Hidden by default */
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
}

.question-types-grid[data-draggable="true"] .drag-handle {
    display: flex;
}

.question-type-card:hover .drag-handle {
    color: #333;
}

.question-type-card.active {
    border-color: #5d4037;
    box-shadow: 0 2px 8px rgba(93, 64, 55, 0.15);
}

.question-type-card:not(.active) {
    opacity: 0.6;
    background: #f5f5f5;
}

/* Question Type Header - Main Container */
.question-type-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 20px;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}

/* Left Side: Question Type Title (60%) */
.question-type-title {
    flex: 0 0 60%;
    max-width: 60%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 0;
}

.question-type-title input[type="checkbox"],
.question-type-title .form-check-input {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.question-type-title label,
.question-type-title .form-check-label {
    font-size: 15px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* Right Side: Slider Section (35%) */
.question-type-slider-section {
    flex: 0 0 35%;
    max-width: 35%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Slider Container */
.slider-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Value Badge - Positioned above slider, moves with thumb */
.slider-value-badge {
    position: absolute;
    top: -22px; /* Position above slider track, staying within card border */
    left: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #5d4037;
    background: white;
    color: #5d4037;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 600;
    pointer-events: none;
    transition: left 0.15s ease-out;
    z-index: 10;
}

.question-type-card:not(.active) .slider-value-badge {
    border-color: #999;
    color: #999;
}

/* Hide the old badges and value displays */
.question-count-badge,
.slider-value {
    display: none !important;
}

/* Slider Input - Full Width of Container */
.slider-container input[type="range"],
.slider-container .slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 20px; /* Explicit height to match thumb for proper vertical centering */
    background: transparent;
    outline: none;
    margin: 0;
    padding: 0;
    cursor: pointer;
    position: relative;
}

.slider-container .slider:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Slider Thumb - Chrome/Safari/Edge */
.slider-container input[type="range"]::-webkit-slider-thumb,
.slider-container .slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5d4037;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    margin-top: -4px; /* Center thumb on 10px track (thumb is 18px, track is 10px, offset by (18-10)/2 = 4px) */
    transition: none; /* Prevent any size transitions */
}

/* Prevent thumb from growing on active/focus in Chrome */
.slider-container input[type="range"]:active::-webkit-slider-thumb,
.slider-container input[type="range"]:focus::-webkit-slider-thumb,
.slider-container .slider:active::-webkit-slider-thumb,
.slider-container .slider:focus::-webkit-slider-thumb {
    width: 18px;
    height: 18px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.slider-container .slider:disabled::-webkit-slider-thumb {
    background: #999;
}

/* Slider Thumb - Firefox */
.slider-container input[type="range"]::-moz-range-thumb,
.slider-container .slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5d4037;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.slider-container .slider:disabled::-moz-range-thumb {
    background: #999;
}

/* Slider Track Styling - Remove default fill/progress indicators */
/* Chrome/Safari/Edge - Track */
.slider-container input[type="range"]::-webkit-slider-runnable-track,
.slider-container .slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
}

/* Firefox - Track */
.slider-container input[type="range"]::-moz-range-track,
.slider-container .slider::-moz-range-track {
    width: 100%;
    height: 10px;
    background: #ddd;
    border-radius: 5px;
    border: none;
}

/* Firefox - Progress (filled part) - Keep same color as track to hide it */
.slider-container input[type="range"]::-moz-range-progress,
.slider-container .slider::-moz-range-progress {
    background: #ddd;
    height: 10px;
    border-radius: 5px;
}

/* IE/Edge - Fill (lower part) */
.slider-container input[type="range"]::-ms-fill-lower,
.slider-container .slider::-ms-fill-lower {
    background: #ddd;
    border-radius: 3px;
}

/* IE/Edge - Fill (upper part) */
.slider-container input[type="range"]::-ms-fill-upper,
.slider-container .slider::-ms-fill-upper {
    background: #ddd;
    border-radius: 3px;
}

/* Generation Options - Now in Chapter Panel */
.generation-options {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.btn-generate {
    width: 100%;
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-generate:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

.btn-generate:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Placeholder Text */
.placeholder-text {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-content {
        flex-direction: column;
    }
    
    .control-panel,
    .chapter-panel {
        flex: 1 1 auto;
        max-width: 100%;
        order: unset;
    }
}

@media (max-width: 768px) {
    .question-type-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .question-type-title,
    .question-type-slider-section {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
}

/* Force override any conflicting Bootstrap or global styles */
#question-types-container .question-type-card .question-type-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

#question-types-container .slider-container {
    position: relative;
    display: flex;
    flex-direction: column;
}

#question-types-container .slider {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
}
