/* Layout Container */
.layout-container {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 600px;
}

/* Search Box */
.search-box {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Soal List Container */
.soal-list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.section-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.badge {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* Soal Items */
.soal-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.soal-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.soal-item:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.1);
}

.soal-item.active {
    border-color: #007bff;
    background: #f0f8ff;
}

.soal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.soal-header h4 {
    margin: 0;
    font-size: 14px;
    color: #333;
    font-weight: 600;
}

.kunci-badge {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.soal-preview {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
    margin-bottom: 8px;
}

.soal-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
}

.department {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.empty-state h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.empty-state p {
    margin: 0 0 20px 0;
}


/* Preview Content */
.soal-preview-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.preview-section {
    margin-bottom: 30px;
}


/* Content Sections */
.vignette-content,
.pertanyaan-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    line-height: 1.6;
    font-size: 14px;
}

/* Pilihan Jawaban */
.pilihan-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pilihan-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
}

.pilihan-item.kunci-jawaban {
    border-color: #28a745;
    background: #f8fff9;
}

.kunci-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
}

.info-item strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.info-content {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

/* Preview Placeholder */
.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    padding: 40px;
}

.preview-placeholder i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.preview-placeholder h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.preview-placeholder p {
    margin: 0;
    line-height: 1.5;
}


/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    #printableArea,
    #printableArea * {
        visibility: visible;
    }
    
    #printableArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .preview-actions,
    .sidebar,
    .header {
        display: none !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .layout-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .soal-list-container {
        height: 400px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .preview-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .soal-preview-content {
        padding: 20px;
    }
}



/* Soal List Container */
.soal-list-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.section-header h2 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.badge {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}


.soal-items {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    max-height: calc(100% - 80px); /* Mengurangi tinggi header */
}


/* Preview Content - PERBAIKAN UTAMA */
.soal-preview-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-height: 0; /* Penting untuk scrolling */
    height: 100%;
}

/* Content Sections */
.preview-section {
    margin-bottom: 30px;
}

.preview-section h3 {
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 8px;
    margin-bottom: 15px;
    font-size: 16px;
}

/* Header Section */
.header-section {
    text-align: center;
    padding: 20px;
    background: #f8faf9;
    border-radius: 6px;
    margin-bottom: 30px;
}

.registrasi-info {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

/* Content Sections */
.vignette-content,
.pertanyaan-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #007bff;
    line-height: 1.6;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Pilihan Jawaban */
.pilihan-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pilihan-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    position: relative;
    transition: all 0.3s ease;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.pilihan-item.kunci-jawaban {
    border-color: #28a745;
    background: #f8fff9;
}

.kunci-label {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.info-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #6c757d;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.info-item strong {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.info-content {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Preview Placeholder */
.preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    padding: 40px;
    flex: 1;
}

.preview-placeholder i {
    font-size: 64px;
    color: #ddd;
    margin-bottom: 20px;
}

.preview-placeholder h3 {
    margin: 0 0 10px 0;
    color: #333;
}

.preview-placeholder p {
    margin: 0;
    line-height: 1.5;
}

/* Custom Scrollbar untuk Webkit browsers */
.soal-preview-content::-webkit-scrollbar {
    width: 8px;
}

.soal-preview-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.soal-preview-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.soal-preview-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.soal-items::-webkit-scrollbar {
    width: 6px;
}

.soal-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.soal-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.soal-items::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    #printableArea,
    #printableArea * {
        visibility: visible;
    }
    
    #printableArea {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .preview-actions,
    .sidebar,
    .header {
        display: none !important;
    }
}

/* Responsive Design */
@media (max-width: 1024px) {
    .layout-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }
    
    .soal-list-container {
        height: 400px;
    }
    
    .preview-container {
        height: 500px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .preview-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .soal-preview-content {
        padding: 20px;
    }
    
    .layout-container {
        height: auto;
        min-height: auto;
    }
}

/* Tambahan untuk konten yang sangat panjang */
.long-content {
    max-height: none;
    overflow-y: visible;
}

/* Memastikan konten tidak melebihi container */
.soal-preview-content > * {
    max-width: 100%;
}

/* Style untuk teks yang sangat panjang */
.vignette-content,
.pertanyaan-content,
.pilihan-item,
.info-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}



