/* ============================================================================
   Survey Edit Modal - نافذة تعديل الاستبيان
   تصميم احترافي لتعديل الاستبيانات
   ============================================================================ */

/* Modal Container */
.survey-edit-modal {
    width: 900px;
    max-width: 95vw;
    max-height: 90vh;
}

.survey-edit-modal .modal-body {
    padding: 0;
    display: flex;
    flex-direction: column;
    max-height: calc(90vh - 140px);
}

/* Tabs Navigation */
.survey-edit-tabs {
    display: flex;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.08), rgba(61, 143, 214, 0.04));
    border-bottom: 1px solid rgba(61, 143, 214, 0.15);
    padding: 0;
    gap: 0;
}

.survey-edit-tab {
    flex: 1;
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
}

.survey-edit-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.3s ease;
}

.survey-edit-tab:hover {
    background: rgba(61, 143, 214, 0.08);
    color: var(--color-primary-light, #3d8fd6);
}

.survey-edit-tab.active {
    color: var(--color-primary-light, #3d8fd6);
    background: rgba(61, 143, 214, 0.1);
}

.survey-edit-tab.active::after {
    background: linear-gradient(90deg, var(--color-primary-light, #3d8fd6), var(--color-primary, #274060));
}

.survey-edit-tab i {
    font-size: 1rem;
}

/* Tab Content */
.survey-edit-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.survey-edit-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.survey-edit-panel.active {
    display: block;
}

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

/* Form Sections */
.edit-form-section {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: rgba(248, 249, 250, 0.5);
    border-radius: var(--radius-md, 12px);
    border: 1px solid rgba(61, 143, 214, 0.1);
}

.edit-form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-primary, #274060);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-form-section-title i {
    color: var(--color-primary-light, #3d8fd6);
}

/* Form Grid */
.edit-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.edit-form-grid.single-column {
    grid-template-columns: 1fr;
}

@media (max-width: 768px) {
    .edit-form-grid {
        grid-template-columns: 1fr;
    }
}

/* Form Group */
.edit-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.edit-form-group.full-width {
    grid-column: 1 / -1;
}

.edit-form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-primary, #274060);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.edit-form-label .required {
    color: var(--color-danger, #ef4444);
}

.edit-form-input,
.edit-form-select,
.edit-form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(61, 143, 214, 0.25);
    border-radius: var(--radius-sm, 8px);
    background: white;
    color: var(--text-primary, #274060);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.3s ease;
    outline: none;
}

.edit-form-input:focus,
.edit-form-select:focus,
.edit-form-textarea:focus {
    border-color: var(--color-primary-light, #3d8fd6);
    box-shadow: 0 0 0 3px rgba(61, 143, 214, 0.15);
}

.edit-form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* Questions List */
.edit-questions-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.edit-question-item {
    background: white;
    border: 1px solid rgba(61, 143, 214, 0.15);
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    transition: all 0.3s ease;
}

.edit-question-item:hover {
    box-shadow: 0 4px 12px rgba(61, 143, 214, 0.1);
    border-color: rgba(61, 143, 214, 0.25);
}

.edit-question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.9), rgba(230, 240, 249, 0.7));
    border-bottom: 1px solid rgba(61, 143, 214, 0.1);
    gap: 1rem;
}

.edit-question-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary-light, #3d8fd6), var(--color-primary, #274060));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.edit-question-info {
    flex: 1;
    min-width: 0;
}

.edit-question-text {
    font-weight: 600;
    color: var(--color-primary, #274060);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.edit-question-type {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.edit-question-type i {
    color: var(--color-primary-light, #3d8fd6);
}

.edit-question-actions {
    display: flex;
    gap: 0.5rem;
}

.edit-question-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm, 8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.edit-question-btn.edit {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-info, #3b82f6);
}

.edit-question-btn.edit:hover {
    background: var(--color-info, #3b82f6);
    color: white;
}

.edit-question-btn.delete {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger, #ef4444);
}

.edit-question-btn.delete:hover {
    background: var(--color-danger, #ef4444);
    color: white;
}

.edit-question-btn.move {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted, #64748b);
    cursor: pointer;
}

.edit-question-btn.move:hover:not(:disabled) {
    background: rgba(61, 143, 214, 0.15);
    color: var(--color-primary-light, #3d8fd6);
}

.edit-question-btn.move:disabled,
.edit-question-btn.move[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Question Body (Expandable) */
.edit-question-body {
    padding: 1rem;
    display: none;
}

.edit-question-item.expanded .edit-question-body {
    display: block;
}

/* Add Question Button */
.add-question-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.08), rgba(61, 143, 214, 0.04));
    border: 2px dashed rgba(61, 143, 214, 0.3);
    border-radius: var(--radius-md, 12px);
    color: var(--color-primary-light, #3d8fd6);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-question-btn:hover {
    background: rgba(61, 143, 214, 0.12);
    border-color: var(--color-primary-light, #3d8fd6);
    transform: translateY(-2px);
}

/* Settings Panel */
.edit-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 768px) {
    .edit-settings-grid {
        grid-template-columns: 1fr;
    }
}

.edit-setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: white;
    border: 1px solid rgba(61, 143, 214, 0.1);
    border-radius: var(--radius-sm, 8px);
    transition: all 0.3s ease;
}

.edit-setting-item:hover {
    border-color: rgba(61, 143, 214, 0.2);
}

.edit-setting-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.edit-setting-label {
    font-weight: 600;
    color: var(--color-primary, #274060);
    font-size: 0.9rem;
}

.edit-setting-desc {
    font-size: 0.8rem;
    color: var(--text-muted, #64748b);
}

/* Toggle Switch */
.edit-toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

.edit-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.edit-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 34px;
}

.edit-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.edit-toggle input:checked + .edit-toggle-slider {
    background: linear-gradient(135deg, var(--color-primary-light, #3d8fd6), var(--color-primary, #274060));
}

.edit-toggle input:checked + .edit-toggle-slider:before {
    transform: translateX(22px);
}

/* Modal Footer */
.survey-edit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(61, 143, 214, 0.04), rgba(61, 143, 214, 0.02));
    border-top: 1px solid rgba(61, 143, 214, 0.15);
    gap: 1rem;
}

.survey-edit-footer-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted, #64748b);
    flex-wrap: wrap;
}

.survey-edit-footer-info i {
    color: var(--color-warning, #f59e0b);
}

.survey-edit-footer-info i.fa-user-pen {
    color: var(--color-primary-light, #3d8fd6);
}

.footer-info-separator {
    color: #cbd5e1;
    margin: 0 0.25rem;
}

.survey-edit-footer-actions {
    display: flex;
    gap: 0.75rem;
}

/* Warning Banner */
.edit-warning-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-sm, 8px);
    margin-bottom: 1.5rem;
}

.edit-warning-banner i {
    color: var(--color-warning, #f59e0b);
    font-size: 1.25rem;
}

.edit-warning-banner-text {
    flex: 1;
}

.edit-warning-banner-title {
    font-weight: 600;
    color: #92400e;
    margin-bottom: 0.25rem;
}

.edit-warning-banner-desc {
    font-size: 0.85rem;
    color: #b45309;
}

/* Responsive */
@media (max-width: 768px) {
    .survey-edit-modal {
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .survey-edit-tabs {
        flex-wrap: wrap;
    }
    
    .survey-edit-tab {
        flex: 1 1 33.333%;
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .survey-edit-footer {
        flex-direction: column;
        align-items: stretch;
    }
    
    .survey-edit-footer-actions {
        justify-content: stretch;
    }
    
    .survey-edit-footer-actions .btn {
        flex: 1;
    }
}
