/* Global Styles */
:root {
    --transition-speed: 0.3s;
    --border-radius: 10px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100%;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 100%;
    margin: 0 auto;
}

/* Header Styles */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 2px solid;
    transition: background-color var(--transition-speed), border-color var(--transition-speed), color var(--transition-speed);
}

.app-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0;
    transition: color var(--transition-speed);
}

.header-buttons {
    display: flex;
    align-items: center;
}

.models-button, .settings-button, .new-chat-button {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    transition: color var(--transition-speed), transform 0.2s;
    margin-left: 20px;
}

.models-button:hover, .settings-button:hover, .new-chat-button:hover {
    transform: scale(1.1);
}

.settings-button::before {
    content: '🌙';
}

.new-chat-button {
    font-size: 28px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.hamburger-menu {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    margin-right: 15px;
    transition: transform 0.2s, color var(--transition-speed);
}

.hamburger-menu:hover {
    transform: scale(1.1);
}

/* Slideout Menu Styles */
.slideout-menu {
    position: fixed;
    top: 70px;
    bottom: 100px;
    left: -300px;
    width: 280px;
    background-color: #1C1C1E;
    transition: left var(--transition-speed) ease;
    z-index: 1000;
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow-y: auto;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    box-shadow: var(--box-shadow);
}

.slideout-menu.show {
    left: 0;
}

.slideout-menu h2 {
    color: white;
    margin-bottom: 20px;
    font-size: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.saved-chat {
    display: flex;
    justify-content: space-between;
    background-color: #2C2C2E;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: var(--border-radius);
    color: white;
    cursor: pointer;
    transition: background-color 0.2s;
}

.saved-chat:hover {
    background-color: #3A3A3C;
}

.saved-chat button {
    background: none;
    border: none;
    color: #FF453A;
    cursor: pointer;
    font-size: 18px;
    transition: color 0.2s;
}

.saved-chat button:hover {
    color: #FF6B6B;
}

/* Chat Container Styles */
.chat-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column-reverse;
}

.message {
    margin-top: 15px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    max-width: 70%;
    font-size: 16px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease-out;
    box-shadow: var(--box-shadow);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    align-self: flex-end;
}

.bot-message {
    align-self: flex-start;
}

/* Input Container Styles */
.input-container {
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    border-top: 2px solid;
    transition: background-color var(--transition-speed), border-color var(--transition-speed);
}

.input-row {
    display: flex;
    align-items: center;
}

#user-input {
    flex-grow: 1;
    padding: 15px;
    border: 2px solid;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: background-color var(--transition-speed), color var(--transition-speed), border-color var(--transition-speed), box-shadow 0.2s;
}

#user-input:focus {
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.5);
}

#send-button {
    background: none;
    border: none;
    padding: 0;
    margin-left: 15px;
    transition: transform 0.2s;
    color: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #007AFF;
}

#send-button:hover {
    transform: scale(1.1);
}

#send-button svg {
    fill: white;
    width: 24px;
    height: 24px;
}

.disclaimer {
    font-size: 12px;
    margin-top: 10px;
    text-align: center;
    transition: color var(--transition-speed);
    opacity: 0.7;
}

/* Typing Indicator Styles */
.typing-indicator {
    display: flex;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    align-self: flex-start;
    margin-top: 15px;
}

.typing-indicator span {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Models Page Styles */
.models-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: 30px;
    height: calc(100vh - 100px);
    align-items: center;
}

.model-tile {
    width: 180px;
    height: 180px;
    margin: 15px;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--box-shadow);
}

.model-tile:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.15);
}

.model-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.model-name {
    font-size: 16px;
    text-align: center;
    font-weight: 600;
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 32px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.back-button:hover {
    transform: scale(1.1);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--box-shadow);
}

.modal button {
    padding: 12px 24px;
    margin-top: 20px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.2s;
}

.modal button:hover {
    transform: scale(1.05);
}

.modal button.save {
    background-color: #007AFF;
    color: white;
}

.modal button.cancel {
    background-color: #FF453A;
    color: white;
    margin-left: 10px;
}

/* Delete Confirmation Modal Styles */
#delete-confirmation-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1001;
}

.delete-modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: var(--border-radius);
    text-align: center;
    max-width: 400px;
    width: 90%;
    color: #000;
    box-shadow: var(--box-shadow);
}

.delete-modal-content p {
    font-size: 18px;
    margin-bottom: 25px;
    color: #000;
}

.delete-modal-content button {
    padding: 12px 24px;
    margin: 0 10px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.2s, transform 0.2s;
}

.delete-modal-content button:hover {
    transform: scale(1.05);
}

.delete-modal-content button.confirm {
    background-color: #FF453A;
    color: white;
}

.delete-modal-content button.cancel {
    background-color: #007AFF;
    color: white;
}