/* Text Editor dalam Edit Mode */
.edit-form .text-editor {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

.edit-form .text-editor .toolbar {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.edit-form .text-editor .toolbar button {
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 12px;
    min-width: 45px;
    transition: all 0.3s ease;
}

.edit-form .text-editor .toolbar button:hover {
    background: #e9e9e9;
    border-color: #999;
}

.edit-form .text-editor .toolbar button:active {
    background: #ddd;
}

.edit-form .text-editor .rich-text {
    width: 100%;
    min-height: 150px;
    border: none;
    padding: 15px;
    font-family: inherit;
    resize: vertical;
    font-size: 14px;
    line-height: 1.6;
}

/* Character Counter */
.char-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    padding: 0 5px;
}

/* Form Actions */
.form-actions {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    flex-shrink: 0;
    margin-top: auto;
}

.btn-success {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(40,167,69,0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Custom Scrollbar untuk Edit Form */
.edit-form-container::-webkit-scrollbar {
    width: 8px;
}

.edit-form-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.edit-form-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.edit-form-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Preview Content Styles (Tetap dipertahankan) */
.soal-preview-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-height: 0;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .layout-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .soal-list-container {
        height: 400px;
    }
    
    .preview-container {
        height: 500px;
    }
    
    .edit-form-container {
        padding: 15px;
    }
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .preview-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .preview-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .form-actions {
        padding: 15px;
    }
    
    .btn-success,
    .btn-secondary {
        width: 100%;
        margin: 5px 0;
        justify-content: center;
    }
    
    .edit-form .text-editor .toolbar {
        padding: 8px;
    }
    
    .edit-form .text-editor .toolbar button {
        padding: 6px 10px;
        font-size: 11px;
        min-width: 40px;
    }
}

/* Di file CSS atau style tag */
.vignette-content,
.pertanyaan-content,
.info-content {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 5px;
    border-left: 4px solid #007bff;
    line-height: 1.6;
}

.vignette-content p,
.pertanyaan-content p,
.info-content p {
    margin-bottom: 10px;
}

.vignette-content ul,
.pertanyaan-content ul,
.info-content ul {
    margin: 10px 0;
    padding-left: 20px;
}

.vignette-content li,
.pertanyaan-content li,
.info-content li {
    margin-bottom: 5px;
}

.vignette-content img,
.pertanyaan-content img,
.info-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.preview-section {
    margin-bottom: 25px;
    page-break-inside: avoid;
}

.preview-section h3 {
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

/* Style untuk edit mode */
.edit-form-container {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 10px;
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.section-title {
    color: #2c3e50;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-group {
    margin-bottom: 20px;
}

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

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    border-color: #007bff;
    outline: none;
}

/* Text Editor Styles */
.text-editor {
    border: 2px solid #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    background: white;
}

.text-editor .toolbar {
    background: #f8f9fa;
    padding: 8px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.text-editor .toolbar button,
.text-editor .toolbar select {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.text-editor .toolbar button:hover,
.text-editor .toolbar select:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.rich-text[contenteditable="true"] {
    min-height: 150px;
    padding: 15px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    overflow-y: auto;
    background: white;
}

.rich-text[contenteditable="true"]:focus {
    outline: none;
}

.rich-text[contenteditable="true"] img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 10px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.char-counter {
    font-size: 12px;
    color: #6c757d;
    text-align: right;
    padding: 5px 10px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

/* Form Actions */
.form-actions {
    position: sticky;
    bottom: 0;
    background: white;
    padding: 20px;
    border-top: 1px solid #e9ecef;
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Style untuk readonly fields */
input[readonly] {
    background-color: #f8f9fa !important;
    color: #6c757d !important;
    cursor: not-allowed !important;
    border-color: #e9ecef !important;
}

input[readonly]:focus {
    border-color: #e9ecef !important;
    box-shadow: none !important;
}

.form-text.text-muted {
    font-size: 12px;
    margin-top: 5px;
    color: #6c757d;
}

/* Style untuk form sections */
.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.section-title {
    color: #2c3e50;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
}
.readonly-field {
    padding: 10px 12px;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    color: #2c3e50;
    font-size: 14px;
    min-height: 42px;
    display: flex;
    align-items: center;
}


