/* Edit Modal - Flat Design */
#edit-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#edit-modal:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    border: 1px solid #e9ecef;
    animation: modalSlideIn 0.3s ease;
}

#modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3436;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: -0.5px;
}

#edit-prompt-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-size: 1rem;
    resize: vertical;
    transition: border-color 0.2s ease;
    background: white;
    min-height: 120px;
    line-height: 1.6;
}

#edit-prompt-input:focus {
    outline: none;
    border-color: #ff6b35;
}

#edit-prompt-input::placeholder {
    color: #adb5bd;
    font-size: 0.9375rem;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

#apply-changes-btn {
    flex: 1;
    padding: 0.875rem 2rem;
    background: #ff6b35;
    color: white;
    border: none;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    letter-spacing: -0.2px;
}

#apply-changes-btn:hover {
    background: #e55a2b;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

#apply-changes-btn:active {
    transform: translateY(0);
}

#apply-changes-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#cancel-edit-btn {
    flex: 1;
    padding: 0.875rem 2rem;
    background: transparent;
    color: #495057;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: -0.2px;
}

#cancel-edit-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

#cancel-edit-btn:active {
    transform: translateY(0);
}



/* Animation for modal entrance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .modal-content {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    #modal-title {
        font-size: 1.25rem;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
    
    #apply-changes-btn,
    #cancel-edit-btn {
        width: 100%;
    }
}

/* RTL Support */
[dir="rtl"] #edit-prompt-input {
    text-align: right;
    direction: rtl;
}

/* Optional: Close button (X) in corner */
.modal-close-x {
    position: absolute;
    top: 1rem;
    left: 1rem; /* right for RTL */
    background: transparent;
    border: none;
    color: #adb5bd;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

[dir="rtl"] .modal-close-x {
    left: auto;
    right: 1rem;
}

.modal-close-x:hover {
    color: #495057;
}

/* --- Add/Update in public/styles/edit.css --- */

/* This is your new class to highlight the container */
.problem-container.is-editing {
    border: 2px solid #dc3545; /* A strong red border */
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.25); /* Optional red glow */
}

/* This class shows the container is loading (replaces is-editing) */
.problem-container.is-loading {
    /* (You may already have this, just ensure it's here) */
    padding: 2rem;
    text-align: center;
    border: 1px solid #ffccb8; /* Back to normal border */
    box-shadow: 0 2px 5px rgba(212, 67, 38, 0.1);
}

/* This is the editor box that appears inside */
.inline-editor-overlay {
    position: relative; 
    z-index: 10;
    background: #fff8f5; /* Light background to stand out */
    border-bottom: 2px solid #ffccb8; /* Separator */
    border-radius: 6px 6px 0 0; /* Match parent container */
    padding: 1.5rem;
    margin: -1px -1px 1.5rem -1px; /* Fit to the edges, add space below */
    animation: fadeIn 0.3s ease;
}

.inline-editor-overlay h4 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #d44326;
    margin-top: 0;
    margin-bottom: 1rem;
    text-align: right;
}

.inline-editor-overlay textarea {
    width: 100%;
    box-sizing: border-box; 
    min-height: 80px;
    padding: 0.75rem;
    border: 1px solid #ffccb8;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-size: 1rem;
    resize: vertical;
}

.inline-editor-overlay textarea:focus {
    outline: none;
    border-color: #ff6b35;
}

.inline-editor-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    justify-content: flex-end; /* Buttons to the left (RTL) */
}

.inline-editor-buttons button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.inline-editor-buttons .inline-save-btn {
    background-color: #ff6b35;
    color: white;
}
.inline-editor-buttons .inline-save-btn:hover {
    background-color: #e05a2d;
}

.inline-editor-buttons .inline-cancel-btn {
    background-color: #f1f3f5;
    color: #495057;
}
.inline-editor-buttons .inline-cancel-btn:hover {
    background-color: #e9ecef;
}