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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 700px;
    height: 90vh;
    max-height: 800px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    color: white;
    padding: 20px 25px 25px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
}

.header-guru {
    width: 240px;
    height: 240px;
    border-radius: 50%;
    border: 5px solid rgba(255, 255, 255, 0.6);
    object-fit: cover;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.header-text h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.header-text p {
    font-size: 0.9rem;
    opacity: 0.9;
}

.new-chat-btn {
    position: absolute;
    right: 15px;
    top: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f8f9fa;
}

.message {
    max-width: 80%;
    animation: fadeIn 0.3s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

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

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

.bot-message {
    align-self: flex-start;
}

.guru-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-content {
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.user-message .message-content {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bot-message .message-content p {
    margin-bottom: 12px;
}

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

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

#chat-form {
    display: flex;
    gap: 10px;
}

#user-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

#user-input:focus {
    border-color: #2d5a3d;
}

#send-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(45, 90, 61, 0.4);
}

#send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.book-credit {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    margin-top: 12px;
}

.book-credit em {
    font-style: italic;
}

.typing-indicator {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 80%;
}

.typing-indicator .guru-avatar {
    width: 40px;
    height: 40px;
}

.typing-dots {
    display: flex;
    gap: 5px;
    padding: 15px 20px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #2d5a3d;
    border-radius: 50%;
    animation: bounce 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 bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

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

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

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

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

/* Mobile responsive */
@media (max-width: 600px) {
    body {
        padding: 0;
        align-items: flex-start;
    }

    .chat-container {
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .message {
        max-width: 90%;
    }

    .new-chat-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    .header-guru {
        width: 160px;
        height: 160px;
    }

    .header-text h1 {
        font-size: 1.3rem;
    }

    .guru-avatar {
        width: 32px;
        height: 32px;
    }
}

/* PWA Install Prompt — bottom sheet */
.pwa-install-prompt {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: 700px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 30px rgba(0, 0, 0, 0.18);
    padding: 20px 24px 32px;
    z-index: 1000;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.pwa-install-prompt.visible {
    transform: translateX(-50%) translateY(0);
}

.pwa-dismiss-btn {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.pwa-dismiss-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.pwa-prompt-inner {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pwa-prompt-icon {
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.pwa-prompt-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: #333;
    padding-right: 24px;
}

.pwa-prompt-text strong {
    font-size: 1rem;
    color: #1a472a;
}

.pwa-prompt-text span {
    color: #555;
    line-height: 1.5;
}

.pwa-add-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.pwa-add-btn:hover {
    opacity: 0.9;
}

@media (max-width: 600px) {
    .pwa-install-prompt {
        left: 0;
        max-width: 100%;
        transform: translateY(100%);
        border-radius: 16px 16px 0 0;
    }

    .pwa-install-prompt.visible {
        transform: translateY(0);
    }
}
