/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1rem 2rem;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 1.5rem;
    color: #667eea;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1a1a1a;
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.clear-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Chat Container */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}

.chat-messages {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Messages */
.message {
    display: flex;
    gap: 1rem;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

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

.assistant-message .message-avatar {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-text {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
    color: #1a1a1a;
}

.user-message .message-text {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    margin-left: auto;
    max-width: 80%;
}

.assistant-message .message-text {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.message-text p {
    margin-bottom: 0.75rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text ul {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-text li {
    margin-bottom: 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.5rem;
    text-align: right;
}

.user-message .message-time {
    text-align: right;
}

.assistant-message .message-time {
    text-align: left;
}

/* Typing indicator */
.typing-indicator {
    margin-top: 1rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 1rem 1.25rem;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6c757d;
    animation: typing 1.4s infinite ease-in-out;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Container */
.input-container {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 2rem;
    backdrop-filter: blur(10px);
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

.input-box {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    padding: 0.75rem;
    transition: border-color 0.2s ease;
}

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

#messageInput {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    max-height: 120px;
    min-height: 24px;
    padding: 0;
    background: transparent;
}

#messageInput::placeholder {
    color: #6c757d;
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #667eea;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    background: #5a6fd8;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.char-count {
    font-weight: 500;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e9ecef;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-spinner p {
    color: #6c757d;
    font-weight: 500;
}

/* Responsive design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .logo h1 {
        font-size: 1.25rem;
    }
    
    .chat-container {
        padding: 1rem;
    }
    
    .input-container {
        padding: 1rem;
    }
    
    .message {
        gap: 0.75rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }
    
    .message-text {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
    
    .user-message .message-text {
        max-width: 90%;
    }
}

@media (max-width: 480px) {
    .input-footer {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }
    
    .clear-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Scrollbar styling */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
} 

.subject-select {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.subject-select select {
    padding: 0.3rem 0.5rem;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: white;
    font-size: 0.9rem;
    cursor: pointer;
}


.upload-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: #f093fb;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.upload-btn:hover {
  background: #e83e8c;
}


.preview-img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 8px;
  margin-top: 8px;
  display: block;
}


