* {
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    margin: 0;
    overflow: hidden; /* Added to prevent scrollbars from the circles */
}

/* --- COPIED FROM style2.css --- */
.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(-45deg, rgba(122, 126, 188, 0.65), rgba(250, 208, 196, 0.65), rgba(161, 140, 209, 0.35), rgba(251, 194, 235, 0.65));
    background-size: 400% 400%;
    animation: gradientShift 40s ease infinite; /* Your original animation */
    z-index: 0;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    filter: blur(40px);
    z-index: 1;
	transition: opacity 0.5s ease; 
}

.circle-1 {
    width: 300px;
    height: 300px;
    background-color: rgba(173, 216, 230, 0.4);
}

.circle-2 {
    width: 250px;
    height: 250px;
    background-color: rgba(255, 255, 255, 0.4);
}

.circle-3 {
    width: 200px;
    height: 200px;
    background-color: rgba(13, 79, 179, 0.1);
}

.circle-4 {
    width: 350px;
    height: 350px;
    background-color: rgba(141, 255, 255, 0.2);
}
/* --- END OF COPIED STYLES --- */


@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}



#chat-container {
	position: relative;
    z-index: 2; /* MODIFIED: Set z-index to 2 */
    width: calc(100% - 250px);
	height: calc(100% - 130px);
	background: rgba(255,255,255,0);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 35px rgba(255,255,255,0.05);
    overflow: hidden;
}

/* HEADER */
#chat-header {
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#chat-header h2 {
	color: black;
    margin: 0;
    font-size: 2rem;
}

/* CHAT LOG */
#chat-log {
	display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 4%;
    overflow-y: auto;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.5));
    scroll-behavior: smooth;
	/* For Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
    min-height: 0;
}

.message {
	color: #282828;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-in-out;
	padding: 12px 16px;
    border-radius: 20px;
	font-size: 1rem;
	position: relative;
	box-shadow: 0 2px 5px rgba(0,0,0,0.08);
	max-width: 75%;
}

/* USER MESSAGE */
.user-message {
	align-self: flex-end;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.07));
	border-bottom-right-radius: 6px;
}

/* BOT MESSAGE */
.bot-message {
	align-self: flex-start;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.2));
	border-bottom-left-radius: 6px;
}

/* INPUT BAR */
#input-container {
    display: flex;
    align-items: center;
    padding: 12px;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.3));
    border-top: 1px solid #ddd;
    gap: 8px;
}

#user-input {
    flex-grow: 1;
    border: 1px solid #ccc;
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    transition: border-color 0.3s, box-shadow 0.3s, border-radius 0.3s;
    /* Properties for auto-resizing */
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    max-height: 100px; /* Adjust this value as needed */
    /* Scrollbar styling for Firefox */
    scrollbar-width: thin;
    scrollbar-color: rgba(0,0,0,0.15) transparent;
	box-sizing: border-box;
}

#user-input:focus {
    outline: none;
    border-color: rgba(0,0,0,0.2);
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

#user-input.expanded {
    border-radius: 10px; /* A sharper radius. Adjust this value to your liking! */
}

#send-button {
    border: none;
    background-color: black;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

#send-button:hover {
    background-color: #464646;
    transform: scale(1.05);
}

/* ANIMATIONS */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.btn-toggle {
	padding: 7px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background-color: #000000;
    color: #ffffff;
    font-size: 1rem;
    transition: background 0.3s, color 0.3s;
}

.btn-toggle:hover {
    opacity: 0.85;
}

/* MOBILE RESPONSIVE */
@media (max-width: 1100px) {
    body {
        align-items: flex-start; /* Stop centering vertically on mobile */
    }
    #chat-container {
        width: 100%;
        height: var(--app-height, 100dvh); /* This is the correct height */
        max-height: var(--app-height, 100dvh);
        border-radius: 0;
    }
/*	#chat-header h2 {
	color: black;
    margin: 0;
}*/
}

@media (max-width: 750px) {
	.btn-toggle {
	font-size: 0.9rem;
	}

}


@media (max-width: 500px) {
	#chat-header h2 {
	color: black;
    margin: 0;
    font-size: 1.6rem;
}
	.btn-toggle {
	font-size: 0.85rem;
	}
}



@media (max-width: 370px) {
	.btn-toggle {
	font-size: 0.75rem;
	}
	#chat-header h2 {
    font-size: 1.35rem;
}
	#user-input {
	font-size: 0.9rem;
}
}

@media (max-width: 330px) {
	.btn-toggle {
	font-size: 0.7rem;
	}
	#chat-header h2 {
    font-size: 1.25rem;
}
	#user-input {
	font-size: 0.9rem;
}
}


/* --- DARK MODE STYLES --- */

body.dark .circle {
    opacity: 0.3;
}


body.dark .background {
    background: linear-gradient(-45deg, #00003A, #001E00, #000028, #280000);
    background-size: 400% 400%;
    animation: gradientShift 40s ease infinite;
}

body.dark #chat-header h2 {
    color: white;
}

body.dark .btn-toggle {
    background-color: white;
    color: black;
}

body.dark #chat-header {
	background: linear-gradient(135deg, rgba(155, 155, 155, 0.5), rgba(155, 155, 155, 0.3));
}


body.dark #chat-log {
	background: linear-gradient(135deg, rgba(155, 155, 155, 0.3), rgba(155, 155, 155, 0.5));
}

body.dark #input-container {
	background: linear-gradient(135deg, rgba(155, 155, 155, 0.5), rgba(155, 155, 155, 0.3));
}


body.dark #send-button {
    background-color: white;
    color: black;
}

body.dark #send-button:hover {
    background-color: #C8C8C8;
}

body.dark .user-message {
	color: white;
}

body.dark .bot-message {
	color: white;
}

body.dark .user-message {
	background: linear-gradient(135deg, rgba(155, 155, 155, 0.2), rgba(155, 155, 155, 0.07));
}

body.dark .bot-message {
	background: linear-gradient(135deg, rgba(155, 155, 155, 0.07), rgba(155, 155, 155, 0.2));
}


body.dark #chat-container {
    box-shadow: 0 15px 35px rgba(255,255,255,0.2);
}

body.dark #user-input {
	background: #232323;
	color: #E6E6E6;
	border: 1px solid #3d3d3d;
}

body.dark #user-input:focus {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.15);
}

body.dark #input-container {
    border-top: 1px solid #878787;
}



/* --- STYLING THE SCROLLBARS (FOR CHAT AND INPUT) --- */
/* This targets the scrollbar in WebKit browsers (Chrome, Safari, Edge) */
#chat-log::-webkit-scrollbar,
#user-input::-webkit-scrollbar {
    width: 8px;
}

#chat-log::-webkit-scrollbar-track,
#user-input::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 20px;
}

#chat-log::-webkit-scrollbar-thumb,
#user-input::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}


#chat-log::-webkit-scrollbar-thumb:hover,
#user-input::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.2);
}

/* --- DARK MODE SCROLLBAR FIX --- */

body.dark #user-input::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.20); /* lighter thumb */
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: content-box;
}

body.dark #user-input::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.55); /* brighter on hover */
}

/* Firefox support */
body.dark #user-input {
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}