@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

:root {
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #87CEEB;
    --primary-variant-color: #3700b3;
    --secondary-color: #03dac6;
    --on-primary-color: #000000;
    --on-surface-color: #ffffff;
    --subtle-text-color: rgba(255, 255, 255, 0.1);
    --blur-color: rgba(30, 30, 30, 0.7);
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--on-surface-color);
    height: 100%;
    overflow: hidden;
    touch-action: manipulation; /* Improve touch responsiveness */
}

.background-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    z-index: 1;
    color: var(--subtle-text-color);
    font-size: 1.5em;
    user-select: none;
    line-height: 1.8;
}

.background-text span {
    cursor: pointer;
    margin: 0 8px;
    transition: color 0.3s ease;
}

.background-text span:hover {
    color: var(--primary-color);
}

#chat-container {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    height: 100%; /* Use 100% to fill the body */
    max-width: 700px;
    margin: 0 auto;
    background-color: var(--blur-color);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

#chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto; /* This is the key for scrolling */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom scrollbar for a modern look */
#chat-box::-webkit-scrollbar {
    width: 6px;
}
#chat-box::-webkit-scrollbar-track {
    background: transparent;
}
#chat-box::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.message {
    padding: 12px 18px;
    border-radius: 22px;
    max-width: 75%;
    line-height: 1.5;
    font-size: 0.95em;
    word-wrap: break-word;
}

.user-message {
    background: #25D366;
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 6px;
}

.gemini-message {
    background-color: #ffffff;
    color: #000000;
    align-self: flex-start;
    border-bottom-left-radius: 6px;
}

.gemini-message span, .user-message span {
    cursor: pointer;
}

#input-container {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background-color: var(--surface-color);
}

#user-input {
    flex: 1;
    padding: 12px 18px;
    border: none;
    border-radius: 22px;
    background-color: var(--background-color);
    color: var(--on-surface-color);
    font-size: 1em;
    transition: box-shadow 0.3s ease;
}

#user-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-color);
}

#send-btn {
    background-color: var(--primary-color);
    color: var(--on-primary-color);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    margin-left: 12px;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

#send-btn:hover {
    background-color: var(--secondary-color);
}

#send-btn::before {
    content: '➤';
    transform: rotate(-45deg) translateY(1px);
}

.popup {
    position: absolute;
    background-color: #fff;
    color: #000;
    padding: 4px 10px;
    border-radius: 6px;
    z-index: 10;
    display: none;
    font-size: 0.9em;
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
    border: 1px solid rgba(0,0,0,0.1);
    transition: opacity 0.2s;
}

/* Responsive adjustments for mobile devices */
@media (max-width: 700px) {
    #chat-container {
        border-left: none;
        border-right: none;
    }

    #chat-box {
        padding: 15px;
        gap: 10px;
    }

    .message {
        padding: 10px 16px;
        max-width: 85%;
        font-size: 1em; /* Slightly larger font for mobile readability */
    }

    #input-container {
        padding: 10px 15px;
    }

    #user-input {
        padding: 10px 16px;
        font-size: 1em;
    }

    #send-btn {
        width: 42px;
        height: 42px;
        margin-left: 10px;
    }
}

@media (max-width: 420px) { /* More specific breakpoint for phones like Galaxy A50 */
    .background-text {
        font-size: 1.2em;
    }

    .message {
        max-width: 90%;
    }
}
