/* ========== RESET & BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ========== LOADING SCREEN ========== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease 2s forwards;
}

.loading-content {
    text-align: center;
    color: white;
    animation: scaleIn 0.6s ease;
}

.loading-logo {
    font-size: 80px;
    margin-bottom: 20px;
    animation: logoRotate 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes logoRotate {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(360deg) scale(1.2);
    }
}

.loading-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: 16px;
    margin-bottom: 40px;
    opacity: 0.9;
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-footer {
    font-size: 14px;
    opacity: 0.8;
}

.loading-footer strong {
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

:root {
    --primary: #10b981;
    --primary-dark: #059669;
    --secondary: #3b82f6;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #ffffff;
    --bg-gray: #f9fafb;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --spacing: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(16, 185, 129, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
    animation: backgroundPulse 10s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ========== LAYOUT ========== */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--spacing);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== HEADER ========== */
header {
    text-align: center;
    padding: 24px 0 16px;
    perspective: 1000px;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transform-style: preserve-3d;
    animation: logoFloat 3s ease-in-out infinite;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.1) rotateY(10deg);
}

.logo::before {
    content: "🥗";
    font-size: 32px;
    animation: iconSpin 4s ease-in-out infinite;
    display: inline-block;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes iconSpin {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    25% {
        transform: rotate(-10deg) scale(1.1);
    }
    75% {
        transform: rotate(10deg) scale(1.1);
    }
}

/* ========== HERO ========== */
.hero {
    text-align: center;
    margin: 24px 0 32px;
    perspective: 1000px;
}

.hero h1 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textShine 3s ease-in-out infinite;
    transform-style: preserve-3d;
}

.hero p {
    color: var(--text-light);
    font-size: 15px;
    animation: fadeInUp 1s ease-out;
}

@keyframes textShine {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== FEATURES SECTION ========== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
    perspective: 1000px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.4s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transform-style: preserve-3d;
    border: 1px solid rgba(16, 185, 129, 0.1);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s;
}

.feature-card:hover {
    transform: translateY(-10px) rotateX(5deg) rotateY(5deg);
    box-shadow: 0 15px 35px rgba(16, 185, 129, 0.2);
    border-color: var(--primary);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 40px;
    margin-bottom: 12px;
    display: inline-block;
    animation: iconFloat 3s ease-in-out infinite;
    transform-style: preserve-3d;
}

.feature-card:nth-child(1) .feature-icon {
    animation-delay: 0s;
}

.feature-card:nth-child(2) .feature-icon {
    animation-delay: 0.2s;
}

.feature-card:nth-child(3) .feature-icon {
    animation-delay: 0.4s;
}

.feature-card:nth-child(4) .feature-icon {
    animation-delay: 0.6s;
}

@keyframes iconFloat {
    0%, 100% {
        transform: translateY(0) rotateZ(0deg);
    }
    50% {
        transform: translateY(-8px) rotateZ(5deg);
    }
}

.feature-card h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
    position: relative;
}

.feature-card p {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    position: relative;
}

@media (min-width: 640px) {
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .feature-card {
        padding: 24px;
    }
    
    .feature-icon {
        font-size: 48px;
    }
    
    .feature-card h3 {
        font-size: 16px;
    }
    
    .feature-card p {
        font-size: 13px;
    }
}

/* ========== UPLOAD ZONE ========== */
.upload-zone {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s ease;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    position: relative;
    animation: cardFloat 6s ease-in-out infinite;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--primary));
    background-size: 300% 300%;
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.4s;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
}

.upload-zone:hover,
.upload-zone:focus-within {
    border-color: var(--primary);
    background: #f0fdf4;
    transform: translateY(-8px) rotateX(2deg);
    box-shadow: 0 20px 40px rgba(16, 185, 129, 0.2);
}

.upload-zone:hover::before {
    opacity: 0.3;
}

.upload-zone.drag-over {
    border-color: var(--primary);
    background: #f0fdf4;
    transform: scale(1.05) rotateZ(1deg);
    box-shadow: 0 25px 50px rgba(16, 185, 129, 0.3);
}

@keyframes cardFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: inline-block;
    animation: iconBounce 2s ease-in-out infinite;
    transform-style: preserve-3d;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-10px) scale(1.1);
    }
}

.upload-zone h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 20px;
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.btn {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    min-width: 120px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transform-style: preserve-3d;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #059669 0%, var(--primary) 100%);
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
}

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover,
.btn-secondary:focus {
    border-color: var(--primary);
    color: var(--primary);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

input[type="file"] {
    display: none;
}

/* ========== PREVIEW SECTION ========== */
.preview-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px var(--shadow);
    display: none;
}

.preview-section.active {
    display: block;
}

.preview-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.preview-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.file-name {
    font-size: 14px;
    color: var(--text-light);
    word-break: break-all;
}

.serving-size-input {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.serving-size-input label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.serving-size-input input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    min-height: 44px;
}

