/* Form Builder Styles */
.form-builder {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.form-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.form-item {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    position: relative;
    cursor: move;
}

.form-item.dragging {
    opacity: 0.5;
    border: 2px dashed #3b82f6;
}

.form-item.drag-over {
    border: 2px dashed #10b981;
}

.item-number {
    font-size: 18px;
    color: #1e3a8a;
    margin-bottom: 15px;
}

.delete-btn {
    position: absolute;
    top: -15px;
    right: 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.delete-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.edit-btn {
    background: #3b82f6;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.edit-btn:hover {
    background: #2563eb;
}

/* Table Styles */
.custom-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.custom-table th,
.custom-table td {
    border: 1px solid #cbd5e1;
    padding: 10px;
    text-align: center;
}

.custom-table th {
    background: #1e3a8a;
    color: white;
    text-align: center;
}

.custom-table th input {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    text-align: center;
    width: 100%;
    font-family: 'B Titr', 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-weight: bold;
}

.custom-table th input:focus {
    outline: none;
    border-bottom: 1px solid #fbbf24;
}

.custom-table td input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: 'B Titr', 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 14px;
    text-align: center;
    direction: ltr;
}

.custom-table td input:focus {
    outline: none;
    border-color: #3b82f6;
}

.add-row-btn,
.add-col-btn,
.remove-row-btn,
.remove-col-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin: 4px;
    transition: all 0.3s;
}

.add-row-btn,
.add-col-btn {
    background: #10b981;
    color: white;
}

.add-row-btn:hover,
.add-col-btn:hover {
    background: #059669;
}

.remove-row-btn,
.remove-col-btn {
    background: #ef4444;
    color: white;
}

.remove-row-btn:hover,
.remove-col-btn:hover {
    background: #dc2626;
}

/* Question Styles */
.question-text {
    font-size: 18px;
    color: #334155;
    margin-bottom: 15px;
}

.question-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.question-row .blank-text-item {
    flex: 1;
}

.yes-no-options {
    display: flex;
    gap: 20px;
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-group input[type="radio"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-group label {
    cursor: pointer;
    font-size: 18px;
}

.description-section {
    margin-top: 15px;
}

.add-description-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s;
}

.add-description-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.description-content {
    display: none;
    margin-top: 10px;
    padding: 15px;
    background: #f1f5f9;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.description-content.active {
    display: block;
}

.description-label {
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 8px;
    font-size: 14px;
}

.description-textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
}

.description-textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.clear-description-btn {
    margin-top: 8px;
    padding: 6px 12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
}

.clear-description-btn:hover {
    background: #dc2626;
}

/* Choice Modal */
.choice-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-top: 20px;
}

.choice-btn {
    padding: 15px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

/* Table Dimension Modal */
.dimension-inputs {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.dimension-input {
    flex: 1;
}

.dimension-input label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: bold;
}

.dimension-input input {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.9);
}

/* Question Input Modal */
.question-input-group {
    margin-top: 20px;
}

.question-input-group label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: bold;
}

.question-input-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    font-size: 18px;
    background: rgba(255, 255, 255, 0.9);
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    min-height: 80px;
}

.hidden {
    display: none !important;
}

/* Text Item Styles */
.text-item {
    font-size: 18px;
    color: #334155;
    line-height: 1.8;
    white-space: pre-wrap;
    position: relative;
    padding-right: 25px;
}

.text-item.numbered {
    padding-right: 0;
}

.text-item:not(.numbered)::before {
    content: '•';
    position: absolute;
    right: 5px;
    color: #334155;
    font-size: 18px;
}

.text-item p {
    margin: 0;
    padding: 0;
    display: inline;
}

.text-item input {
    display: inline-block;
    vertical-align: middle;
}

.edit-text-btn {
    position: absolute;
    top: -15px;
    left: 10px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    display: none;
}

.text-item:hover .edit-text-btn {
    display: block;
}

.edit-text-btn:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.text-editor-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: #f1f5f9;
    border-radius: 8px;
}

.toolbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 5px;
    background: white;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.toolbar-btn:hover {
    background: #e2e8f0;
    transform: scale(1.05);
}

.toolbar-btn.active {
    background: #3b82f6;
    color: white;
}

