/* AI Summarizer Button */
.ai-summarize-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin: 20px 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-summarize-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

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

.ai-icon {
    font-size: 18px;
}

/* Modal Styles */
.ai-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ai-modal-content {
    background-color: #fff;
    margin: 3% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 650px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: slideIn 0.3s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

.ai-modal-content h3 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 700;
}

.ai-close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.ai-close:hover {
    color: #333;
    background-color: #f0f0f0;
}

/* Form Styles */
.ai-form-group {
    margin-bottom: 25px;
}

.ai-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.required {
    color: #e74c3c;
}

.ai-form-group input,
.ai-form-group textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    box-sizing: border-box;
    font-family: inherit;
    background-color: #fafbfc;
}

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

.ai-form-group input.error {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.prompt-preview {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #7f8c8d;
    font-style: italic;
    line-height: 1.4;
}

#prompt-preview-text {
    color: #5a6fd8;
    font-weight: 500;
}

.ai-submit-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    position: relative;
    font-family: inherit;
}

.ai-submit-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.ai-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    display: none;
}

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
}

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

/* Loading Animation */
#ai-loading {
    text-align: center;
    padding: 30px 20px;
    color: #667eea;
    font-weight: 600;
}

.loading-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-radius: 50%;
    border-top-color: #667eea;
    animation: spin 1s linear infinite;
}

/* Summary Result Styles */
#ai-summary-result {
    margin-top: 25px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border-radius: 12px;
    border-left: 5px solid #667eea;
    position: relative;
}

#ai-summary-result h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 700;
}

#ai-summary-content {
    line-height: 1.7;
    color: #34495e;
    font-size: 15px;
    margin-bottom: 20px;
}

.copy-btn {
    background: #34495e;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.copy-btn:hover {
    background: #2c3e50;
    transform: translateY(-1px);
}

.copy-btn.copied {
    background: #27ae60;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-modal-content {
        margin: 5% auto;
        padding: 20px;
        width: 95%;
        border-radius: 12px;
    }
    
    .ai-modal-content h3 {
        font-size: 20px;
        margin-bottom: 20px;
        padding-right: 40px;
    }
    
    .ai-summarize-button {
        width: 100%;
        justify-content: center;
        padding: 16px 24px;
    }
    
    .ai-form-group input,
    .ai-form-group textarea {
        padding: 12px 14px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .ai-submit-btn {
       	padding: 14px 24px;
        font-size: 15px;
    }
    
    #ai-summary-result {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .ai-modal-content {
        margin: 2% auto;
        padding: 15px;
        width: 98%;
    }
    
    .ai-close {
        right: 15px;
        top: 15px;
        font-size: 28px;
    }
}

/* WordPress Theme Compatibility */
.ai-summarizer-container * {
p    box-sizing: border-box;
}

/* Ensure button doesn't inherit theme styles */
#ai-summarizer-container button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-summarize-button {
        border: 2px solid #000;
    }
    
    .ai-form-group input,
    .ai-form-group textarea {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ai-summarize-button,
    .ai-submit-btn,
    .copy-btn,
    .ai-modal,
    .ai-modal-content {
        transition: none;
        animation: none;
    }
    
    .ai-summarize-button:hover,
    .ai-submit-btn:hover {
        transform: none;
    }
    
    .spinner,
    .loading-spinner {
        animation: none;
    }
}