/* 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;
    flex-shrink: 0;
}

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

.badge {
    background: #dc3545;
    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;
    max-height: calc(100% - 80px);
}

.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: #dc3545;
    box-shadow: 0 2px 8px rgba(220,53,69,0.1);
}

.soal-item.active {
    border-color: #dc3545;
    background: #fff5f5;
}

.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;
}

.department-badge {
    background: #dc3545;
    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;
}

.kompetensi {
    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 Container */
.preview-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

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

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

.preview-actions {
    display: flex;
    gap: 10px;
}

/* EDIT FORM STYLES */
.edit-form {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.edit-form-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    min-height: 0;
}

.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 6px;
    margin-bottom: 25px;
    border-left: 4px solid #dc3545;
}

.section-title {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

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

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

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

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.1);
}

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

/* 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 .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;
}

/* PREVIEW CONTENT STYLES */
.soal-preview-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    min-height: 0;
}

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

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

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

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

/* Content Sections */
.tinjauan-section .info-grid,
.info-section .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;
}

.tujuan-content,
.skenario-content,
.tugas-kandidat-content,
.tugas-penguji-content,
.instruksi-pasien-content,
.peralatan-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    line-height: 1.6;
    font-size: 14px;
}

.gambar-content {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px dashed #ddd;
}

/* 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;
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.btn-edit {
    background: #ffc107;
    color: #212529;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-delete {
    background: #dc3545;
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Custom Scrollbar */
.soal-preview-content::-webkit-scrollbar,
.edit-form-container::-webkit-scrollbar,
.soal-items::-webkit-scrollbar {
    width: 8px;
}

.soal-preview-content::-webkit-scrollbar-track,
.edit-form-container::-webkit-scrollbar-track,
.soal-items::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.soal-preview-content::-webkit-scrollbar-thumb,
.edit-form-container::-webkit-scrollbar-thumb,
.soal-items::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.soal-preview-content::-webkit-scrollbar-thumb:hover,
.edit-form-container::-webkit-scrollbar-thumb:hover,
.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;
    }
    
    .soal-list-container {
        height: 400px;
    }
    
    .preview-container {
        height: 500px;
    }
    
    .tinjauan-section .info-grid,
    .info-section .info-grid {
        grid-template-columns: 1fr;
    }
}

@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;
    }
    
    .soal-preview-content {
        padding: 20px;
    }
    
    .edit-form-container {
        padding: 15px;
    }
    
    .form-actions {
        padding: 15px;
    }
    
    .btn-success,
    .btn-secondary {
        width: 100%;
        margin: 5px 0;
        justify-content: center;
    }
}

    /* Styles untuk Status Soal */
    .status-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 0.8em;
        font-weight: bold;
        cursor: pointer;
        transition: all 0.3s;
    }

    .status-used {
        background: #dc3545;
        color: white;
    }

    .status-unused {
        background: #28a745;
        color: white;
    }

    .status-badge:hover {
        opacity: 0.8;
        transform: scale(1.05);
    }

    .status-toggle-form {
        display: inline;
    }

    .status-toggle-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
    }

    /* Filter Status */
    .status-filter {
        display: flex;
        gap: 10px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }

    .status-filter-btn {
        padding: 8px 16px;
        border: 2px solid #667eea;
        border-radius: 20px;
        background: white;
        color: #667eea;
        cursor: pointer;
        transition: all 0.3s;
        text-decoration: none;
        font-size: 0.9em;
    }

    .status-filter-btn:hover,
    .status-filter-btn.active {
        background: #667eea;
        color: white;
    }

    .stats-container {
        background: #f8f9fa;
        border-radius: 8px;
        padding: 15px;
        margin-bottom: 20px;
        border-left: 4px solid #667eea;
    }

    .stats-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }

    .stat-item {
        text-align: center;
        padding: 10px;
        border-radius: 6px;
    }

    .stat-used {
        background: #f8d7da;
        border: 1px solid #f5c6cb;
    }

    .stat-unused {
        background: #d1ecf1;
        border: 1px solid #bee5eb;
    }

    .stat-total {
        background: #e2e3e5;
        border: 1px solid #d6d8db;
    }

    .stat-number {
        font-size: 1.5em;
        font-weight: bold;
        margin-bottom: 5px;
    }

    .stat-label {
        font-size: 0.9em;
        color: #6c757d;
    }

    /* Highlight untuk soal belum digunakan */
    .unused-row {
        background: #f0fff0 !important;
    }

    .used-row {
        background: #fff0f0 !important;
    }