/* Custom Notification */
.custom-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 12px;
    padding: 15px;
    color: var(--text-color, #e5e7eb);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 90%;
    width: 400px;
}

.custom-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.notification-message {
    font-size: 1em;
    line-height: 1.5;
    flex: 1;
}

.notification-close-btn {
    background: #ef4444;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.notification-close-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.notification-close-btn i {
    font-size: 1em;
    color: #ffffff;
}

/* Loading Notification */
.loading-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #1a1a1a, #2a2a2a);
    border-radius: 12px;
    padding: 15px;
    color: var(--text-color, #e5e7eb);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 90%;
    width: 400px;
}

.loading-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--text-color, #e5e7eb);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-message {
    font-size: 1em;
    line-height: 1.5;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* CoreAI Image Preview Modal */
.coreai-image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.coreai-image-preview-modal.active {
    opacity: 1;
}

.coreai-image-preview-content {
    background: linear-gradient(135deg, #1f2937, #374151);
    border-radius: 12px;
    padding: 20px;
    max-width: 95%;
    max-height: 90%;
    overflow: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.coreai-preview-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ef4444;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.coreai-preview-close-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.coreai-preview-close-btn i {
    font-size: 1em;
    color: #ffffff;
}

.coreai-editor-container {
    display: flex;
    flex-direction: row;
    gap: 20px;
    max-width: 100%;
}

#coreai-editorCanvas {
    max-width: 100%;
    max-height: 60vh;
    border: 1px solid #4b5563;
    background: #1f2937;
    border-radius: 6px;
}

.coreai-editor-tools {
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #2d3748;
    padding: 15px;
    border-radius: 8px;
    width: 280px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.coreai-tool-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.coreai-tool-section h3 {
    font-size: 1.1em;
    color: var(--text-color, #e5e7eb);
    margin: 0 0 8px;
    font-weight: 500;
}

.coreai-tool-btn {
    background: #4b5563;
    border: none;
    padding: 10px;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coreai-tool-btn:hover {
    background: #6b7280;
    transform: scale(1.05);
}

.coreai-tool-btn:disabled {
    background: #374151;
    cursor: not-allowed;
}

.coreai-tool-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.coreai-tool-options label {
    display: flex;
    flex-direction: column;
    font-size: 0.9em;
    color: var(--text-color, #e5e7eb);
}

.coreai-tool-options select,
.coreai-tool-options input[type="number"],
.coreai-tool-options input[type="color"],
.coreai-tool-options input[type="range"] {
    width: 100%;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #4b5563;
    background: #1f2937;
    color: var(--text-color, #e5e7eb);
}

.coreai-tool-options input[type="checkbox"] {
    margin-right: 8px;
}

.coreai-preview-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.coreai-action-btn {
    background: #3b82f6;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.2s ease;
}

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

/* Mobile Adjustments */
@media (max-width: 768px) {
    .custom-notification {
        width: 90%;
        padding: 12px;
        top: 15px;
    }

    .notification-message {
        font-size: 0.9em;
    }

    .notification-close-btn {
        width: 28px;
        height: 28px;
    }

    .notification-close-btn i {
        font-size: 0.85em;
    }

    .loading-notification {
        width: 90%;
        padding: 12px;
        top: 15px;
    }

    .loading-message {
        font-size: 0.9em;
    }

    .loading-spinner {
        width: 20px;
        height: 20px;
        border-width: 2px;
    }

    .coreai-image-preview-content {
        padding: 15px;
        max-width: 98%;
        max-height: 95%;
    }

    .coreai-editor-container {
        flex-direction: column;
    }

    .coreai-editor-tools {
        width: 100%;
        padding: 12px;
    }

    #coreai-editorCanvas {
        max-height: 45vh;
    }

    .coreai-tool-btn, .coreai-action-btn {
        padding: 8px;
        font-size: 0.9em;
    }

    .coreai-tool-section h3 {
        font-size: 1em;
    }
}

/* RTL Adjustments */
html[dir="rtl"] .notification-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .notification-message {
    text-align: right;
}

html[dir="rtl"] .loading-content {
    flex-direction: row-reverse;
}

html[dir="rtl"] .loading-message {
    text-align: right;
}

html[dir="rtl"] .coreai-image-preview-content {
    direction: rtl;
}

html[dir="rtl"] .coreai-editor-container {
    flex-direction: column;
}

html[dir="rtl"] .coreai-tool-options label {
    align-items: flex-end;
}

html[dir="rtl"] .coreai-tool-section h3 {
    text-align: right;
}

html[dir="rtl"] .coreai-preview-close-btn {
    right: auto;
    left: 10px;
}