body {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    margin: 0;
    padding: 0;
    font-family: var(--md-sys-typescale-body-large-font);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.main-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--md-sys-spacing-3);
    background-color: var(--md-sys-color-surface);
    margin-bottom: var(--md-sys-spacing-5);
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
}

/* Folding phone - unfolded */
@media screen and (max-width: 359px) {
    .main-container {
        padding: var(--md-sys-spacing-2);
        margin-bottom: var(--md-sys-spacing-4);
    }
    
    .chat-input-wrapper {
        width: 90%;
        padding: var(--md-sys-spacing-1) var(--md-sys-spacing-2);
    }
    
    .message {
        padding: var(--md-sys-spacing-2);
        margin: var(--md-sys-spacing-1) 0;
    }
}

/* Regular phone */
@media screen and (min-width: 360px) and (max-width: 599px) {
    .main-container {
        padding: var(--md-sys-spacing-3);
        margin-bottom: var(--md-sys-spacing-4);
    }
    
    .chat-input-wrapper {
        width: 92%;
        padding: var(--md-sys-spacing-2) var(--md-sys-spacing-3);
    }
    
    .message {
        padding: var(--md-sys-spacing-3);
        margin: var(--md-sys-spacing-2) 0;
    }
}

/* Tablet/Desktop */
@media screen and (min-width: 600px) {
    .main-container {
        padding: var(--md-sys-spacing-4);
        margin-bottom: var(--md-sys-spacing-5);
    }
    
    .chat-input-wrapper {
        width: 95%;
        padding: var(--md-sys-spacing-3) var(--md-sys-spacing-4);
    }
    
    .message {
        padding: var(--md-sys-spacing-4);
        margin: var(--md-sys-spacing-3) 0;
    }
}

.chat-container {
    padding: var(--md-sys-spacing-3);
    background-color: var(--md-sys-color-surface-container);
    border-top: 1px solid var(--md-sys-color-outline-variant);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    box-shadow: var(--md-elevation-level2);
    z-index: var(--md-sys-z-index-modal);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: var(--md-sys-spacing-2);
    max-width: 768px;
    margin: 0 auto;
    background-color: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: var(--md-sys-shape-corner-large);
    transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
}

.chat-input-wrapper:focus-within {
    box-shadow: var(--md-elevation-level1);
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container-highest);
}

.chat-input {
    flex-grow: 1;
    padding: var(--md-sys-spacing-2);
    border: none;
    background-color: transparent;
    color: var(--md-sys-color-on-surface);
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: var(--md-sys-typescale-body-large-size);
    outline: none;
    resize: none;
    max-height: 200px;
    min-height: 24px;
    line-height: var(--md-sys-typescale-body-large-line-height);
}

.chat-input::placeholder {
    color: var(--md-sys-color-on-surface-variant);
}

.button {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    border: none;
    background-color: transparent;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
    padding: 8px;
}

.button:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}

.button:active {
    background-color: var(--md-sys-color-surface-container-low);
    transform: scale(0.95);
}

.button .material-icons {
    font-size: 24px;
}

.send-button {
    color: var(--md-sys-color-primary);
}

.send-button:hover {
    background-color: var(--md-sys-color-primary-container);
}

.message {
    display: flex;
    gap: var(--md-sys-spacing-3);
    line-height: var(--md-sys-typescale-body-large-line-height);
    font-family: var(--md-sys-typescale-body-large-font);
    font-size: var(--md-sys-typescale-body-large-size);
    animation: fadeIn var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized);
    border-radius: var(--md-sys-shape-corner-large);
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    flex-shrink: 0;
    object-fit: cover;
}

.message-content {
    flex-grow: 1;
    word-break: break-word;
}

.user-message {
    background-color: var(--md-sys-color-surface-container-highest);
}

.bot-message {
    background-color: var(--md-sys-color-surface-container);
}

.typing-indicator {
    display: flex;
    gap: var(--md-sys-spacing-1);
    padding: var(--md-sys-spacing-2);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--md-sys-color-on-surface-variant);
    border-radius: var(--md-sys-shape-corner-full);
    animation: typing var(--md-sys-motion-duration-long2) infinite var(--md-sys-motion-easing-emphasized);
}

.typing-dot:nth-child(2) {
    animation-delay: var(--md-sys-motion-duration-short2);
}

.typing-dot:nth-child(3) {
    animation-delay: var(--md-sys-motion-duration-medium1);
}

.message pre {
    padding: var(--md-sys-spacing-3);
    overflow-x: auto;
    margin: var(--md-sys-spacing-3) 0;
    width: 100%;
    box-sizing: border-box;
    font-family: var(--md-sys-typescale-code-font);
    font-size: var(--md-sys-typescale-body-small-size);
    background-color: var(--md-sys-color-surface-container-highest);
    border-radius: var(--md-sys-shape-corner-medium);
}

.message code {
    font-family: var(--md-sys-typescale-code-font);
    padding: var(--md-sys-spacing-1) var(--md-sys-spacing-2);
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--md-sys-color-on-surface);
    background-color: var(--md-sys-color-surface-container-highest);
    border-radius: var(--md-sys-shape-corner-small);
}

