/* ==========================================
   CSS Variables & Theme Setup
   ========================================== */
:root {
    --primary-color: #0d8abc; /* iTutor Blue */
    --primary-dark: #09688e;
    --secondary-color: #f7a01a; /* Accent orange/gold if needed */
    --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364); /* Deep sleek background */
    
    --chat-bg: rgba(255, 255, 255, 0.05);
    --chat-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --text-muted: #a0aec0;
    
    --msg-bot-bg: rgba(255, 255, 255, 0.1);
    --msg-bot-text: #ffffff;
    
    --msg-user-bg: linear-gradient(135deg, #0d8abc, #0a6b92);
    --msg-user-text: #ffffff;
    
    --font-family: 'Outfit', sans-serif;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    
    --shadow-subtle: 0 4px 30px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(13, 138, 188, 0.4);
}

/* ==========================================
   Global Reset
   ========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ==========================================
   Chat Container (Glassmorphism)
   ========================================== */
.chat-container {
    width: 100%;
    max-width: 450px;
    height: 85vh;
    max-height: 800px;
    background: var(--chat-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--chat-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ==========================================
   Header
   ========================================== */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--chat-border);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    position: relative;
    width: 45px;
    height: 45px;
}

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #22c55e; /* Online Green */
    border: 2px solid #203a43;
    border-radius: 50%;
}

.header-text h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
}

.action-btn:hover {
    color: var(--text-main);
    transform: rotate(90deg);
}

/* ==========================================
   Beta Banner
   ========================================== */
.beta-banner {
    background: rgba(247, 160, 26, 0.15);
    border-bottom: 1px solid rgba(247, 160, 26, 0.3);
    padding: 8px 15px;
    text-align: center;
    font-size: 0.8rem;
    color: #fceabb;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.beta-banner i {
    color: var(--secondary-color);
}

/* ==========================================
   Chat Body
   ========================================== */
.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Messages */
.message {
    max-width: 85%;
    padding: 12px 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    animation: fadeIn 0.3s ease forwards;
    word-wrap: break-word;
}

.message.bot {
    align-self: flex-start;
    background: var(--msg-bot-bg);
    color: var(--msg-bot-text);
    border-radius: var(--border-radius-md) var(--border-radius-md) var(--border-radius-md) 0;
    border: 1px solid var(--chat-border);
}

.message.user {
    align-self: flex-end;
    background: var(--msg-user-bg);
    color: var(--msg-user-text);
    border-radius: var(--border-radius-md) var(--border-radius-md) 0 var(--border-radius-md);
    box-shadow: var(--shadow-glow);
}

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

/* Formatted Text within bot messages */
.message.bot strong {
    color: var(--primary-color);
}
.message.bot a {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ==========================================
   Footer & Inputs
   ========================================== */
.chat-footer {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Quick Replies */
.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 5px;
}

.quick-reply-btn {
    background: rgba(13, 138, 188, 0.2);
    border: 1px solid var(--primary-color);
    color: var(--text-main);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-family: var(--font-family);
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeIn 0.4s ease;
}

.quick-reply-btn:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Input Form */
.chat-input-form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input-form input {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 12px 15px;
    border-radius: 24px;
    color: var(--text-main);
    font-family: var(--font-family);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.chat-input-form input::placeholder {
    color: var(--text-muted);
}

.chat-input-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(13, 138, 188, 0.3);
}

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

.send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary-color);
    border: none;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.send-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.send-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ==========================================
   Typing Indicator
   ========================================== */
.typing-indicator {
    align-self: flex-start;
    background: var(--msg-bot-bg);
    padding: 12px 16px;
    border-radius: var(--border-radius-md) var(--border-radius-md) var(--border-radius-md) 0;
    border: 1px solid var(--chat-border);
    display: flex;
    gap: 5px;
    align-items: center;
    width: fit-content;
}

.dot {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

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

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

/* ==========================================
   Responsive adjustments
   ========================================== */
@media (max-width: 480px) {
    .chat-container {
        height: 100vh;
        max-width: 100%;
        border-radius: 0;
        border: none;
    }
    body {
        padding: 0;
    }
}