.serving-size-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* ========== LOADING STATE ========== */
.loading-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 24px;
    display: none;
}

.loading-section.active {
    display: block;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 12px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-light);
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    height: 60px;
    margin-top: 16px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.btn-cancel {
    margin-top: 16px;
    background: var(--danger);
    color: white;
}

.btn-cancel:hover {
    background: #dc2626;
}

/* ========== RESULTS SECTION ========== */
.results-section {
    display: none;
}

.results-section.active {
    display: block;
}

.summary-bar {
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    color: white;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px var(--shadow-lg);
    position: sticky;
    top: 16px;
    z-index: 10;
}

.summary-title {
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.total-calories {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 16px;
}

.macros-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.macro-item {
    text-align: center;
}

.macro-label {
    font-size: 12px;
    opacity: 0.8;
    margin-bottom: 4px;
}

.macro-value {
    font-size: 20px;
    font-weight: 700;
}

.macros-chart {
    margin-top: 16px;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    background: rgba(255, 255, 255, 0.2);
}

.macros-chart > div {
    height: 100%;
    transition: width 0.5s ease;
}

.protein-bar {
    background: #8b5cf6;
}

.carbs-bar {
    background: #3b82f6;
}

.fat-bar {
    background: #f59e0b;
}

.food-list {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform-style: preserve-3d;
    animation: cardFloat 6s ease-in-out infinite;
    animation-delay: 0.5s;
}

.food-list h3 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--text);
}

.food-item {
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
}

.food-item:last-child {
    border-bottom: none;
}

.food-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.food-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.food-info {
    flex: 1;
}

.food-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.food-quantity {
    font-size: 14px;
    color: var(--text-light);
}

.food-macros {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding-left: 44px;
}

.macro-box {
    text-align: center;
    padding: 8px 4px;
    background: var(--bg-gray);
    border-radius: 6px;
}

.macro-box-label {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 2px;
}

.macro-box-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.debug-section {
    margin-top: 16px;
}

.debug-toggle {
    background: var(--bg-gray);
    border: 1px solid var(--border);
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
}

.debug-toggle:hover {
    background: #f3f4f6;
}

.debug-content {
    display: none;
    margin-top: 12px;
    background: #1f2937;
    color: #f3f4f6;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Courier New', monospace;
    font-size: 12px;
    overflow-x: auto;
    max-height: 400px;
}

.debug-content.active {
    display: block;
}

.debug-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.response-time {
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    margin-top: 8px;
}

/* ========== ERROR STATE ========== */
.error-section {
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
    display: none;
}

.error-section.active {
    display: block;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--danger);
    margin-bottom: 8px;
}

.error-message {
    color: #7f1d1d;
    margin-bottom: 20px;
}

/* ========== FOOTER ========== */
footer {
    margin-top: auto;
    padding: 24px 0;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(249, 250, 251, 0.9) 100%);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.privacy-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 12px;
}

.copyright {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-light);
}

.copyright strong {
    color: var(--primary);
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.copyright-icon {
    display: inline-block;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1);
    }
}

/* ========== CHATBOT ========== */
.chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: chatPulse 3s ease-in-out infinite;
    transform-style: preserve-3d;
}

.chat-button::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0.5;
    animation: ripple 2s infinite;
}

@keyframes chatPulse {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.chat-button:hover {
    transform: scale(1.2) rotate(10deg);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.5);
}

.chat-button.active {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    animation: none;
}

.chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 500px;
    max-height: calc(100vh - 150px);
    background: var(--bg);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px var(--shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
}

.chat-panel.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-header {
    background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 16px;
}

.chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-gray);
}

.chat-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-message.user .chat-message-avatar {
    background: var(--secondary);
}

.chat-message-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    background: white;
    color: var(--text);
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px var(--shadow);
}

.chat-message.user .chat-message-bubble {
    background: var(--primary);
    color: white;
}

.chat-typing {
    display: flex;
    gap: 4px;
    padding: 10px 14px;
}

.chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-light);
    animation: typing 1.4s infinite;
}

.chat-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid var(--border);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    resize: none;
    font-family: inherit;
    max-height: 100px;
}

.chat-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.chat-send {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-send:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-welcome {
    text-align: center;
    color: var(--text-light);
    padding: 20px;
    font-size: 14px;
}

.chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ========== RESPONSIVE ========== */
@media (min-width: 640px) {
    .container {
        padding: 24px;
    }
    
    .hero h1 {
        font-size: 28px;
    }
    
    .food-macros {
        grid-template-columns: repeat(4, minmax(0, 100px));
    }
}

@media (max-width: 640px) {
    .chat-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .chat-button {
        bottom: 16px;
        right: 16px;
    }
}

/* ========== ACCESSIBILITY ========== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

*:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus,
input:focus {
    outline: 2px solid var(--primary);
}

