body {
    font-family: 'Roboto', sans-serif;
    background-color: #2d2d2a;
    color: #FFFFFF;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1 {
    font-family: 'Playfair Display', serif;
    font-size: 48px;
    margin: 0;
}

.plan-badge {
    background-color: #4B4C55;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 18px;
    display: inline-block;
}

.chat-area {
    background-color: #333331;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-area.collapsed {
    max-height: 150px; /* Adjust this value as needed */
}

.chat-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.greeting {
    font-size: 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.logo {
    margin-right: 10px;
    font-size: 28px;
}

.message-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.message {
    max-width: 70%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.user-message {
    align-self: flex-end;
    background-color: #7B61FF;
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto; /* Ensures the message is not cut off */
}

.ai-message {
    align-self: flex-start;
    background-color: #4B4C55;
    color: white;
    border-bottom-left-radius: 4px;
}

.error-message {
    background-color: #FF6B6B;
    color: #FFFFFF;
    text-align: center;
}

.loading-message {
    background-color: #7B61FF;
    color: #FFFFFF;
    text-align: center;
}

.input-area {
    margin-top: 20px;
}

textarea {
    width: 100%;
    height: 50px;
    background-color: #393937;
    border: none;
    border-radius: 15px;
    padding: 10px 15px;
    color: #FFFFFF;
    font-size: 16px;
    resize: none;
    font-family: 'Roboto', sans-serif;
    transition: height 0.3s ease;
    box-sizing: border-box;
}

textarea:focus {
    height: 100px;
    outline: none;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    background-color: #7B61FF;
    border: none;
    border-radius: 15px;
    padding: 10px 15px;
    color: #FFFFFF;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    transition: background-color 0.3s ease;
    font-size: 14px;
}

.btn:hover {
    background-color: #6A50E0;
}

.send-icon {
    width: 24px;
    height: 24px;
    color: #FFFFFF;
}

.recent-chats {
    margin-top: 20px;
}

.recent-chats h3 {
    font-size: 18px;
    margin-bottom: 15px;
}

.chat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.chat-item {
    background-color: #333331;
    border-radius: 15px;
    padding: 15px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s ease;
}

.chat-item:hover {
    background-color: #4B4C55;
}

.chat-icon {
    font-size: 24px;
    margin-bottom: 10px;
    display: block;
}

.chat-item h4 {
    font-size: 16px;
    margin: 0 0 5px 0;
}

.chat-item p {
    font-size: 14px;
    color: #A9A9B2;
    margin: 0;
}

.view-all {
    color: #7B61FF;
    text-decoration: none;
    font-size: 14px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    transition: color 0.3s ease;
}

.view-all:hover {
    color: #6A50E0;
}

.delete-icon {
    position: absolute;
    top: 5px;
    right: 5px;
    cursor: pointer;
    font-size: 18px;
    color: #A9A9B2;
    transition: color 0.3s ease;
}

.delete-icon:hover {
    color: #FF6B6B;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #333331;
    margin: 15% auto;
    padding: 20px;
    border-radius: 15px;
    width: 80%;
    max-width: 500px;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content label {
    display: block;
    margin-top: 10px;
}

.modal-content select {
    width: 100%;
    padding: 5px;
    margin-top: 5px;
    background-color: #393937;
    color: #FFFFFF;
    border: none;
    border-radius: 5px;
}

.modal-content button {
    margin-top: 20px;
}

.hidden {
    display: none;
}

.slide-in {
    animation: slideIn 0.5s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .header h1 {
        font-size: 36px;
    }

    .plan-badge {
        font-size: 14px;
    }

    .greeting {
        font-size: 20px;
    }

    .logo {
        font-size: 24px;
    }

    .chat-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .action-buttons {
        flex-wrap: wrap;
    }

    .btn {
        font-size: 12px;
        padding: 8px 12px;
    }
}

@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}