/* Worksheet Canvas Builder Styles */
@font-face {
    font-family: 'Kalimati';
    src: url('../../fonts/Kalimati-Regular.otf') format('opentype'),
         url('../../fonts/Kalimati-Bold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}
@font-face {
    font-family: 'Kalimati';
    src: url('../../fonts/Kalimati-Bold.ttf') format('truetype');
    font-weight: bold;
    font-style: normal;
}
@font-face {
    font-family: 'Kalimati';
    src: url('../../fonts/Kalimati-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

.builder-wrapper, .builder-card, .paper-sheet, .modal-body, .preview-content, .paper-preview-container, .q-table { 
    font-family: 'Kalimati', 'Noto Sans Devanagari', 'Mukta', 'Poppins', 'Mangal', sans-serif;
    font-feature-settings: "liga" 1, "clig" 1, "calt" 1;
    -webkit-font-smoothing: antialiased;
}

#paper_preview_sheet.ne-mode, #paper_preview_sheet.ne-mode * {
    font-family: 'Kalimati', sans-serif !important;
}
.builder-wrapper { display: flex; flex-direction: column; min-height: calc(100vh - 80px); background: #f8fafc; margin: 0; border-radius: 12px; overflow: hidden; }

/* Progress Header */
.builder-header { background: #fff; padding: 20px 30px; border-bottom: 1px solid #e2e8f0; display: flex; flex-direction: column; align-items: center; }
.builder-title { font-size: 20px; font-weight: 700; color: #1e293b; margin-bottom: 25px; width: 100%; text-align: left; }

.progress-tracker { display: flex; align-items: center; justify-content: center; width: 80%; max-width: 800px; margin: 0 auto; position: relative; }
.progress-step { display: flex; flex-direction: column; align-items: center; position: relative; z-index: 2; flex: 1; cursor: pointer; user-select: none; }
.step-circle { width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 2px solid #cbd5e1; color: #64748b; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; margin-bottom: 8px; transition: all 0.3s; }
.step-label { font-size: 12px; font-weight: 500; color: #64748b; transition: color 0.3s; }
.progress-line { position: absolute; top: 16px; left: 10%; right: 10%; height: 2px; background: #e2e8f0; z-index: 1; }

.progress-step:hover .step-circle { border-color: #032da1; color: #032da1; transform: scale(1.05); }
.progress-step:hover .step-label { color: #032da1; }
.progress-step.active .step-circle { border-color: #032da1; color: #032da1; }
.progress-step.active .step-label { color: #032da1; font-weight: 600; }
.progress-step.completed .step-circle { background: #032da1; border-color: #032da1; color: #fff; }

/* Main Content Area */
.builder-content { padding: 30px; flex: 1; display: flex; justify-content: center; }
.step-container { display: none; width: 100%; max-width: 1200px; animation: fadeIn 0.3s ease-in-out; }
.step-container.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Shared Card Form Styles */
.builder-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); padding: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 25px; }
.form-group { display: flex; flex-direction: column; }
.form-group label { font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 8px; }
.form-group label span.required { color: #ef4444; }
.form-control { height: 42px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 12px; font-size: 13px; color: #1e293b; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: #032da1; box-shadow: 0 0 0 3px rgba(3, 45, 161, 0.1); }
textarea.form-control { height: auto; min-height: 80px; padding: 12px; }
.form-select { appearance: none; background: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e") no-repeat right 12px center; background-size: 14px; background-color: #fff; padding-right: 35px; cursor: pointer; }
.form-select:hover { cursor: pointer; }

/* Custom Checkbox/Switch */
.toggle-group { display: flex; align-items: center; gap: 10px; margin-top: 20px; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: #032da1; }
input:checked + .slider:before { transform: translateX(20px); }
.toggle-label { font-size: 13px; font-weight: 500; color: #475569; }

/* Footer Actions */
.builder-footer { margin-top: 30px; display: flex; justify-content: flex-end; gap: 15px; }
.builder-footer.split { justify-content: space-between; }
.btn-next { background: #032da1; color: #fff; border: none; padding: 12px 24px; border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.btn-next:hover { background: #1e40af; box-shadow: 0 4px 6px -1px rgba(29, 78, 216, 0.3); }
.btn-back { background: #fff; border: 1px solid #e2e8f0; color: #64748b; padding: 12px 24px; border-radius: 6px; font-weight: 600; font-size: 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.2s; }
.btn-back:hover { background: #f8fafc; color: #1e293b; }

/* Step 2 Specific (Three Column Grid) */
.grid-cols-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; }
.settings-section { border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; background: #fafafa; }
.settings-section h4 { font-size: 14px; font-weight: 600; color: #1e293b; margin: 0 0 15px 0; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; }

/* Step 3 Layout (Add Questions) */
.step-3-layout { display: flex; gap: 25px; align-items: flex-start; }
.library-sidebar { width: 280px; flex-shrink: 0; }
.canvas-area { flex: 1; }

/* Library Styles */
.library-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; padding: 15px; }
.btn-add-qt { width: 100%; background: #032da1; color: #fff; border: none; padding: 10px; border-radius: 6px; font-weight: 600; font-size: 12px; margin-bottom: 15px; display: flex; justify-content: center; align-items: center; gap: 8px; cursor: pointer; }
.btn-add-qt:hover { background: #1e40af; }
.qt-list-group { 
    display: flex; 
    flex-direction: column; 
    gap: 8px; 
    max-height: 480px; 
    overflow-y: auto; 
    padding-right: 6px; 
    scrollbar-width: thin; 
    scrollbar-color: #cbd5e1 #f8fafc; 
}
.qt-list-group::-webkit-scrollbar { 
    width: 5px; 
}
.qt-list-group::-webkit-scrollbar-track { 
    background: #f8fafc; 
    border-radius: 4px; 
}
.qt-list-group::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 4px; 
}
.qt-list-group::-webkit-scrollbar-thumb:hover { 
    background: #94a3b8; 
}
.qt-list-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; transition: all 0.2s; background: #fff; }
.qt-list-item:hover { border-color: #032da1; background: #f8fafc; }
.qt-icon-name { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; color: #334155; }
.qt-icon-name i { color: #64748b; width: 16px; text-align: center; }
.qt-badge { font-size: 11px; font-weight: 600; color: #032da1; background: #eff6ff; padding: 2px 6px; border-radius: 10px; }

/* Canvas Styles */
.canvas-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.canvas-header h3 { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0; }
.canvas-stats { display: flex; gap: 15px; }
.stat-box { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px; padding: 10px 20px; display: flex; flex-direction: column; align-items: center; }
.stat-box span.val { font-size: 18px; font-weight: 700; color: #032da1; }
.stat-box span.lbl { font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; }

.questions-table-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; }
.q-table { width: 100%; border-collapse: collapse; }
.q-table th { background: #f8fafc; padding: 12px 15px; text-align: left; font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; border-bottom: 1px solid #e2e8f0; }
.q-table td { padding: 15px; border-bottom: 1px solid #f1f5f9; font-size: 13px; color: #334155; vertical-align: middle; }
.q-table tr:last-child td { border-bottom: none; }
.q-snippet { max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.q-table td:nth-child(2) { text-align: left; }
.q-type-badge { display: inline-block; padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; background: #eff6ff; color: #032da1; }
.q-actions { display: flex; gap: 8px; justify-content: center; }
.q-btn { width: 28px; height: 28px; border-radius: 4px; border: 1px solid #e2e8f0; background: #fff; color: #64748b; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.q-btn.edit:hover { color: #032da1; border-color: #032da1; background: #eff6ff; }
.q-btn.delete:hover { color: #ef4444; border-color: #ef4444; background: #fef2f2; }
.empty-canvas { padding: 60px 20px; text-align: center; color: #94a3b8; }
.empty-canvas i { font-size: 48px; margin-bottom: 15px; opacity: 0.5; }
.empty-canvas p { font-size: 14px; margin: 0; }

/* Modal Styles */
.builder-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6); z-index: 1000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.builder-modal { background: #fff; width: 96%; max-width: 1440px; max-height: 94vh; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; transform: translateY(20px); transition: all 0.3s; }
.builder-modal.open { transform: translateY(0); }
.modal-header { padding: 18px 25px; border-bottom: 1px solid #e2e8f0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { margin: 0; font-size: 18px; font-weight: 700; color: #1e293b; }
.btn-close { background: none; border: none; font-size: 20px; color: #94a3b8; cursor: pointer; }
.modal-body { padding: 25px; overflow-y: auto; display: flex; gap: 30px; }
.modal-form-area { flex: 1.15; min-width: 0; }
.modal-preview-area { flex: 1.05; min-width: 0; background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 20px; }
.modal-preview-area h4 { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; margin: 0 0 15px 0; }
.preview-content { background: #fff; padding: 20px; border: 1px solid #e2e8f0; min-height: 200px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.modal-footer { padding: 15px 25px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 10px; background: #f8fafc; }

/* Step 5 Preview */
.paper-preview-container { background: #e2e8f0; padding: 40px; border-radius: 12px; display: flex; justify-content: center; }
.paper-sheet { background: #fff; width: 100%; max-width: 800px; min-height: 1056px; padding: 50px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); }
.paper-header { text-align: center; border-bottom: 2px solid #1e293b; padding-bottom: 20px; margin-bottom: 30px; position: relative; }
.paper-header h2 { font-size: 20px; font-weight: 700; margin: 0 0 5px 0; }
.paper-header p.instructions { font-size: 13px; font-style: italic; color: #475569; margin: 0; }
.paper-meta { position: absolute; right: 0; top: 0; text-align: right; font-size: 12px; font-weight: 600; }
.paper-questions-list { font-size: 16px; line-height: 1.6; }
.paper-q-item { margin-bottom: 25px; display: flex; }
.paper-q-num { font-weight: 700; margin-right: 15px; }
.paper-q-body { flex: 1; }
.paper-q-marks { font-weight: 600; font-size: 12px; margin-left: 15px; }

/* Step 6 Success */
.success-container { text-align: center; padding: 60px 20px; }
.success-icon { width: 80px; height: 80px; border-radius: 50%; background: #dcfce7; color: #22c55e; display: flex; align-items: center; justify-content: center; font-size: 36px; margin: 0 auto 20px; }
.success-container h2 { font-size: 24px; font-weight: 700; color: #1e293b; margin-bottom: 10px; }
.success-container p { color: #64748b; margin-bottom: 30px; }
.success-details { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; max-width: 600px; margin: 0 auto 30px; padding: 30px; text-align: left; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-item { display: flex; flex-direction: column; }
.detail-item span.lbl { font-size: 12px; color: #64748b; margin-bottom: 4px; }
.detail-item span.val { font-size: 14px; font-weight: 600; color: #1e293b; }
.success-actions { display: flex; justify-content: center; gap: 15px; }
