* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    font-size: 20px;
    color: var(--accent-color);
}

body {
    background: var(--primary-color);
    background-size: 40px 40px;
    background-position: 0 0;
    transition: background-color 1s cubic-bezier(0.4, 0, 0.2, 1),
        color 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Add subtle background animation */
@keyframes backgroundShift {
    0% {
        background-position: 0 0;
    }

    50% {
        background-position: 20px 20px;
    }

    100% {
        background-position: 0 0;
    }
}

body:hover {
    animation: backgroundShift 30s infinite alternate ease-in-out;
}

.header,
.chat-list .message,
.typing-form {
    margin: 0 auto;
    max-width: 1000px;
}

.header {
    margin-top: 1vh;
    padding: 1rem;
    overflow-x: hidden;
    position: relative;
    transition: transform var(--transition-medium), opacity var(--transition-medium);
}

.header:hover {
    transform: scale(1.02);
}

body.hide-header .header {
    margin: 0;
    display: none;
    transform: translateY(-50px);
    opacity: 0;
}

.header :where(.title, .subtitle) {
    color: var(--text-color);
    font-weight: 800;
    line-height: 4rem;
}

.header .title {
    width: fit-content;
    font-size: 3rem;
    background-clip: text;
    background: linear-gradient(45deg, #FF74A6, #FFB6C1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
    letter-spacing: -1px;
    transition: transform var(--transition-medium);
}

.header .title:hover {
    transform: translateY(-3px);
}

.header .title::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 5px;
    width: 50%;
    background: linear-gradient(90deg, #FF74A6, #FFB6C1);
    border-radius: 5px;
    transition: width var(--transition-elastic), transform var(--transition-elastic);
    transform-origin: left;
}

.header .title:hover::after {
    width: 100%;
    transform: scaleX(1.03) translateY(2px);
}

.header .subtitle {
    font-size: 2rem;
    color: var(--subheading-color);
    font-weight: 500;
    transition: transform var(--transition-medium), opacity 0.3s ease;
}

.subtitle.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.subtitle.fade-in {
    opacity: 0.9;
    transform: translateY(0);
}

.header .subtitle:hover {
    transform: translateX(5px);
    opacity: 0.9;
}

.text {
    opacity: 0;
    animation: textFade 0.5s ease forwards;
    animation-delay: calc(var(--card-index, 0) * 0.1s + 0.3s);
}

@keyframes textFade {
    0% {
        opacity: 0;
        transform: translateY(10px);
    }

    100% {
        opacity: 1;
        transform: translateY(-5px);
    }
}

.textmessage {
    max-width: 58vw;
}

.chat-list {
    padding: 2rem 1rem 12rem;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-color: var(--accent-color) transparent;
    scroll-behavior: smooth;
}

.chat-list .message.incoming {
    margin-top: 1.5rem;
    padding: 0.5rem;
    border-radius: 1.25rem;
    position: relative;
    overflow: hidden;
}

.chat-list .message.incoming:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    transition: width var(--transition-slow);
}

.chat-list .message.incoming:hover:after {
    width: 100%;
}

.chat-list .message .message-content {
    display: flex;
    gap: 1.5rem;
    width: 100%;
    align-items: flex-start;
}

.chat-list .message .text {
    color: var(--text-color);
    line-height: 1.6;
    transition: transform 0.3s ease;
}

.chat-list .message.error .text {
    color: #FF6B8B;
}

.chat-list .message.loading .text {
    display: none;
}

.chat-list .message .avatar {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 16px;
    align-self: flex-start;
    box-shadow: 0 4px 10px rgba(255, 116, 166, 0.25);
    border: 2px solid var(--accent-color);
    padding: 2px;
    transition: all var(--transition-medium);
}

@keyframes rotate {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(3deg);
    }

    75% {
        transform: rotate(-3deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.chat-list .message .icon {
    color: var(--text-color);
    cursor: pointer;
    height: 35px;
    width: 35px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    font-size: 1.25rem;
    margin-left: 0.5rem;
    visibility: hidden;
    opacity: 0;
    transition: all var(--transition-fast);
    transform: translateY(10px);
}

.chat-list .message .icon.hide {
    visibility: hidden;
    opacity: 0;
}

.chat-list .message:not(.loading, .error):hover .icon:not(.hide) {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}

.chat-list .message .icon:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-5px) scale(1.15);
    box-shadow: 0 5px 15px rgba(255, 116, 166, 0.4);
}

.chat-list .message .icon:active {
    transform: translateY(-2px) scale(0.95);
    transition: all 0.1s ease;
}

/* Message actions container */
.message-actions {
    display: flex;
    align-items: center;
    margin-left: 3.5rem;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .message-actions {
        margin-left: 2.5rem;
        gap: 0.3rem;
    }
}

.chat-list .message .loading-indicator {
    display: none;
    gap: 0.8rem;
    width: 100%;
    flex-direction: column;
}

.chat-list .message.loading .loading-indicator {
    display: flex;
}

.chat-list .message .loading-indicator .loading-bar {
    height: 8px;
    width: 100%;
    border-radius: 8px;
    background-position: -800px 0;
    background: linear-gradient(to right, var(--accent-color), var(--primary-color), var(--accent-secondary));
    animation: loading 2s cubic-bezier(0.34, 1.56, 0.64, 1) infinite;
    box-shadow: 0 2px 10px rgba(255, 116, 166, 0.4);
    transform-origin: left;
    transition: all 0.3s ease;
}

.chat-list .message .loading-indicator .loading-bar:hover {
    transform: scaleY(1.5);
    box-shadow: 0 4px 15px rgba(255, 116, 166, 0.6);
}

.chat-list .message .loading-indicator .loading-bar:last-child {
    width: 70%;
}

@keyframes loading {
    0% {
        background-position: -800px 0;
        opacity: 0.8;
    }

    50% {
        opacity: 1;
    }

    100% {
        background-position: 800px 0;
        opacity: 0.8;
    }
}

.typing-area {
    position: fixed;
    width: 100%;
    left: 0;
    bottom: 0;
    padding: 2.5rem 1.5rem 1.5rem;
    background: transparent;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, padding 0.3s ease, opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1;
    pointer-events: all;
    visibility: visible;
    opacity: 1;
}

.typing-area:focus-within {
    padding-top: 2rem;
    transform: translateY(-5px);
}

.typing-area :where(.typing-form, .action-buttons) {
    display: flex;
    gap: 0.75rem;
}

.typing-form .input-wrapper {
    width: 100%;
    height: 60px;
    display: flex;
    position: relative;
    transition: all var(--transition-medium);
}

.typing-form .input-wrapper:focus-within {
    transform: scale(1.02);
}

.typing-form .typing-input {
    height: 100%;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    font-size: 1rem;
    color: var(--text-color);
    padding: 1.1rem 4rem 1.1rem 1.5rem;
    border-radius: 30px;
    background: var(--secondary-color);
    transition: all var(--transition-medium);
    box-shadow: 0 4px 15px rgba(255, 116, 166, 0.15);
    border: 1px solid rgba(255, 116, 166, 0.1);
}

.typing-form .typing-input:focus {
    background: var(--secondary-hover-color);
    box-shadow: 0 8px 25px rgba(255, 116, 166, 0.35);
    border: 1px solid rgba(255, 116, 166, 0.4);
}

.typing-form .typing-input::placeholder {
    color: var(--placeholder-color);
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.typing-form .typing-input:focus::placeholder {
    opacity: 0.5;
    transform: translateX(5px);
}

.typing-area .icon {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    cursor: pointer;
    border-radius: 30px;
    display: flex;
    font-size: 1.4rem;
    color: var(--text-color);
    align-items: center;
    justify-content: center;
    background: transparent;
    transition: all var(--transition-elastic);
    box-shadow: 0 4px 15px rgba(255, 116, 166, 0.15);
    border: 1px solid rgba(255, 116, 166, 0.1);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.typing-area .icon:hover {
    background: transparent;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 25px rgba(255, 116, 166, 0.35);
    border: 1px solid var(--accent-color);
}

.typing-area .icon:active {
    transform: translateY(-2px) scale(0.95);
    transition: all 0.1s ease;
}

.typing-area .icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.typing-area .icon:hover::after {
    opacity: 0.2;
    transform: scale(2);
}

.typing-form #send-message-button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    outline: none;
    border: none;
    background: var(--accent-color);
    color: white;
    height: 40px;
    width: 40px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-elastic);
    opacity: 0;
    cursor: pointer;
    overflow: hidden;
    z-index: 1;
}

.typing-form .typing-input:valid~#send-message-button {
    transform: translateY(-50%) scale(1) rotate(0deg);
    opacity: 1;
}