@keyframes typing {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(var(--md-sys-spacing-2));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Material You Theme Variables */
:root {
    /* Using Material Design 3 token system */
    --md-sys-typescale-body-large-font: 'Google Sans', 'Roboto', system-ui, sans-serif;
    --md-sys-typescale-body-large-size: 1rem;
    --md-sys-typescale-body-large-line-height: 1.5;
    --md-sys-typescale-body-small-font: 'Google Sans', 'Roboto', system-ui, sans-serif;
    --md-sys-typescale-body-small-size: 0.875rem;
    --md-sys-typescale-code-font: 'Roboto Mono', monospace;
    --md-sys-spacing-1: 4px;
    --md-sys-spacing-2: 8px;
    --md-sys-spacing-3: 16px;
    --md-sys-spacing-4: 24px;
    --md-sys-spacing-5: 32px;
    --md-sys-shape-corner-small: 4px;
    --md-sys-shape-corner-medium: 12px;
    --md-sys-shape-corner-large: 16px;
    --md-sys-shape-corner-full: 50%;
    --md-sys-motion-duration-short2: 200ms;
    --md-sys-motion-duration-medium1: 400ms;
    --md-sys-motion-duration-medium2: 500ms;
    --md-sys-motion-duration-long2: 1400ms;
    --md-sys-motion-easing-emphasized: cubic-bezier(0.4, 0.0, 0.2, 1);
    --md-sys-z-index-modal: 100;
}

/* Light theme colors with different accent colors */
:root[data-theme="light"][data-color="blue"] {
    --md-sys-color-primary: #006874;
    --md-sys-color-primary-container: #a2f0ff;
}

:root[data-theme="light"][data-color="red"] {
    --md-sys-color-primary: #ba1a1a;
    --md-sys-color-primary-container: #ffdad6;
}

:root[data-theme="light"][data-color="green"] {
    --md-sys-color-primary: #006c48;
    --md-sys-color-primary-container: #8ff8c4;
}

:root[data-theme="light"][data-color="orange"] {
    --md-sys-color-primary: #8b5000;
    --md-sys-color-primary-container: #ffddb4;
}

:root[data-theme="light"][data-color="cyan"] {
    --md-sys-color-primary: #006876;
    --md-sys-color-primary-container: #a2efff;
}

:root[data-theme="light"][data-color="light-green"] {
    --md-sys-color-primary: #006e1c;
    --md-sys-color-primary-container: #98f993;
}

/* Dark theme colors with different accent colors */
:root[data-theme="dark"][data-color="blue"] {
    --md-sys-color-primary: #4fd8eb;
    --md-sys-color-primary-container: #004f58;
}

:root[data-theme="dark"][data-color="red"] {
    --md-sys-color-primary: #ffb4ab;
    --md-sys-color-primary-container: #93000a;
}

:root[data-theme="dark"][data-color="green"] {
    --md-sys-color-primary: #74dba7;
    --md-sys-color-primary-container: #005236;
}

:root[data-theme="dark"][data-color="orange"] {
    --md-sys-color-primary: #ffb87c;
    --md-sys-color-primary-container: #5c3600;
}

:root[data-theme="dark"][data-color="cyan"] {
    --md-sys-color-primary: #56d6f5;
    --md-sys-color-primary-container: #004f59;
}

:root[data-theme="dark"][data-color="light-green"] {
    --md-sys-color-primary: #7cdc79;
    --md-sys-color-primary-container: #005314;
}

/* Dark theme base colors */
:root[data-theme="dark"] {
    color-scheme: dark;
    --md-sys-color-background: var(--md-sys-color-surface-dim);
    --md-sys-color-on-background: var(--md-sys-color-on-surface);
    --md-sys-color-surface: var(--md-sys-color-surface-dim);
    --md-sys-color-surface-dim: #1a1c1e;
    --md-sys-color-on-surface: #e3e2e6;
    --md-sys-color-surface-container: #1f1f1f;
    --md-sys-color-surface-container-low: #1d1b20;
    --md-sys-color-surface-container-high: #292929;
    --md-sys-color-surface-container-highest: #333333;
    --md-sys-color-outline: #8c8c8c;
    --md-sys-color-outline-variant: #444746;
    --md-sys-color-on-surface-variant: #c4c7c5;
}

/* Light theme base colors */
:root[data-theme="light"] {
    color-scheme: light;
    --md-sys-color-background: var(--md-sys-color-surface-bright);
    --md-sys-color-on-background: var(--md-sys-color-on-surface);
    --md-sys-color-surface: var(--md-sys-color-surface-bright);
    --md-sys-color-surface-bright: #fdfdf6;
    --md-sys-color-on-surface: #1a1c1e;
    --md-sys-color-surface-container: #f3f3f3;
    --md-sys-color-surface-container-low: #f7f7f7;
    --md-sys-color-surface-container-high: #ececec;
    --md-sys-color-surface-container-highest: #e6e6e6;
    --md-sys-color-outline: #79747e;
    --md-sys-color-outline-variant: #c4c7c5;
    --md-sys-color-on-surface-variant: #49454f;
}
