/* CSS Reset & Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #EE5B6A;
    --primary-dark: #D94B5A;
    --primary-light: #FFE6EA;
    --secondary-color: #F7B7C0;
    --background-color: #F4CED6;
    --surface-color: #FFFFFF;
    --text-primary: #3A3230;
    --text-secondary: #9B8B86;
    --border-color: #F0E3E6;
    --shadow-sm: 0 6px 18px rgba(80, 34, 42, 0.08);
    --shadow-md: 0 16px 32px rgba(80, 34, 42, 0.12);
    --shadow-lg: 0 24px 48px rgba(80, 34, 42, 0.16);
    --radius-sm: 12px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --transition: all 0.3s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background: radial-gradient(circle at 20% 20%, #F6D9DF 0%, #F3C8D0 45%, #F0C0CB 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 28px 20px 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header Styles */
.header {
    text-align: center;
    padding: 16px 12px 8px;
    position: relative;
    overflow: hidden;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.header::before,
.header::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    transform: translate(-50%, -55%);
    background: radial-gradient(circle, rgba(240, 125, 140, 0.2), rgba(240, 125, 140, 0));
    filter: blur(8px);
    opacity: 0.8;
    animation: simmer 6s ease-in-out infinite;
}

.header::after {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(247, 183, 192, 0.35), rgba(247, 183, 192, 0));
    animation-delay: -3s;
}

.header .title::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -18px;
    width: 120px;
    height: 40px;
    transform: translateX(-50%);
    border-radius: 50%;
    border: 2px solid rgba(238, 91, 106, 0.25);
    border-color: rgba(238, 91, 106, 0.25) transparent transparent transparent;
    animation: steam-ring 3.2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes simmer {
    0%, 100% {
        transform: translate(-50%, -55%) scale(1);
        opacity: 0.7;
    }
    50% {
        transform: translate(-50%, -60%) scale(1.06);
        opacity: 0.95;
    }
}

@keyframes steam-ring {
    0% {
        transform: translateX(-50%) translateY(10px) scale(0.85);
        opacity: 0;
    }
    40% {
        opacity: 0.7;
    }
    100% {
        transform: translateX(-50%) translateY(-10px) scale(1.1);
        opacity: 0;
    }
}

.logo {
    width: 52px;
    height: 52px;
    background: var(--primary-light);
    border-radius: 16px;
    padding: 6px;
    box-shadow: var(--shadow-sm);
}

