* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s ease;
}

[data-theme="dark"] body {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.chat-container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-width: 1400px;
    width: 95%;
    height: 85vh;
    min-height: 700px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.5s ease-out;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

[data-theme="dark"] .chat-container {
    background: #2a2a3e;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

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

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

[data-theme="dark"] .chat-header {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
    transform: translateX(-5px);
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.theme-toggle .sun-icon,
.theme-toggle .light-text {
    display: none;
}

.theme-toggle .moon-icon,
.theme-toggle .dark-text {
    display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon,
[data-theme="dark"] .theme-toggle .light-text {
    display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon,
[data-theme="dark"] .theme-toggle .dark-text {
    display: none;
}

.tutor-avatar {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    flex-shrink: 0;
}

.tutor-title {
    font-size: 1.8em;
    margin-bottom: 5px;
}

.tutor-status {
    font-size: 0.9em;
    opacity: 0.9;
}

.topic-selector {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.topic-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
}

.topic-label-text {
    font-size: 0.9em;
}

.topic-select {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    color: white;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.topic-select:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.5);
}

.topic-select option {
    background: #667eea;
    color: white;
}

[data-theme="dark"] .topic-select {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.2);
}

[data-theme="dark"] .topic-select:hover {
    background: rgba(255,255,255,0.25);
}

[data-theme="dark"] .topic-select option {
    background: #2a2a3e;
    color: #e0e0e0;
}

.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.lang-btn {
    padding: 8px 16px;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.3s;
}

.lang-btn.active {
    background: white;
    color: #667eea;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: #f8f9fa;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlide 0.3s ease-out;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3em;
    flex-shrink: 0;
}

.tutor-message .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.user-message .message-avatar {
    background: #e0e0e0;
}

.message-content {
    flex: 1;
    background: white;
    padding: 15px 18px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    line-height: 1.6;
    font-size: 1.05em;
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-time {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 5px;
}

.typing-indicator {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 15px;
}

.typing-indicator.active {
    display: flex;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 15px 18px;
    background: white;
    border-radius: 15px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.quick-topics {
    padding: 15px 25px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.quick-topics-title {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

.topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.topic-chip {
    padding: 8px 15px;
    background: #f0f4ff;
    border: 1px solid #667eea;
    color: #667eea;
    border-radius: 20px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.3s;
}

.topic-chip:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
}

.chat-input-container {
    padding: 20px 25px;
    background: white;
    border-top: 2px solid #e0e0e0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus {
    border-color: #667eea;
}

.send-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.3em;
    cursor: pointer;
    transition: transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    transform: scale(1.1);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.event-card {
    background: #f0f4ff;
    border-left: 4px solid #667eea;
    padding: 15px;
    margin: 10px 0;
    border-radius: 8px;
    position: relative;
    max-height: 250px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
}

.event-card:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.event-card.expanded {
    max-height: none;
    overflow-y: auto;
    max-height: 800px;
}

.event-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, #f0f4ff);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.event-card.expanded::after {
    opacity: 0;
}

.event-card-expand-hint {
    position: absolute;
    bottom: 8px;
    right: 15px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.event-card.expanded .event-card-expand-hint {
    opacity: 0;
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 5px;
}

.event-card-title {
    font-weight: bold;
    color: #667eea;
    font-size: 1.1em;
    flex: 1;
}

.event-card-score {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
    flex-shrink: 0;
}

.event-card-year {
    font-size: 1em;
    color: #666;
    margin-bottom: 8px;
}

.event-card-description {
    font-size: 1em;
    line-height: 1.6;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

[data-theme="dark"] .welcome-message {
    color: #b0b0b0;
}

.welcome-message h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 2em;
}

[data-theme="dark"] .welcome-message h2 {
    color: #8b94d4;
}

.welcome-message p {
    margin-bottom: 10px;
    line-height: 1.6;
    font-size: 1.1em;
}

/* Dark mode styles */
[data-theme="dark"] .chat-messages {
    background: #1a1a2e;
}

[data-theme="dark"] .message-content {
    background: #2a2a3e;
    color: #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .user-message .message-content {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    color: white;
}

[data-theme="dark"] .user-message .message-avatar {
    background: #4a5568;
}

[data-theme="dark"] .typing-dots {
    background: #2a2a3e;
}

[data-theme="dark"] .typing-dots span {
    background: #8b94d4;
}

[data-theme="dark"] .quick-topics {
    background: #2a2a3e;
    border-top-color: #3a3a4e;
}

[data-theme="dark"] .quick-topics-title {
    color: #b0b0b0;
}

[data-theme="dark"] .topic-chip {
    background: #3a3a4e;
    border-color: #8b94d4;
    color: #8b94d4;
}

[data-theme="dark"] .topic-chip:hover {
    background: #8b94d4;
    color: white;
}

[data-theme="dark"] .chat-input-container {
    background: #2a2a3e;
    border-top-color: #3a3a4e;
}

[data-theme="dark"] .chat-input {
    background: #1a1a2e;
    border-color: #3a3a4e;
    color: #e0e0e0;
}

[data-theme="dark"] .chat-input:focus {
    border-color: #8b94d4;
}

[data-theme="dark"] .event-card {
    background: #2a2a3e;
    border-left-color: #8b94d4;
}

[data-theme="dark"] .event-card-title {
    color: #8b94d4;
}

[data-theme="dark"] .event-card-year {
    color: #b0b0b0;
}

[data-theme="dark"] .event-card-description {
    color: #d0d0d0;
}

[data-theme="dark"] .event-card-score {
    background: linear-gradient(135deg, #5a6a9a 0%, #4a5578 100%);
}

[data-theme="dark"] .event-card::after {
    background: linear-gradient(to bottom, transparent, #2a2a3e);
}

[data-theme="dark"] .event-card-expand-hint {
    background: rgba(139, 148, 212, 0.9);
}

[data-theme="dark"] .event-card:hover {
    box-shadow: 0 4px 12px rgba(139, 148, 212, 0.3);
}

[data-theme="dark"] .send-btn {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
    }

    .chat-header {
        padding: 15px;
        gap: 10px;
    }

    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .tutor-avatar {
        width: 50px;
        height: 50px;
        font-size: 1.5em;
    }

    .tutor-title {
        font-size: 1.5em;
    }

    .topic-selector, .language-selector {
        flex-direction: column;
        gap: 5px;
    }

    .chat-messages {
        padding: 15px;
    }

    .chat-input-container {
        flex-direction: column;
        gap: 10px;
    }

    .chat-input {
        width: 100%;
    }
}

@media (min-width: 1200px) {
    .chat-container {
        max-width: 1200px;
    }

    .tutor-title {
        font-size: 2em;
    }

    .chat-messages {
        padding: 30px;
    }
}