.text-editor-container {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    background: white;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
    padding: 40px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.modal-header h2 {
    color: white;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: white;
    transition: color 0.3s;
}

.close-btn:hover {
    color: #ddd;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: white;
    font-weight: bold;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 18px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s ease;
    outline: none;
    direction: ltr;
    text-align: left;
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.form-group select {
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-group textarea {
    border-radius: 5px;
    resize: vertical;
    min-height: 120px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #ddd;
    color: #333;
}

.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.submit-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.submit-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.submit-btn:active {
    transform: translateY(0);
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #64748b;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #ef4444;
}

.save-btn,
.cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    transition: all 0.3s;
}

.save-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.cancel-btn {
    background: #ef4444;
    color: white;
}

.cancel-btn:hover {
    background: #dc2626;
}

/* Table with Description Styles */
.table-with-desc-title {
    font-size: 18px;
    font-weight: bold;
    color: #1e3a8a;
    margin-bottom: 15px;
    text-align: center;
}

.table-with-desc {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.table-with-desc th,
.table-with-desc td {
    border: 1px solid #cbd5e1;
    padding: 10px;
    text-align: center;
}

.table-with-desc th:first-child,
.table-with-desc th:nth-child(2),
.table-with-desc td:first-child,
.table-with-desc td:nth-child(2) {
    width: 2px;
    padding: 0;
    border: none;
    opacity: 0.3;
    transition: all 0.2s ease;
}

.table-with-desc tr:hover td:first-child,
.table-with-desc tr:hover td:nth-child(2) {
    width: 40px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    opacity: 1;
}

.table-with-desc tr:hover th:first-child,
.table-with-desc tr:hover th:nth-child(2) {
    width: 40px;
    padding: 10px;
    border: 1px solid #cbd5e1;
    opacity: 1;
}

.table-with-desc .add-desc-btn {
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.table-with-desc tr:hover .add-desc-btn {
    opacity: 1;
}

.table-with-desc th {
    background: #1e3a8a;
    color: white;
}

.table-with-desc th input {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    text-align: center;
    width: 100%;
    font-family: 'B Titr', 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-weight: bold;
}

.table-with-desc th input:focus {
    outline: none;
    border-bottom: 1px solid #fbbf24;
}

.table-with-desc td input {
    width: 100%;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: 'B Titr', 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 14px;
    text-align: center;
}

.table-with-desc td input:focus {
    outline: none;
    border-color: #3b82f6;
}

.description-row {
    display: none;
    background: #f1f5f9;
}

.description-row.active {
    display: table-row;
    background: #f1f5f9;
}

.description-row td {
    padding: 0;
    border: none;
}

.description-row.active td {
    padding: 10px;
    border: 1px solid #cbd5e1;
}

.desc-textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
    resize: vertical;
    min-height: 40px;
    color: #334155;
    background: white;
}

.table-description {
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 12px;
    font-weight: bold;
}

.desc-textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.add-desc-btn {
    background: #10b981;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.add-desc-btn:hover {
    background: #059669;
}

/* Blank Text Styles */
.blank-text-item {
    font-size: 18px;
    color: #334155;
    line-height: 2;
    font-weight: bold;
    flex: 1;
}

.blank-text-item p {
    margin: 0;
    padding: 0;
    display: inline;
}

.blank-text-item input {
    display: inline-block;
    vertical-align: middle;
}

.blank-input {
    display: inline-block;
    width: 80px;
    padding: 5px 10px;
    border: 2px solid #3b82f6;
    border-radius: 4px;
    font-size: 18px;
    text-align: center;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    margin: 0 5px;
}

.blank-input:focus {
    outline: none;
    border-color: #2563eb;
}

/* Text Editor Styles */
.text-editor {
    padding: 20px;
    min-height: 200px;
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif;
    font-size: 18px;
    line-height: 1.8;
    outline: none;
    white-space: pre-wrap;
}

.text-editor:focus {
    border-color: #3b82f6;
}

.text-editor *,
.text-editor p,
.text-editor span,
.text-editor div {
    font-family: 'B Nazanin', 'Tahoma', 'Arial', sans-serif !important;
    font-size: 18px !important;
    line-height: 27px !important;
}

.modal-content .question-input-group {
    margin-top: 15px;
}

.modal-content .submit-btn {
    margin-top: 20px;
}
