/* AI Assistant Inline Popup Styles */

/* Main popup container */
.ai-inline-popup {
    position: absolute;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    display: flex;
    max-width: 340px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow: hidden;
    animation: popupFadeIn 0.2s ease;
}

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

/* AI icon on the left */
.ai-popup-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-popup-icon .material-icons {
    font-size: 24px;
}

/* Buttons container */
.ai-popup-buttons {
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-gap: 4px;
    background: white;
    position: relative;
    min-width: 280px;
}

/* Header for submenu with back button */
.ai-popup-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    padding: 4px 0;
    margin-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
}

.ai-popup-header .back-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 16px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.ai-popup-header .back-btn:hover {
    background: #f0f0f0;
    border-radius: 4px;
}

.ai-popup-header span {
    margin-left: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Button styles */
.ai-popup-buttons button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 11px;
    color: #333;
    min-height: 60px;
    position: relative;
}

.ai-popup-buttons button:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.ai-popup-buttons button:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(102, 126, 234, 0.1);
}

.ai-popup-buttons button span:first-child {
    font-size: 18px;
    margin-bottom: 4px;
}

.ai-popup-buttons button span:last-child {
    font-size: 11px;
    font-weight: 500;
}

/* Slide animation for hierarchy transition */
.slide-transition {
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Submenu specific styles */
.ai-popup-submenu {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-gap: 6px;
    padding: 4px;
}

.ai-popup-submenu button {
    padding: 12px 8px;
    min-height: 50px;
}

/* Toast notifications */
.ai-toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    pointer-events: none;
}

.ai-toast {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 20px;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
}

.ai-toast.success {
    border-left: 4px solid #10b981;
}

.ai-toast.error {
    border-left: 4px solid #ef4444;
}

.ai-toast.info {
    border-left: 4px solid #3b82f6;
}

.ai-toast.warning {
    border-left: 4px solid #f59e0b;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.ai-toast-message {
    font-size: 14px;
    color: #333;
}

/* Result modal styles */
.ai-result-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 10002;
}

.ai-result-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-result-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.ai-result-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ai-result-original,
.ai-result-processed {
    margin-bottom: 16px;
}

.ai-result-original h4,
.ai-result-processed h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-result-original pre,
.ai-result-processed pre {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.ai-result-actions {
    padding: 12px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.ai-result-actions button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-result-actions .replace-btn {
    background: #3b82f6;
    color: white;
}

.ai-result-actions .replace-btn:hover {
    background: #2563eb;
}

.ai-result-actions .cancel-btn {
    background: #f3f4f6;
    color: #374151;
}

.ai-result-actions .cancel-btn:hover {
    background: #e5e7eb;
}

/* Custom button icons (emojis) */
.ai-popup-buttons button span:first-child:not(.material-icons) {
    font-size: 20px;
    line-height: 1;
}