.typing-form #send-message-button:hover {
    background: linear-gradient(45deg, var(--accent-color), var(--accent-secondary));
    box-shadow: 0 5px 15px rgba(255, 116, 166, 0.4);
    transform: translateY(-50%) scale(1.15) rotate(5deg);
}

.typing-form #send-message-button:active {
    transform: translateY(-50%) scale(0.9) rotate(0deg);
    transition: all 0.1s ease;
}

.typing-form #send-message-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transform: scale(0);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.typing-form #send-message-button:hover::before {
    opacity: 1;
    transform: scale(1);
}

.typing-area .disclaimer-text {
    text-align: center;
    font-size: 0.85rem;
    margin-top: 1rem;
    color: var(--placeholder-color);
    transition: all var(--transition-medium);
    opacity: 0.7;
}

/* Add new entrance animations for messages */
@keyframes messageEntrance {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-list .message {
    animation: messageEntrance 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Add smooth transition for theme changes */
body,
* {
    transition-property: background-color, color, border-color, box-shadow, transform, opacity;
    transition-duration: 0.5s;
    transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Interactive hover effects for clickable elements */
.clickable {
    position: relative;
    overflow: hidden;
}

.clickable::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
    z-index: -1;
}

.clickable:hover::after {
    opacity: 0.18;
    transform: translate(-50%, -50%) scale(1);
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.clickable:active::after {
    opacity: 0.32;
    transform: translate(-50%, -50%) scale(0.7);
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Interactive text effects */
.interactive-text {
    transition: all var(--transition-medium);
    display: inline-block;
}

.interactive-text:hover {
    transform: translateY(-3px) scale(1.05);
    text-shadow: 0 5px 10px rgba(255, 116, 166, 0.4);
}

/* Responsive media query code for small screen */
@media (max-width: 768px) {
    .header :is(.title, .subtitle) {
        font-size: 2rem;
        line-height: 2.6rem;
    }

    .header .subtitle {
        font-size: 1.7rem;
    }

    .typing-area :where(.typing-form, .action-buttons) {
        gap: 0.4rem;
    }

    .typing-form .input-wrapper {
        height: 54px;
    }

    .typing-form .typing-input {
        padding: 1.1rem 3.5rem 1.1rem 1.2rem;
        border-radius: 16px;
    }

    .typing-area .icon {
        height: 54px;
        width: 54px;
        border-radius: 16px;
    }

    .typing-area .disclaimer-text {
        font-size: 0.75rem;
        margin-top: 0.5rem;
    }

    /* Optimize animations for mobile */
    :root {
        --hover-lift: -5px;
        /* Smaller hover lift for mobile */
        --transition-elastic: 0.5s cubic-bezier(0.68, -0.6, 0.32, 1.6);
        /* Slightly faster */
    }
}

/* Add interactive focus states for better accessibility */
:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-color);
}

/* Smooth scrolling for page */
html {
    scroll-behavior: smooth;
}

/* Optional: Add subtle hover animation for all elements with a class */
[class]:not(body):hover {
    z-index: 1;
}

/* Add subtle motion when the page loads */
@keyframes pageLoad {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body>* {
    animation: pageLoad 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--animation-order, 0) * 0.1s);
}

/* Add animation order to key elements */
.header {
    --animation-order: 1;
}

.chat-list {
    --animation-order: 3;
}

.typing-area {
    --animation-order: 4;
}

/* Message action buttons */
.message-actions {
    display: flex;
    align-items: center;
    margin-left: 2px;
    /* Smaller margin from message text */
}

.action-icon {
    cursor: pointer;
    font-size: 1rem;
    /* Slightly smaller icons */
    opacity: 0.7;
    transition: opacity 0.2s ease, transform 0.1s ease;
    padding: 2px;
    /* Add some padding for better touch targets */
}

.action-icon:hover {
    opacity: 1;
    transform: scale(1.1);
    /* Slight grow effect on hover */
}

.edit-icon {
    color: #505050;
}

.retry-icon {
    color: #2c7be5;
}

/* Positioning for the message content */
.message-content {
    display: flex;
}

.message .text {
    flex: 1;
    /* Allow text to take available space */
    margin-right: 2px;
    /* Small margin before icons */
}

/* States */
.message.outgoing.editing {
    opacity: 0.7;
    position: relative;
}

.message.editing::after {
    content: "Editing...";
    position: absolute;
    top: 0;
    right: 0;
    background: var(--secondary-color);
    color: var(--text-color);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.message.outgoing.retrying {
    opacity: 0.7;
    position: relative;
}

.message.retrying::after {
    content: "Retrying...";
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(0, 0, 32, 0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .action-icon {
        font-size: 0.9rem;
        /* Even smaller on mobile */
        padding: 1px;
    }

    .message-actions {
        gap: 2px;
    }
}

/* Mobile-optimized styles */
@media screen and (max-width: 768px) {

    /* Root variables adjustment for mobile */
    :root {
        --hover-lift: -3px;
        /* Reduced hover lift for mobile */
        --transition-fast: 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
        /* Faster transitions for mobile */
        --transition-medium: 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        --transition-slow: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
        --transition-elastic: 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
    }

    /* Header adjustments */
    .header {
        margin-top: 3vh;
        padding: 0.75rem;
    }

    .header :where(.title, .subtitle) {
        font-size: 1.8rem;
        line-height: 2.2rem;
    }

    .header .subtitle {
        font-size: 1.5rem;
    }

    .header .title::after {
        height: 3px;
    }

    /* Chat list */
    .chat-list {
        padding: 1rem 0.75rem 10rem;
    }

    .chat-list .message.incoming {
        margin-top: 1rem;
        padding: 0.4rem;
        border-radius: 1rem;
    }

    .chat-list .message.incoming:after {
        height: 1px;
    }

    .chat-list .message .message-content {
        gap: 1rem;
    }

    .chat-list .message .avatar {
        width: 35px;
        height: 35px;
        border-radius: 12px;
    }

    .chat-list .message:hover .avatar {
        border-width: 2px;
    }

    .chat-list .message .icon {
        height: 28px;
        width: 28px;
        border-radius: 8px;
        font-size: 1rem;
        margin-left: 2.5rem;
    }

    .chat-list .message .icon:hover {
        transform: translateY(-3px) scale(1.1);
    }

    .chat-list .message .loading-indicator .loading-bar {
        height: 6px;
        border-radius: 6px;
    }

    /* Typing area */
    .typing-area {
        padding: 1rem 0.75rem;
    }

    .typing-area:focus-within {
        padding-top: 1.25rem;
        transform: translateY(-3px);
    }

    .typing-area :where(.typing-form, .action-buttons) {
        gap: 0.5rem;
    }

    .typing-form .input-wrapper {
        height: 48px;
    }

    .typing-form .typing-input {
        font-size: 0.95rem;
        padding: 0.8rem 3rem 0.8rem 1rem;
        border-radius: 20px;
    }

    .typing-form .typing-input:focus {
        transform: translateY(-2px);
    }

    .typing-area .icon {
        width: 48px;
        height: 48px;
        border-radius: 20px;
        font-size: 1.2rem;
    }

    .typing-area .icon:hover {
        transform: translateY(-3px) scale(1.03);
    }

    .typing-form #send-message-button {
        height: 32px;
        width: 32px;
        border-radius: 10px;
        right: 8px;
    }

    .typing-form #send-message-button:hover {
        transform: translateY(-50%) scale(1.1) rotate(3deg);
    }

    .typing-area .disclaimer-text {
        font-size: 0.7rem;
        margin-top: 0.5rem;
    }

    /* Message actions */
    .message-actions {
        margin-left: 1px;
    }

    .action-icon {
        font-size: 0.9rem;
        padding: 1px;
    }

    .action-icon:hover {
        transform: scale(1.05);
    }

    /* Animations */
    @keyframes messageEntrance {
        from {
            opacity: 0;
            transform: translateY(10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .chat-list .message {
        animation: messageEntrance 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }

    /* Focus states */
    :focus {
        outline: none;
        box-shadow: 0 0 0 2px var(--accent-color);
    }
}

/* Extra small screens */
@media screen and (max-width: 380px) {
    .header :where(.title, .subtitle) {
        font-size: 1.5rem;
        line-height: 1.8rem;
    }

    .header .subtitle {
        font-size: 1.3rem;
    }

    .chat-list .message .avatar {
        width: 30px;
        height: 30px;
    }

    .typing-form .input-wrapper {
        height: 42px;
    }

    .typing-area .icon {
        width: 42px;
        height: 42px;
    }

    .typing-form .typing-input {
        font-size: 0.9rem;
        padding: 0.7rem 2.8rem 0.7rem 0.9rem;
    }

    .typing-form #send-message-button {
        height: 28px;
        width: 28px;
    }
}

/* Stop generation button styles */
.stop-generation-btn {
    background-color: var(--accent-color);
    border: none;
    border-radius: 30px;
    color: var(--subheading-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    margin: 8px auto;
    /* Centers the button horizontally */
    padding: 10px 20px;
    transition: all 0.3s ease;
    display: block;
    width: fit-content;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stop-generation-btn:hover {
    background-color: var(--accent-secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.stop-generation-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* File upload styles */
.typing-area label[for="file-upload"] {
    cursor: pointer;
    position: relative;
}

.typing-area label[for="file-upload"]:hover {
    animation: bounce 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.typing-area input[type="file"] {
    display: none;
}

/* File upload styles */
.uploaded-files-container {
    position: absolute;
    bottom: 140px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 980px;
    padding: 0 1.5rem;
    z-index: 1;
    display: flex;
    justify-content: center;
    gap: 12px;
    pointer-events: none;
}

.uploaded-file-item {
    background: var(--secondary-color);
    border-radius: 20px;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(255, 116, 166, 0.15);
    border: 1px solid rgba(255, 116, 166, 0.1);
    animation: slideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    width: calc((100% - 24px) / 3);
    max-width: 300px;
    backdrop-filter: blur(10px);
}

body.animating-theme .uploaded-file-item {
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.uploaded-file-item .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
    flex: 1;
    min-width: 0;
}

.uploaded-file-item .file-icon {
    color: var(--accent-color);
    font-size: 1.2rem;
    flex-shrink: 0;
}

body.animating-theme .uploaded-file-item .file-icon {
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.uploaded-file-item .file-name {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

body.animating-theme .uploaded-file-item .file-name {
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.uploaded-file-item .remove-file {
    color: var(--text-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-left: 8px;
}

.uploaded-file-item .remove-file:hover {
    background: rgba(255, 116, 166, 0.1);
    color: var(--accent-color);
    transform: scale(1.1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

.uploaded-file-item.removing {
    animation: slideOut 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Tablet styles */
@media screen and (max-width: 1024px) {
    .uploaded-files-container {
        padding: 0 1rem;
    }

    .uploaded-file-item {
        padding: 6px 12px;
    }

    .uploaded-file-item .file-name {
        font-size: 0.85rem;
    }
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .uploaded-files-container {
        bottom: 120px;
        flex-direction: column-reverse;
        align-items: center;
        max-height: 200px;
        overflow-y: auto;
    }

    .typing-area {
        padding: 2rem 1rem 1rem;
    }

    .uploaded-file-item {
        width: 100%;
        max-width: 100%;
        padding: 8px 16px;
    }

    .uploaded-file-item .file-name {
        max-width: none;
        font-size: 0.9rem;
    }

    .uploaded-file-item .file-icon,
    .uploaded-file-item .remove-file {
        font-size: 1.1rem;
    }
}

/* File attachments in chat */
.message-text-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.attached-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    background: var(--secondary-color);
    border-radius: 18px;
    padding: 8px;
    border: 1px solid rgba(255, 116, 166, 0.1);
}

body.animating-theme .attached-files {
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 12px;
    background: var(--primary-color);
    border: 1px solid rgba(255, 116, 166, 0.1);
}

body.animating-theme .file-attachment {
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1),
        border-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-attachment .file-icon {
    color: var(--accent-color);
    font-size: 1.2rem;
}

body.animating-theme .file-attachment .file-icon {
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-attachment .file-name {
    font-size: 0.9rem;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.animating-theme .file-attachment .file-name {
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.file-attachment .file-size {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.7;
    margin-left: auto;
}

body.animating-theme .file-attachment .file-size {
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .uploaded-files-container {
        bottom: 120px;
        flex-direction: column-reverse;
        align-items: center;
        max-height: 200px;
        overflow-y: auto;
    }

    .uploaded-file-item {
        width: 100%;
        max-width: 100%;
        padding: 8px 16px;
    }

    .attached-files {
        margin: 8px 0;
    }

    .file-attachment {
        padding: 6px;
    }

    .file-attachment .file-name {
        max-width: 150px;
    }
}

/* Ensure no horizontal scroll on small devices */
@media screen and (max-width: 504px) {
    .chat-list {
        padding: 1rem 0.5rem 10rem;
        width: 100vw;
        box-sizing: border-box;
    }

    .chat-list .message {
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }

    .chat-list .message .message-content {
        gap: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }

    .chat-list .message .text {
        font-size: 0.9rem;
        word-break: break-word;
        max-width: calc(100vw - 90px);
    }

    .message-text-container {
        width: calc(100vw - 70px);
        box-sizing: border-box;
    }

    .attached-files {
        margin: 6px 0;
        padding: 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .file-attachment {
        padding: 4px 6px;
        width: 100%;
        box-sizing: border-box;
    }

    .file-attachment .file-name {
        max-width: calc(100vw - 160px);
    }

    /* Hide scrollbars but allow scrolling */
    * {
        -ms-overflow-style: none;
        /* IE and Edge */
        scrollbar-width: none;
        /* Firefox */
    }

    *::-webkit-scrollbar {
        display: none;
        /* Chrome, Safari and Opera */
    }

    /* Ensure input doesn't cause overflow */
    input[type="file"] {
        width: 1px;
        height: 1px;
        opacity: 0;
        position: absolute;
        overflow: hidden;
    }
}

/* Force prevent horizontal scroll */
html,
body {
    max-width: 100vw;
    overflow-x: hidden;
}

.chat-list {
    max-width: 100vw;
    overflow-x: hidden;
}

@media (max-width: 1230px) {
    .chat-list {
        padding-top: 70px !important;
        /* 40px button + 16px margin + extra */
    }
}

.chat-history-modal.active ~ .typing-area,
.modal-overlay.active ~ .typing-area,
.modal-overlay.active ~ .typing-area * {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}