/* AI Tutor Gemini Public Styles */

/* Reading Time Display */
.ai-reading-time {
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    padding: 10px 15px;
    margin: 20px 0;
    font-size: 14px;
    color: #666;
    border-radius: 0 4px 4px 0;
}

.reading-time-icon {
    margin-right: 8px;
}

/* AI Tutor Chat Widget */
.ai-tutor-chat-widget {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-tutor-header {
    background: #0073aa;
    color: white;
    padding: 15px;
    text-align: center;
}

.ai-tutor-header h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    font-weight: 600;
}

.ai-tutor-header p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.ai-tutor-messages {
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    background: #fafafa;
}

.ai-message {
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 8px;
    max-width: 85%;
}

.ai-message.ai-user {
    background: #e3f2fd;
    margin-left: auto;
    text-align: right;
}

.ai-message.ai-ai {
    background: #f5f5f5;
    margin-right: auto;
}

.ai-message strong {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
}

.ai-message p {
    margin: 0;
    line-height: 1.4;
}

.ai-message.loading {
    opacity: 0.7;
    font-style: italic;
}

.ai-tutor-input {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.ai-tutor-input input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.ai-tutor-input input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.ai-tutor-input button {
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.ai-tutor-input button:hover {
    background: #005a87;
}

.ai-tutor-input button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Quiz Styles */
.ai-quiz-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ai-quiz-header {
    background: #0073aa;
    color: white;
    padding: 20px;
    text-align: center;
}

.ai-quiz-header h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
}

.quiz-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    opacity: 0.9;
}

.ai-quiz-loading {
    padding: 40px;
    text-align: center;
    color: #666;
}

.ai-quiz-loading .loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ai-quiz-content {
    padding: 20px;
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.quiz-header h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.quiz-header p {
    margin: 0 0 15px 0;
    color: #666;
}

.quiz-header .quiz-info {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 14px;
    color: #888;
}

.quiz-question {
    margin-bottom: 30px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #0073aa;
}

.quiz-question h5 {
    margin: 0 0 15px 0;
    color: #0073aa;
    font-size: 16px;
    font-weight: 600;
}

.quiz-question p {
    margin: 0 0 15px 0;
    font-size: 15px;
    line-height: 1.5;
}

.quiz-question label {
    display: block;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.quiz-question label:hover {
    background: #f0f8ff;
    border-color: #0073aa;
}

.quiz-question input[type="radio"] {
    margin-right: 10px;
}

.quiz-question textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.quiz-submit {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #eee;
}

.quiz-submit button {
    padding: 12px 30px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quiz-submit button:hover {
    background: #005a87;
}

/* Quiz Results */
.quiz-results {
    padding: 20px;
    background: #f8f9fa;
}

.quiz-results h4 {
    margin: 0 0 20px 0;
    text-align: center;
    color: #333;
}

.score-summary {
    text-align: center;
    margin-bottom: 30px;
}

.score-circle {
    display: inline-block;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #0073aa;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.score-number {
    font-size: 24px;
    font-weight: bold;
}

.score-label {
    font-size: 14px;
    opacity: 0.9;
}

.question-review h5 {
    margin: 0 0 20px 0;
    color: #333;
    text-align: center;
}

.question-result {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid;
}

.question-result.correct {
    background: #e8f5e8;
    border-color: #46b450;
}

.question-result.incorrect {
    background: #ffeaea;
    border-color: #dc3232;
}

.question-result h6 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.question-result.correct h6 {
    color: #155724;
}

.question-result.incorrect h6 {
    color: #721c24;
}

.question-result p {
    margin: 5px 0;
    font-size: 14px;
}

.retake-quiz {
    display: block;
    margin: 20px auto 0;
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Q&A Shortcode */
.ai-qa-shortcode {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    display: flex;
    flex-direction: column;
}

.qa-messages-area {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #fafafa;
    min-height: 200px;
}

.qa-input-area {
    padding: 15px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.qa-input-area input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    outline: none;
}

.qa-input-area input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

.qa-input-area button {
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.qa-input-area button:hover {
    background: #005a87;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ai-tutor-chat-widget,
    .ai-quiz-container {
        margin: 10px 0;
        border-radius: 0;
    }
    
    .quiz-info {
        flex-direction: column;
        gap: 5px;
    }
    
    .score-circle {
        width: 100px;
        height: 100px;
    }
    
    .score-number {
        font-size: 20px;
    }
    
    .ai-tutor-input,
    .qa-input-area {
        flex-direction: column;
    }
    
    .ai-tutor-input button,
    .qa-input-area button {
        width: 100%;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .loading-spinner {
        animation: none;
    }
    
    * {
        transition: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .ai-tutor-chat-widget,
    .ai-quiz-container {
        border: 2px solid #000;
    }
    
    .ai-message.ai-user {
        background: #000;
        color: #fff;
    }
    
    .ai-message.ai-ai {
        background: #fff;
        color: #000;
        border: 1px solid #000;
    }
}

/* Print styles */
@media print {
    .ai-tutor-input,
    .qa-input-area,
    .quiz-submit {
        display: none;
    }
    
    .ai-tutor-chat-widget,
    .ai-quiz-container {
        border: 1px solid #000;
        box-shadow: none;
    }
}
