/* AI Assistant Panel */
.ai-panel {
    width: 320px;
    background: #ffffff;
    border-left: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    position: relative;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 200;
}

.ai-panel.show {
    transform: translateX(0);
}

/* AI Panel Header */
.ai-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ai-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-header i {
    font-size: 18px;
    color: #ffd700;
}

.ai-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.ai-close:hover {
    background: rgba(255,255,255,0.2);
}

.ai-close i {
    font-size: 12px;
    color: white;
}

/* AI Panel Content */
.ai-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* AI Prompt Section */
.ai-prompt-section {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.ai-prompt {
    width: 100%;
    min-height: 80px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    background: #ffffff;
    color: #495057;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.ai-prompt:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
}

.ai-prompt::placeholder {
    color: #6c757d;
}

.ai-actions {
    display: flex;
    gap: 8px;
}

.ai-btn {
    background: #6c757d;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    flex: 1;
    justify-content: center;
}

.ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

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

.ai-btn.primary {
    background: #667eea;
}

.ai-btn.primary:hover {
    background: #5a6fd8;
}

.ai-btn i {
    font-size: 11px;
}

/* AI Suggestions */
.ai-suggestions {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.ai-suggestions h4 {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-suggestions h4 i {
    font-size: 12px;
    color: #ffc107;
}

.suggestion-buttons {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.suggestion-btn {
    background: #ffffff;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    text-align: left;
    transition: all 0.2s ease;
    position: relative;
}

.suggestion-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.suggestion-btn:active {
    background: #e9ecef;
}

.suggestion-btn::before {
    content: '✨';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.suggestion-btn:hover::before {
    opacity: 1;
}

/* AI Response Area */
.ai-response {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ffffff;
}

.response-message {
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
}

.response-message.user {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    margin-left: 20px;
}

.response-message.ai {
    background: #f3e5f5;
    border-left: 3px solid #9c27b0;
    margin-right: 20px;
}

.response-message.system {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    font-style: italic;
}

.response-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.response-header i {
    font-size: 10px;
}

.response-content {
    color: #212529;
}

.response-content p {
    margin-bottom: 8px;
}

.response-content p:last-child {
    margin-bottom: 0;
}

.response-actions {
    margin-top: 8px;
    display: flex;
    gap: 6px;
}

.response-action-btn {
    background: none;
    border: 1px solid #dee2e6;
    color: #6c757d;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.response-action-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
}

/* Loading State */
.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6c757d;
    font-size: 13px;
    gap: 8px;
}

.ai-loading .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Empty State */
.ai-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: #6c757d;
    height: 100%;
}

.ai-empty i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 16px;
}

.ai-empty h4 {
    font-size: 16px;
    margin-bottom: 8px;
    color: #495057;
}

.ai-empty p {
    font-size: 13px;
    line-height: 1.5;
    max-width: 250px;
}

/* AI Features Panel */
.ai-features {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.ai-features h4 {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.feature-btn {
    background: #ffffff;
    border: 1px solid #dee2e6;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.feature-btn:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateY(-1px);
}

.feature-btn i {
    font-size: 16px;
    color: #667eea;
}

.feature-btn span {
    font-size: 10px;
    color: #495057;
    font-weight: 500;
}

/* Grammar Check Results */
.grammar-results {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #ffffff;
}

.grammar-results h4 {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.grammar-issue {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    font-size: 12px;
}

.grammar-issue.spelling {
    background: #fffbf0;
    border-color: #feebc8;
}

.grammar-issue.style {
    background: #f0fff4;
    border-color: #c6f6d5;
}

.issue-text {
    font-weight: 600;
    color: #e53e3e;
    margin-bottom: 4px;
}

.issue-suggestion {
    color: #4a5568;
    margin-bottom: 6px;
}

.issue-actions {
    display: flex;
    gap: 6px;
}

.issue-btn {
    background: none;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s ease;
}

.issue-btn:hover {
    background: #edf2f7;
}

.issue-btn.accept {
    background: #48bb78;
    border-color: #48bb78;
    color: white;
}

.issue-btn.accept:hover {
    background: #38a169;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-panel {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        z-index: 1000;
        width: 100%;
        max-width: 350px;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .ai-actions {
        flex-direction: column;
    }
    
    .suggestion-buttons {
        max-height: 200px;
        overflow-y: auto;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .ai-panel {
        background: #1a202c;
        border-left-color: #4a5568;
    }
    
    .ai-prompt-section {
        background: #2d3748;
        border-bottom-color: #4a5568;
    }
    
    .ai-prompt {
        background: #1a202c;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .ai-suggestions {
        border-bottom-color: #4a5568;
    }
    
    .ai-suggestions h4 {
        color: #e2e8f0;
    }
    
    .suggestion-btn {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .suggestion-btn:hover {
        background: #4a5568;
        border-color: #667eea;
    }
    
    .ai-response {
        background: #1a202c;
    }
    
    .response-message.user {
        background: #1e3a8a;
        border-left-color: #3b82f6;
    }
    
    .response-message.ai {
        background: #581c87;
        border-left-color: #a855f7;
    }
    
    .response-content {
        color: #e2e8f0;
    }
    
    .ai-features {
        background: #2d3748;
        border-bottom-color: #4a5568;
    }
    
    .ai-features h4 {
        color: #e2e8f0;
    }
    
    .feature-btn {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .feature-btn:hover {
        background: #2d3748;
    }
    
    .feature-btn span {
        color: #e2e8f0;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Accessibility */
.ai-panel button:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.ai-panel textarea:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .ai-header {
        background: #000;
        border-bottom: 2px solid #fff;
    }
    
    .ai-prompt {
        border: 2px solid #000;
    }
    
    .suggestion-btn {
        border: 2px solid #000;
    }
    
    .response-message {
        border-left-width: 4px;
    }
}