/* Responsive Design */
@media only screen and (max-width: 768px) {
    .chat-header {
        padding: 10px 15px;
    }

    .app-title {
        font-size: 20px;
    }

    .header-buttons {
        gap: 10px;
    }

    .models-button, .settings-button, .new-chat-button {
        font-size: 20px;
        margin-left: 10px;
    }

    .new-chat-button {
        font-size: 24px;
        width: 28px;
        height: 28px;
    }

    .hamburger-menu {
        font-size: 20px;
    }

    .weather-widget {
        margin-left: 10px;
    }

    .message {
        max-width: 85%;
    }

    .input-container {
        padding: 10px 15px;
    }

    #user-input {
        padding: 12px;
        font-size: 14px;
    }

    #send-button {
        width: 40px;
        height: 40px;
    }

    .model-tile {
        width: 140px;
        height: 140px;
        margin: 10px;
    }

    .model-icon {
        font-size: 48px;
    }

    .model-name {
        font-size: 14px;
    }
}

/* Theme Styles */
body.light-mode {
    background-color: #F2F2F7;
    color: #1C1C1E;
}

.light-mode .chat-header {
    background-color: #FFFFFF;
    border-bottom-color: #E5E5EA;
}

.light-mode .settings-button, .light-mode .models-button, .light-mode .new-chat-button {
    color: #1C1C1E;
}

.light-mode .user-message {
    background-color: #007AFF;
    color: #FFFFFF;
}

.light-mode .bot-message {
    background-color: #E5E5EA;
    color: #1C1C1E;
}

.light-mode .input-container {
    background-color: #FFFFFF;
    border-top-color: #E5E5EA;
}

.light-mode #user-input {
    background-color: #F2F2F7;
    color: #1C1C1E;
    border-color: #E5E5EA;
}

.light-mode #send-button {
    background-color: #007AFF;
}

.light-mode .disclaimer {
    color: #8E8E93;
}

.light-mode .typing-indicator {
    background-color: #E5E5EA;
}

.light-mode .typing-indicator span {
    background-color: #8E8E93;
}

.light-mode .model-tile {
    background-color: #FFFFFF;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

body.dark-mode {
    background-color: #1C1C1E;
    color: #FFFFFF;
}

.dark-mode .chat-header {
    background-color: #2C2C2E;
    border-bottom-color: #3A3A3C;
}

.dark-mode .settings-button, .dark-mode .models-button, .dark-mode .new-chat-button {
    color: #FFFFFF;
}

.dark-mode .user-message {
    background-color: #0A84FF;
    color: #FFFFFF;
}

.dark-mode .bot-message {
    background-color: #2C2C2E;
    color: #FFFFFF;
}

.dark-mode .input-container {
    background-color: #2C2C2E;
    border-top-color: #3A3A3C;
}

.dark-mode #user-input {
    background-color: #1C1C1E;
    color: #FFFFFF;
    border-color: #3A3A3C;
}

.dark-mode #send-button {
    background-color: #0A84FF;
}

.dark-mode .disclaimer {
    color: #8E8E93;
}

.dark-mode .typing-indicator {
    background-color: #2C2C2E;
}

.dark-mode .typing-indicator span {
    background-color: #8E8E93;
}

.dark-mode .model-tile {
    background-color: #2C2C2E;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Change hamburger menu color to white in dark mode */
.dark-mode .hamburger-menu {
    color: #FFFFFF;
}

/* Accessibility Improvements */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better keyboard navigation */
button:focus,
input:focus {
    outline: 2px solid #007AFF;
    outline-offset: 2px;
}

/* Ensure sufficient color contrast */
.light-mode .disclaimer,
.dark-mode .disclaimer {
    color: #6E6E73;
}
.models-header {
    display: flex;
    align-items: center;  /* Ensures vertical alignment of the button and title */
    justify-content: start;  /* Align items to the start (left) */
    padding: 10px;  /* Add some padding for spacing */
    position: relative;  /* So the button and title stay within the bounds */
}

.back-arrow {
    margin-right: 10px;  /* Space between the button and title */
    font-size: 24px;  /* Increase font size to make the arrow bigger */
    border: none;  /* Remove button border if there is one */
    background: none;  /* Remove default button background */
    cursor: pointer;  /* Make it appear clickable */
}


.models-title {
    font-size: 24px;  /* Adjust the size of the header text */
    font-weight: bold;  /* Make it bold */
}

/* Improve readability */
.message,
#user-input,
.modal-content,
.delete-modal-content {
    font-size: 16px;
    line-height: 1.5;
}

/* Enhance touch targets for mobile */
@media (max-width: 768px) {
    .models-button,
    .settings-button,
    .new-chat-button,
    .hamburger-menu,
    #send-button {
        min-width: 44px;
        min-height: 44px;
    }
}