/* Main Styles for AI English Tutor */

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #e1e4e8;
    margin-bottom: 20px;
}

header h1 {
    color: #2c3e50;
    font-size: 2.2rem;
}

header h1 i {
    color: #3498db;
    margin-right: 10px;
}

.level-selector {
    display: flex;
    align-items: center;
}

.level-selector label {
    margin-right: 10px;
    font-weight: 600;
}

.level-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
    font-size: 1rem;
    cursor: pointer;
}

/* Navigation Styles */
nav {
    margin-bottom: 30px;
}

nav ul {
    display: flex;
    list-style: none;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

nav ul li {
    flex: 1;
    text-align: center;
}

nav ul li a {
    display: block;
    padding: 15px 0;
    color: #555;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

nav ul li a:hover {
    background-color: #f8f9fa;
    color: #3498db;
}

nav ul li a.active {
    background-color: #3498db;
    color: white;
}

/* Main Content Styles */
main {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 30px;
    margin-bottom: 30px;
}

section {
    display: none;
}

section.active-section {
    display: block;
}

section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f1f1;
}

/* Conversation Section Styles */
.chat-container {
    height: 500px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.ai {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 15px;
    border-radius: 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background-color: #3498db;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.ai .message-content {
    background-color: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
}

.correction {
    color: #e74c3c;
    text-decoration: underline;
    cursor: pointer;
    position: relative;
}

.correction-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    display: none;
}

.correction:hover .correction-tooltip {
    display: block;
}

.user-input-container {
    display: flex;
    gap: 10px;
}

#user-message {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    height: 80px;
    font-size: 1rem;
}

.input-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-buttons button {
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.input-buttons button:hover {
    background-color: #2980b9;
}

#voice-input {
    background-color: #2ecc71;
}

#voice-input:hover {
    background-color: #27ae60;
}

/* Reading Section Styles */
.reading-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reading-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

#reading-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    flex: 1;
}

.reading-controls button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.reading-controls button:hover {
    background-color: #2980b9;
}

#pause-reading {
    background-color: #e74c3c;
}

#pause-reading:hover {
    background-color: #c0392b;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

#reading-speed {
    width: 100px;
}

.reading-text {
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    line-height: 1.8;
    font-size: 1.1rem;
}

.highlight {
    background-color: #ffeaa7;
    padding: 2px 0;
}

/* Writing Section Styles */
.writing-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.writing-prompt {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
}

.writing-prompt h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

#new-prompt {
    margin-top: 15px;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#new-prompt:hover {
    background-color: #2980b9;
}

.writing-area {
    display: flex;
    gap: 20px;
}

#writing-input {
    flex: 1;
    height: 300px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    resize: none;
    font-size: 1rem;
    line-height: 1.6;
}

.writing-feedback {
    flex: 1;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.writing-feedback h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

#check-writing {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    align-self: flex-end;
}

#check-writing:hover {
    background-color: #2980b9;
}

.feedback-item {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 4px;
}

.feedback-item.error {
    background-color: #ffebee;
    border-left: 3px solid #e74c3c;
}

.feedback-item.suggestion {
    background-color: #e8f4fd;
    border-left: 3px solid #3498db;
}

.feedback-item.positive {
    background-color: #e8f5e9;
    border-left: 3px solid #2ecc71;
}

/* Grammar Section Styles */
.grammar-container {
    display: flex;
    gap: 30px;
}

.grammar-topics {
    flex: 1;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.grammar-topics h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.grammar-topics ul {
    list-style: none;
}

.grammar-topics ul li {
    margin-bottom: 10px;
}

.grammar-topic {
    display: block;
    padding: 10px 15px;
    background-color: #fff;
    border-radius: 4px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
}

.grammar-topic:hover {
    background-color: #e9ecef;
}

.grammar-topic.active {
    background-color: #3498db;
    color: white;
}

.grammar-exercise {
    flex: 2;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.grammar-exercise h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.exercise-item {
    margin-bottom: 20px;
}

.exercise-item p {
    margin-bottom: 10px;
}

.grammar-answer {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    width: 200px;
}

.feedback {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.9rem;
}

.feedback.correct {
    color: #2ecc71;
}

.feedback.incorrect {
    color: #e74c3c;
}

#check-grammar {
    margin-top: 20px;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#check-grammar:hover {
    background-color: #2980b9;
}

/* Test Section Styles */
.test-container {
    max-width: 800px;
    margin: 0 auto;
}

.test-intro {
    text-align: center;
    padding: 20px;
}

.test-intro h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.test-intro p {
    margin-bottom: 15px;
}

#start-test {
    margin-top: 20px;
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#start-test:hover {
    background-color: #2980b9;
}

.question-counter {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
}

.question {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.question h4 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option {
    padding: 12px 15px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option:hover {
    background-color: #e9ecef;
}

.option.selected {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

.test-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.test-navigation button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.test-navigation button:hover {
    background-color: #2980b9;
}

.test-navigation button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

#finish-test {
    background-color: #2ecc71;
}

#finish-test:hover {
    background-color: #27ae60;
}

.test-results {
    text-align: center;
    padding: 30px;
}

.result-score {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.level-result {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: #2c3e50;
}

.level-description {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: left;
    margin-bottom: 30px;
}

#restart-test {
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    background-color: #3498db;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#restart-test:hover {
    background-color: #2980b9;
}

/* Footer Styles */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    nav ul {
        flex-direction: column;
    }
    
    .writing-area {
        flex-direction: column;
    }
    
    .grammar-container {
        flex-direction: column;
    }
    
    .reading-controls {
        flex-direction: column;
        align-items: stretch;
    }
}