/**
 * File: quiz-builder.css
 * Directory: /assets/css/
 * Quiz Builder Custom Styles - Advanced Three-Panel Layout
 */

/* Quiz Builder Container */
.quiz-builder-container {
    height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

/* Top Header Bar */
.quiz-header {
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
}

.quiz-info h4 {
    margin: 0;
    color: #495057;
    font-weight: 600;
}

.quiz-info small {
    color: #6c757d;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.quiz-stats {
    display: flex;
    gap: 0.5rem;
}

.quiz-stats .badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
}

/* Three Panel Layout */
.quiz-panels {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 1px;
    background-color: #e9ecef;
}

.panel {
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

.panel-left {
    width: 300px;
    min-width: 250px;
    max-width: 400px;
    border-right: 1px solid #e9ecef;
}

.panel-center {
    flex: 1;
    min-width: 400px;
    border-right: 1px solid #e9ecef;
}

.panel-right {
    width: 350px;
    min-width: 300px;
    max-width: 450px;
}

/* Panel Headers */
.panel-header {
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-header h6 {
    margin: 0;
    color: #495057;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Panel Bodies */
.panel-body {
    flex: 1;
    overflow: auto;
    padding: 1rem;
}

.panel-left .panel-body {
    padding: 0.5rem;
}

/* Question List (Left Panel) */
.questions-list {
    min-height: 100%;
}

.question-item {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.question-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
    transform: translateY(-1px);
}

.question-item.active {
    border-color: #007bff;
    background-color: #e3f2fd;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.question-item .drag-handle {
    position: absolute;
    left: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #adb5bd;
    cursor: grab;
    padding: 0.25rem;
}

.question-item .drag-handle:hover {
    color: #6c757d;
}

.question-number {
    font-weight: 600;
    color: #007bff;
    font-size: 0.875rem;
}

.question-preview {
    font-size: 0.875rem;
    color: #495057;
    margin: 0.25rem 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.question-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.question-type-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
}

.question-points {
    font-size: 0.75rem;
    color: #6c757d;
}

/* Question Editor (Center Panel) */
.question-editor {
    height: 100%;
}

.editor-empty-state {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #6c757d;
}

.question-form {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.question-form .form-group {
    margin-bottom: 1rem;
}

.question-form .form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.question-text-input {
    min-height: 100px;
    resize: vertical;
}

.options-container {
    flex: 1;
    overflow: auto;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    background: #f8f9fa;
}

.option-item.correct {
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.option-checkbox {
    flex-shrink: 0;
}

.option-text {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.25rem;
    font-size: 0.875rem;
}

.option-text:focus {
    outline: none;
    background: #fff;
    border-radius: 0.25rem;
}

.option-controls {
    display: flex;
    gap: 0.25rem;
}

.btn-option {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

/* Live Preview (Right Panel) */
.quiz-preview {
    height: 100%;
    overflow: auto;
}

.preview-question {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.preview-question-text {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #495057;
}

.preview-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.15s ease;
}

.preview-option:hover {
    background-color: #e9ecef;
}

.preview-option input {
    margin: 0;
}

/* Quiz Settings Panel */
.quiz-settings {
    background: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
}

.quiz-settings h6 {
    margin-bottom: 1rem;
    color: #495057;
    font-weight: 600;
}

.settings-group {
    margin-bottom: 1rem;
}

.settings-group:last-child {
    margin-bottom: 0;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: #6c757d;
}

.empty-state i {
    margin-bottom: 1rem;
}

.empty-state h6 {
    margin-bottom: 0.5rem;
    color: #6c757d;
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* Templates */
.template-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #e9ecef;
}

.template-card:hover {
    border-color: #007bff;
    box-shadow: 0 4px 12px rgba(0,123,255,0.15);
    transform: translateY(-2px);
}

.template-stats {
    padding-top: 0.5rem;
    border-top: 1px solid #e9ecef;
    margin-top: 0.5rem;
}

/* Sortable Placeholder */
.ui-sortable-placeholder {
    background: #e3f2fd;
    border: 2px dashed #007bff;
    border-radius: 0.5rem;
    height: 80px;
    margin-bottom: 0.5rem;
}

.ui-sortable-helper {
    transform: rotate(2deg);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Question Controls */
.question-controls {
    display: flex;
    gap: 0.25rem;
}

/* Form Controls Enhancements */
.form-control:focus,
.form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .panel-right {
        width: 300px;
        min-width: 250px;
    }
    
    .panel-left {
        width: 250px;
        min-width: 200px;
    }
}

@media (max-width: 992px) {
    .quiz-panels {
        flex-direction: column;
    }
    
    .panel {
        width: 100% !important;
        min-width: auto !important;
        max-width: none !important;
    }
    
    .panel-left,
    .panel-right {
        height: 250px;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .panel-center {
        flex: 1;
        border-right: none;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .quiz-actions {
        justify-content: space-between;
    }
}

@media (max-width: 768px) {
    .quiz-header {
        padding: 0.75rem;
    }
    
    .panel-body {
        padding: 0.75rem;
    }
    
    .panel-left .panel-body {
        padding: 0.25rem;
    }
    
    .question-item {
        padding: 0.5rem;
    }
    
    .quiz-stats {
        flex-wrap: wrap;
    }
    
    .quiz-stats .badge {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .quiz-builder-container {
        background-color: #212529;
    }
    
    .quiz-header,
    .panel,
    .question-item {
        background-color: #343a40;
        border-color: #495057;
        color: #fff;
    }
    
    .panel-header {
        background-color: #495057;
    }
    
    .quiz-preview,
    .quiz-settings {
        background-color: #495057;
    }
    
    .preview-question {
        background-color: #6c757d;
        border-color: #adb5bd;
    }
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.question-item {
    animation: fadeIn 0.3s ease;
}

.preview-question {
    animation: slideIn 0.3s ease;
}

/* Accessibility enhancements */
.question-item:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.5);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .question-item {
        border-width: 2px;
    }
    
    .question-item.active {
        border-width: 3px;
    }
    
    .btn {
        border-width: 2px;
    }
}