* {
    transition: .5s;
}
.sidebar.collapsed ~ .logo-container #logo:hover {
    filter: brightness(1) invert();
}
/* main container layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
}

/* sidebar styles */
.sidebar {
    width: 250px;
    background-color: var(--primary-light);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border-top-right-radius: 10%;
    border-bottom-right-radius: 10%;
    box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.1);
}

/* logo area styles */
.logo-container {
    position: fixed;
    top: 40px;
    left: 0px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-evenly;
    gap: 20px;
    margin-bottom: 60px;
    width: 20%;
}


/* mode selection area */
.mode-title {
    font-family: var(--font-titles);
    font-size: 24px;
    font-weight: bold;
    margin-top:30px;
    margin-bottom: 30px;
    text-align: center;
    color: var(--text-dark);
}

.mode-container {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* animated background selector for active mode */
.mode-selector {
    position: absolute;
    background-color: #a4dff7;
    width: 90%;
    border-radius: 15px;
    z-index: 1;
    transition: top 0.3s ease, height 0.3s ease;
    left: 0;
    top: 0;
    height: 116px; 
}

/* individual mode button styles */
.mode {
    box-sizing: border-box;
    width: 90%;
    background-color: transparent;
    border-radius: 15px;
    padding: 20px 0 20px 20px;
    cursor: pointer;
    z-index: 2;
    transition: transform 0.2s ease;
}
.mode:hover {
    transform: translateX(5px);
}
.mode h3 {
    font-family: var(--font-text);
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--text-dark);
}
.mode p {
    font-family: var(--font-text);
    font-size: 17px;
    color: var(--text-dark);
    line-height: 1.4;
}

/* main content area */
.main-content {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
}

/* chat container layout */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    position: relative; 
    height: 100%;
}

/* message display area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 50px;
    margin-bottom: 90px; 
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%; 
}

/* message bubble styling */
.message {
    position: relative;
    animation: messageAppear 0.3s ease-out;
    max-width: 70%;
}
.message .message-text {
    padding: 15px 20px;
    border-radius: 20px;
    line-height: 1.5;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}
/* message buttons */
.message .message-buttons {
    display: none;
    position: absolute;
    padding: 10px 15px;
    gap: 5px;
}
.message:hover .message-buttons {
    display: flex;
}
.message .message-button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--grey-blue);
    fill: var(--grey-blue);
}
.message .message-button:hover {
    filter: brightness(0.8);
}
.message .copied-info {
    position: absolute;
    bottom: -30px;
    width: fit-content;
    background-color: var(--primary-light);
    color: var(--text-dark);
    padding: 5px 10px;
    border-radius: 5px;
    font-family: var(--font-text);
    font-size: 12px;
    font-weight: bold;
}

/* message appearance animation */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* bot message specific styles */
.bot-message {
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    padding-left: 40px;
}
.bot-message .message-text {
    background-color: var(--primary-light);
    color: var(--text-dark);
}
/* Fix for nested list indentation */
.bot-message ul {
    margin-left: 10px;
    padding-left: 15px;
}

.bot-message ul li {
    margin-bottom: 8px;
    position: relative;
}

/* Style for nested lists */
.bot-message ul ul {
    margin-top: 8px;
    margin-left: 15px;
    padding-left: 20px;
}

/* Fix for bullet markers */
.bot-message ul {
    list-style-type: disc;
}

.bot-message ul ul {
    list-style-type: circle;
}

/* Alternative approach if list styling isn't working properly */
.bot-message ol {
    margin-left: 10px;
    padding-left: 15px;
    counter-reset: item;
}

.bot-message ol li {
    counter-increment: item;
    margin-bottom: 8px;
    position: relative;
}

/* user message specific styles */
.user-message {
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}
.user-message .message-buttons {
    right: 0;
}
.user-message .message-text {
    background-color: var(--primary);
    color: var(--text-dark);
}

/* chat input area */
.chat-input-container {
    display: flex;
    align-items: center;
    padding: 20px 25px;
    background-color: var(--bg);
    border-radius: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 20px 20px 20px;
}
#chat-input {
    box-sizing: border-box;
    height: auto;
    min-height: 15px;
    max-height: 180px;
    overflow-y: auto;
    resize: none;
    padding: 0px 15px;
    margin-bottom: -10px;
    border: none;
    background-color: transparent;
    font-family: var(--font-text-secondary);
    font-size: 16px;
    color: var(--text-dark);
    flex: 1;
    transition: 0.3s;
}

#chat-input:focus {
    outline: none;
}

/* send button */
#send-button {
    background-color: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
#chat-input:not(:placeholder-shown) ~ #send-button {
    cursor: pointer;
}
#chat-input:not(:placeholder-shown) ~ #send-button {
    background-color: var(--primary-saturated);
}
#chat-input:not(:placeholder-shown) ~ #send-button:hover {
    filter: brightness(1.1);
}


/* side buttons */
#side-buttons-container {
    position: absolute;
    top: 40px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.side-button {
    background-color: var(--text-light);
    filter: brightness(0.9);
    color: gray;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.5s;
    z-index: 10;
}
.side-button:hover {
    background-color: #e0e0e0;
    color: #333;
}


/* sidebar toggle */
.sidebar-toggle {
    background-color: var(--primary-light);
    color: var(--text-dark);
    width: 30px;
    height: 30px;
    padding: 20px 0px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.3s;
    position: absolute;
    right: 0px;
    top: 50%;
    transition: transform 0s;
}
.sidebar-toggle:hover {
    background-color: var(--primary);
    color: var(--text-light);
}
.sidebar.collapsed {
    width: 0;
    padding: 0;
}
.sidebar.collapsed *:not(.sidebar-toggle):not(i) {
    display: none;
}
.sidebar-toggle.collapsed {
    translate: 80% 0;
    transform: rotate(180deg);
}
/* adjust chat styling when sidebar is collapsed */
.main-content.expanded {
    padding-top: 100px;
}
.main-content.expanded .chat-container {
    max-width: 80%;
}
/* Add loading animation */
.typing-indicator {
    display: flex;
    align-items: center;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    margin: 0 2px;
    background-color: #555;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    20% {
        transform: scale(1.2);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.4;
    }
}


/* dark mode */
body.dark-mode {
    /* colors */
    --bg: #1e1f22;
    --primary: #019ad9;
    --primary-light: #2b2d31;
    --primary-saturated: #019ad9;
    --accent: #ff6b6b;
    --accent-light: #ff8e8e;
    --text-dark: #f2f3f5;
    --text-light: #ffffff;
    --grey-blue: #b5bac1;
}
body.dark-mode #logo {
    filter: brightness(0) invert(1);
}
body.dark-mode .sidebar ~ .logo-container #logo:hover {
    filter: brightness(1);
}
body.dark-mode .sidebar.collapsed ~ .logo-container #logo:hover {
    filter: brightness(1) invert();
}
body.dark-mode .mode-selector {
    background-color: var(--primary-saturated);
    filter: saturate(0.4);
}
body.dark-mode #send-button {
    filter: saturate(0.4);
}
body.dark-mode #chat-input:not(:placeholder-shown) ~ #send-button {
    filter: saturate(1);
}