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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0098ca;
    height: 100vh;
    display: flex;
    flex-direction: column;
    color: #333;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-content {
    display: flex;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.logo-img {
    height: 35px;
    width: auto;
}

.login-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-window {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* Message Styles */
.message {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    animation: fadeInUp 0.3s ease-out;
}

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

.ai-message {
    flex-direction: row;
}

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

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

.ai-message .message-avatar {
    background: #003366;
    color: white;
}

.message-content {
    max-width: 70%;
    background: #f7fafc;
    padding: 1rem 1.5rem;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-bottom-right-radius: 5px;
}

.ai-message .message-content {
    background: #f7fafc;
    color: #2d3748;
    border-bottom-left-radius: 5px;
}

.message-content strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.message-content p {
    margin: 0;
    line-height: 1.5;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    margin-bottom: 2rem;
}

.welcome-message .ai-message {
    justify-content: center;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.welcome-message .message-content {
    max-width: 80%;
    text-align: left;
}

/* Input Area */
.input-area {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

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

.input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 25px;
    padding: 0.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: border-color 0.3s;
}

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

#user-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    background: transparent;
}

#user-input::placeholder {
    color: #a0aec0;
}

.input-buttons {
    display: flex;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.input-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f7fafc;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.input-btn:hover:not(:disabled) {
    background: #e2e8f0;
    transform: scale(1.1);
}

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

#search-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

#search-btn:hover {
    background: linear-gradient(135deg, #5a67d8, #6b46c1);
}

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

.loading-overlay.hidden {
    display: none;
}

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

.loading-spinner i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 1rem;
}

.loading-spinner span {
    display: block;
    color: #4a5568;
    font-weight: 500;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar Styles */
.chat-window::-webkit-scrollbar {
    width: 6px;
}

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

.chat-window::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-window::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .chat-window {
        padding: 1rem;
    }
    
    .input-area {
        padding: 1rem;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .welcome-message .message-content {
        max-width: 95%;
    }
    
    .input-buttons {
        gap: 0.25rem;
    }
    
    .input-btn {
        width: 35px;
        height: 35px;
    }
}

/* Rating buttons */
.rating-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

.rating-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.9rem;
}

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

.thumbs-up:hover {
    background: #22c55e;
    color: white;
}

.thumbs-down:hover {
    background: #ef4444;
    color: white;
}

.rating-btn:active {
    transform: scale(0.95);
}

.rating-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
    transform: none !important;
}

.rating-btn:disabled:hover {
    background: #f1f5f9 !important;
    color: #64748b !important;
    transform: none !important;
}

/* Rating popup */
.rating-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.rating-popup {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.rating-popup h3 {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1.5rem;
}

.rating-popup p {
    margin-bottom: 1.5rem;
    color: #64748b;
    line-height: 1.6;
}

.rating-scale {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.scale-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #e2e8f0;
    border-radius: 50%;
    background: white;
    color: #64748b;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s;
}

.scale-btn:hover {
    border-color: #0098ca;
    color: #0098ca;
    transform: scale(1.1);
}

.scale-btn.selected {
    background: #0098ca;
    border-color: #0098ca;
    color: white;
}

.comment-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.comment-section.hidden {
    display: none;
}

.comment-section p {
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.comment-section textarea {
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

.comment-section textarea:focus {
    border-color: #0098ca;
}

.popup-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.popup-buttons button {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.cancel-btn {
    background: #f1f5f9;
    color: #64748b;
}

.cancel-btn:hover {
    background: #e2e8f0;
}

.submit-rating-btn {
    background: #0098ca;
    color: white;
}

.submit-rating-btn:hover:not(:disabled) {
    background: #0284c7;
}

.submit-rating-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

/* Success/Error messages */
.success-message, .error-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    z-index: 3000;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.success-message {
    background: #22c55e;
    color: white;
}

.error-message {
    background: #ef4444;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Management buttons (GT, KB) */
.management-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: bold;
}

.gt-btn {
    background: #22c55e;
    color: white;
}

.gt-btn:hover {
    background: #16a34a;
    transform: scale(1.1);
}

.kb-btn {
    background: #3b82f6;
    color: white;
}

.kb-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

/* Download button */
.download-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    cursor: pointer;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.download-btn:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

/* Admin popup */
.admin-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.admin-popup {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.admin-popup h3 {
    margin-bottom: 1rem;
    color: #1e293b;
}

.admin-popup input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
}

.admin-popup input:focus {
    border-color: #0098ca;
}

/* Upload popup styles */
.upload-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.upload-popup {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.upload-popup h3 {
    margin-bottom: 1rem;
    color: #1e293b;
    font-size: 1.5rem;
}

.upload-popup p {
    margin-bottom: 1.5rem;
    color: #64748b;
    line-height: 1.6;
}

.file-upload-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.file-upload-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #1e293b;
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed #cbd5e0;
    border-radius: 10px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
}

.file-input:hover {
    border-color: #0098ca;
    background: #f0f9ff;
}

.password-section {
    margin-bottom: 1.5rem;
    text-align: left;
}

.password-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #1e293b;
}

.password-section input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: border-color 0.2s;
}

.password-section input:focus {
    border-color: #0098ca;
}

.upload-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.upload-buttons button {
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.upload-cancel-btn {
    background: #f1f5f9;
    color: #64748b;
}

.upload-cancel-btn:hover {
    background: #e2e8f0;
}

.upload-submit-btn {
    background: #0098ca;
    color: white;
}

.upload-submit-btn:hover:not(:disabled) {
    background: #0284c7;
}

.upload-submit-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
}

.selected-file {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f0f9ff;
    border: 1px solid #0098ca;
    border-radius: 5px;
    color: #0c4a6e;
    font-size: 0.9rem;
}

/* Success message */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #22c55e;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(34, 197, 94, 0.3);
    font-weight: 500;
    z-index: 3000;
    animation: successFadeIn 0.3s ease-out;
}

@keyframes successFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (max-width: 480px) {
    .logo span {
        display: none;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    #user-input {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .rating-scale {
        gap: 0.5rem;
    }
    
    .scale-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .rating-popup {
        padding: 1.5rem;
    }
}