.title {
    font-family: 'Archivo Black', 'Poppins', 'Segoe UI', sans-serif;
    font-size: 2.2rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.description {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 420px;
    margin: 0;
    line-height: 1.6;
}

/* Chat Container */
.chat-container {
    flex: 1;
    background: var(--surface-color);
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: none;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 26px 24px 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-height: 520px;
    min-height: 320px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.message-avatar svg,
.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.assistant-message .message-avatar {
    background: var(--primary-light);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #F07D8C 0%, #E55D6D 100%);
}

.user-message .message-avatar::after {
    content: "AI";
    font-size: 0.9rem;
    font-weight: 600;
    color: #FFFFFF;
}

.message-content {
    flex: 1;
    background: #FFF7F9;
    padding: 16px 18px;
    border-radius: 20px;
    border-top-left-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.user-message .message-content {
    background: linear-gradient(135deg, #F07D8C 0%, #E55D6D 100%);
    color: white;
    border-top-left-radius: 20px;
    border-top-right-radius: 10px;
}

.user-message {
    flex-direction: row-reverse;
}

.message-content p {
    margin-bottom: 8px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content .hint {
    font-size: 0.85rem;
    color: #B79DA4;
    font-style: normal;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #F0D8DE;
}

/* Recipe Formatting */
.recipe-content h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.recipe-content h4 {
    color: var(--text-primary);
    margin: 16px 0 8px;
    font-size: 1rem;
}

.recipe-content ul,
.recipe-content ol {
    padding-left: 20px;
    margin: 8px 0;
}

.recipe-content li {
    margin-bottom: 4px;
}

.recipe-content strong {
    color: var(--primary-dark);
}

/* Input Container */
.input-container {
    padding: 18px 20px 24px;
    background: var(--surface-color);
    border-top: 1px solid #F4E7EA;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    background: #FFF5F7;
    border: 2px solid #F1D8DD;
    border-radius: 20px;
    padding: 12px 16px;
    transition: var(--transition);
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(238, 91, 106, 0.15);
}

#userInput {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.98rem;
    color: var(--text-primary);
    resize: none;
    max-height: 150px;
    line-height: 1.5;
}

#userInput:focus {
    outline: none;
}

#userInput::placeholder {
    color: var(--text-secondary);
}

.send-button {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, #F07D8C 0%, #E55D6D 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: 0 10px 20px rgba(229, 93, 109, 0.3);
}

.send-button:hover {
    transform: translateY(-1px);
}

.send-button:active {
    transform: scale(0.98);
}

.send-button:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-button svg {
    width: 20px;
    height: 20px;
}

.input-hint {
    text-align: center;
    font-size: 0.78rem;
    color: #B59DA4;
    margin-top: 10px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 12px 20px 0;
    color: #B59DA4;
    font-size: 0.85rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(244, 206, 214, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    text-align: center;
}

.pan-loader {
    position: relative;
    width: 90px;
    height: 70px;
    margin: 0 auto 16px;
}

.pan-body {
    position: absolute;
    bottom: 12px;
    left: 8px;
    width: 52px;
    height: 14px;
    border-radius: 0 0 18px 18px;
    background: #F07D8C;
    box-shadow: inset 0 -4px 0 rgba(217, 75, 90, 0.35);
    animation: pan-bob 1.2s ease-in-out infinite;
}

.pan-body::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 4px;
    width: 44px;
    height: 8px;
    border-radius: 8px 8px 2px 2px;
    background: #F6A5AF;
}

.pan-handle {
    position: absolute;
    bottom: 20px;
    left: 56px;
    width: 30px;
    height: 8px;
    border-radius: 8px;
    background: #D94B5A;
    transform-origin: left center;
    animation: pan-handle 1.2s ease-in-out infinite;
}

.steam {
    position: absolute;
    bottom: 38px;
    width: 10px;
    height: 18px;
    border-radius: 10px;
    border: 2px solid rgba(238, 91, 106, 0.6);
    border-color: rgba(238, 91, 106, 0.6) transparent transparent transparent;
    animation: steam 1.6s ease-in-out infinite;
    opacity: 0.7;
}

.steam-1 {
    left: 14px;
    animation-delay: 0s;
}

.steam-2 {
    left: 28px;
    animation-delay: 0.3s;
}

.steam-3 {
    left: 42px;
    animation-delay: 0.6s;
}

@keyframes pan-bob {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes pan-handle {
    0%, 100% {
        transform: rotate(0deg);
    }
    50% {
        transform: rotate(6deg);
    }
}

@keyframes steam {
    0% {
        transform: translateY(6px) scale(0.9);
        opacity: 0;
    }
    30% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-10px) scale(1.1);
        opacity: 0;
    }
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #EBCFD4;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #D9B7BF;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 18px 14px 32px;
    }

    .header {
        padding: 12px 10px 8px;
    }

    .logo-container {
        flex-direction: row;
        gap: 10px;
    }

    .logo {
        width: 46px;
        height: 46px;
    }

    .title {
        font-size: 1.9rem;
    }

    .description {
        font-size: 0.95rem;
    }

    .chat-messages {
        padding: 20px 18px 8px;
        min-height: 260px;
    }

    .message {
        gap: 8px;
    }

    .message-avatar {
        width: 32px;
        height: 32px;
        border-radius: 12px;
    }

    .message-content {
        padding: 12px 14px;
    }

    .input-container {
        padding: 16px 16px 22px;
    }

    .input-wrapper {
        padding: 10px 12px;
    }

    .send-button {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }
}

/* Error State */
.error-message {
    background: #FFE3E6 !important;
    border-left: 4px solid #E34C5C;
}

.error-message .message-content {
    background: #FFE3E6;
    color: #B03741;
}

/* Success Animation */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(238, 91, 106, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(238, 91, 106, 0);
    }
}

.recipe-ready {
    animation: pulse 2s ease-in-out;
}
