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

:root {
    --primary: #00d4ff;
    --primary-dark: #00a8cc;
    --secondary: #0077b6;
    --bg-dark: #0d1b2a;
    --bg-card: #1b2838;
    --bg-input: #152238;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --border: #234;
    --user-bubble: #0077b6;
    --bot-bubble: #1b3a4b;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 900px;
    background: var(--bg-card);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
}

header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #00d4ff 0%, #0077b6 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-image {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.logo-symbol {
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 400;
}

.nav-tabs {
    display: flex;
    gap: 0.5rem;
}

.nav-tab {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    text-decoration: none;
    color: white;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-tab.active {
    background: rgba(255, 255, 255, 0.25);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.8rem;
    color: white;
    font-weight: 500;
}

.chat-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.messages::-webkit-scrollbar {
    width: 6px;
}

.messages::-webkit-scrollbar-track {
    background: transparent;
}

.messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, #00d4ff 0%, #0077b6 100%);
    color: white;
}

.message.user .message-avatar {
    background: #0077b6;
}

.message-content {
    padding: 0.875rem 1.125rem;
    border-radius: 18px;
    background: var(--bot-bubble);
    border: 1px solid var(--border);
}

.message.user .message-content {
    background: var(--user-bubble);
    border-color: transparent;
}

.message-content p {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.message-meta {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

.input-area {
    padding: 1rem 1.5rem 1.25rem;
    background: var(--bg-input);
    border-top: 1px solid var(--border);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--primary);
}

#user-input {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

#user-input::placeholder {
    color: var(--text-secondary);
}

#send-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4ff 0%, #0077b6 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
}

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

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

#send-btn svg {
    width: 18px;
    height: 18px;
}

.footer-text {
    text-align: center;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
}

.teach-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.75rem auto 0;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.teach-btn:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: #00d4ff;
}

.modal-body {
    padding: 1.5rem;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.modal-body .form-group {
    margin-bottom: 1rem;
}

.modal-body label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    resize: vertical;
}

.modal-body input:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: #00d4ff;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.btn-primary {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

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

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 1.25rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: #00d4ff;
    color: var(--text-primary);
}

/* Collapsible Admin Banner - Left Side */
.admin-banner {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    transition: all 0.3s ease;
}

.banner-toggle {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #00d4ff, #0077b6);
    border: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
}

.banner-toggle:hover {
    background: linear-gradient(135deg, #00b8e6, #0066a0);
    transform: scale(1.05);
}

.toggle-icon {
    transition: transform 0.3s ease;
}

.admin-banner:not(.collapsed) .toggle-icon {
    transform: rotate(180deg);
}

.banner-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 1;
    max-width: 150px;
}

.admin-banner.collapsed .banner-content {
    opacity: 0;
    max-width: 0;
    padding: 0;
    overflow: hidden;
    border: none;
    pointer-events: none;
    visibility: hidden;
}

.banner-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.banner-link:hover {
    background: rgba(0, 212, 255, 0.15);
    color: var(--primary);
}

.banner-link svg {
    flex-shrink: 0;
}

@media (max-width: 600px) {
    body {
        padding: 0;
    }
    
    .container {
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
    
    .message {
        max-width: 90%;
    }
}
