/* ================================
   NUTRISCAN - MODERN UI REDESIGN
   ================================ */

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

:root {
    /* Color Palette - Modern & Vibrant */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --secondary-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --accent-gradient: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --warm-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.3);
    
    /* Typography */
    --font-primary: 'Poppins', system-ui, -apple-system, sans-serif;
    --font-secondary: 'Inter', system-ui, -apple-system, sans-serif;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: all 0.15s ease;
    --transition-normal: all 0.3s ease;
    --transition-slow: all 0.5s ease;
}

body {
    font-family: var(--font-secondary);
    line-height: 1.6;
    color: var(--gray-800);
    background: #0f0f23;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ================================
   BACKGROUND EFFECTS
   ================================ */

.bg-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(67, 233, 123, 0.05) 0%, transparent 50%);
    animation: meshFloat 20s ease-in-out infinite;
}

.floating-orb {
    position: absolute;
    border-radius: 50%;
    opacity: 0.1;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 200px;
    height: 200px;
    background: var(--primary-gradient);
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.orb-2 {
    width: 150px;
    height: 150px;
    background: var(--secondary-gradient);
    top: 60%;
    right: 10%;
    animation-delay: -10s;
}

.orb-3 {
    width: 100px;
    height: 100px;
    background: var(--accent-gradient);
    bottom: 20%;
    left: 20%;
    animation-delay: -5s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(-10px) rotate(180deg); }
    75% { transform: translateY(-30px) rotate(270deg); }
}

@keyframes meshFloat {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

/* ================================
   APP CONTAINER
   ================================ */

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    position: relative;
    box-shadow: var(--shadow-xl);
    border-radius: 0;
}

@media (min-width: 768px) {
    .app-container {
        margin: 2rem auto;
        border-radius: var(--radius-2xl);
        max-width: 600px;
    }
}

/* ================================
   HEADER
   ================================ */

.app-header {
    padding: 0;
    position: relative;
    overflow: hidden;
    min-height: 250px;
}

.banner-container {
    display: flex;
    height: 100%;
    min-height: 250px;
}

/* Sezione sinistra con scritte e sfondo rosso */
.banner-left {
    flex: 1;
    background: linear-gradient(135deg, #8B0000 0%, #B22222 50%, #DC143C 100%);
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--space-lg);
    position: relative;
}

.banner-left::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.banner-left > * {
    position: relative;
    z-index: 2;
}

/* Sezione destra con logo */
.banner-right {
    flex: 1;
    background: linear-gradient(135deg, #8B0000 0%, #B22222 50%, #DC143C 100%);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    overflow: hidden;
}

.logo-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.brand-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    overflow: hidden;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: var(--radius-lg);
}

.brand-icon i {
    font-size: 1.5rem;
    color: var(--white);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
}

.brand-text h1 {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 800;
    color: var(--white);
    margin: 0;
    letter-spacing: -0.02em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8),
                 0 0 10px rgba(0, 0, 0, 0.5);
}

.brand-subtitle {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8),
                 0 0 8px rgba(0, 0, 0, 0.6);
}

.header-tagline {
    text-align: left;
}

.header-tagline p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
    line-height: 1.5;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8),
                 0 0 8px rgba(0, 0, 0, 0.6);
}

/* Responsive Design per il Banner */
@media (max-width: 768px) {
    .banner-container {
        flex-direction: column;
        min-height: auto;
    }
    
    .banner-left,
    .banner-right {
        flex: none;
        min-height: 150px;
    }
    
    .banner-left {
        padding: var(--space-lg) var(--space-md);
        gap: var(--space-md);
    }
    
    .banner-right {
        min-height: 79px;
        padding: 0;
    }
    
    .brand-text h1 {
        font-size: 1.5rem;
    }
    
    .brand-subtitle {
        font-size: 0.75rem;
    }
    
    .header-tagline p {
        font-size: 0.875rem;
    }
    
    .logo-container {
        width: 100%;
        height: 100%;
    }
    
    .logo-container img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

/* ================================
   MAIN CONTENT
   ================================ */

.app-main {
    padding: var(--space-xl) var(--space-lg);
    min-height: calc(100vh - 200px);
}

/* ================================
   UPLOAD SECTION
   ================================ */

.upload-container {
    text-align: center;
}

.upload-visual {
    margin-bottom: var(--space-2xl);
}

.upload-illustration {
    position: relative;
    display: inline-block;
}

.illustration-circle {
    width: 120px;
    height: 120px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: var(--shadow-glow);
    position: relative;
    animation: iconFloat 3s ease-in-out infinite;
}

.illustration-circle i {
    font-size: 2.5rem;
    color: var(--white);
}

.illustration-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: particleFloat 4s ease-in-out infinite;
}

.particle:nth-child(1) {
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 20%;
    right: 20%;
    animation-delay: 1s;
}

.particle:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 2s;
}

.particle:nth-child(4) {
    bottom: 20%;
    right: 20%;
    animation-delay: 3s;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.05); }
}

@keyframes particleFloat {
    0%, 100% { 
        opacity: 0; 
        transform: translateY(0) scale(0); 
    }
    50% { 
        opacity: 1; 
        transform: translateY(-20px) scale(1); 
    }
}

.upload-content {
    margin-bottom: var(--space-2xl);
}

.upload-title {
    font-family: var(--font-primary);
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.upload-description {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.6;
    margin-bottom: var(--space-2xl);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.upload-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: var(--transition-normal);
    font-family: inherit;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.primary-btn {
    background: var(--primary-gradient);
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.secondary-btn {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-md);
}

.secondary-btn:hover {
    transform: translateY(-1px);
    border-color: var(--gray-300);
    box-shadow: var(--shadow-lg);
}

.btn-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.secondary-btn .btn-icon {
    background: var(--gray-100);
}

.btn-icon i {
    font-size: 1.25rem;
}

.btn-content {
    flex: 1;
}

.btn-title {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.btn-subtitle {
    display: block;
    font-size: 0.875rem;
    opacity: 0.8;
    font-weight: 400;
}

.upload-help {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.help-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 0.875rem;
    color: var(--gray-600);
    justify-content: center;
}

.help-item i {
    color: var(--gray-400);
    width: 16px;
}

@media (min-width: 768px) {
    .upload-actions {
        flex-direction: row;
        gap: var(--space-lg);
    }
    
    .action-btn {
        flex: 1;
    }
    
    .upload-help {
        flex-direction: row;
        justify-content: center;
        gap: var(--space-xl);
    }
}

/* ================================
   PREVIEW SECTION
   ================================ */

.preview-container {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-100);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.preview-header h2 {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.close-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gray-100);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    color: var(--gray-600);
}

.close-btn:hover {
    background: var(--gray-200);
    transform: scale(1.1);
}

.image-preview-wrapper {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-xl);
}

.image-preview-wrapper img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    transition: var(--transition-normal);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-normal);
}

.image-preview-wrapper:hover .image-overlay {
    opacity: 1;
}

.overlay-content i {
    font-size: 2rem;
    color: var(--white);
}

.analyze-btn {
    width: 100%;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.analyze-btn .btn-icon {
    background: rgba(255, 255, 255, 0.2);
}

.analyze-btn .btn-content {
    color: var(--white);
    text-align: left;
}

.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: var(--transition-slow);
}

.analyze-btn:hover .btn-glow {
    left: 100%;
}

/* ================================
   LOADING SECTION
   ================================ */

.loading-container {
    text-align: center;
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-100);
}

.loading-animation {
    margin-bottom: var(--space-2xl);
    position: relative;
}

.loading-brain {
    width: 100px;
    height: 100px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    animation: brainPulse 2s ease-in-out infinite;
}

.loading-brain i {
    font-size: 2.5rem;
    color: var(--white);
    animation: brainSpin 3s linear infinite;
}

.brain-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.wave {
    position: absolute;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    animation: waveExpand 2s ease-out infinite;
}

.wave-1 {
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    animation-delay: 0s;
}

.wave-2 {
    width: 140px;
    height: 140px;
    margin: -70px 0 0 -70px;
    animation-delay: 0.5s;
}

.wave-3 {
    width: 160px;
    height: 160px;
    margin: -80px 0 0 -80px;
    animation-delay: 1s;
}

@keyframes brainPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

@keyframes waveExpand {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

.loading-content h3 {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-md);
}

.loading-content p {
    color: var(--gray-600);
    margin-bottom: var(--space-xl);
    font-size: 1rem;
}

.loading-steps {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
}

.step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    transition: var(--transition-normal);
    opacity: 0.5;
}

.step.active {
    background: rgba(102, 126, 234, 0.1);
    opacity: 1;
    transform: scale(1.05);
}

.step i {
    font-size: 1.25rem;
    color: var(--gray-400);
}

.step.active i {
    color: #667eea;
}

.step span {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-align: center;
    font-weight: 500;
}

.step.active span {
    color: #667eea;
}

@media (max-width: 480px) {
    .loading-steps {
        flex-direction: column;
    }
    
    .step {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }
}

/* ================================
   RESULTS SECTION
   ================================ */

.results-container {
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-100);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.results-header .header-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.results-header h2 {
    font-family: var(--font-primary);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0;
}

.success-badge {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: rgba(67, 233, 123, 0.1);
    color: #059669;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
}

.new-analysis-btn {
    background: var(--gray-600);
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition-normal);
}

.new-analysis-btn:hover {
    background: var(--gray-700);
    transform: translateY(-1px);
}

.calories-spotlight {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-2xl);
}

.calories-circle-enhanced {
    position: relative;
    width: 160px;
    height: 160px;
}

.circle-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 50%;
    animation: circleGlow 3s ease-in-out infinite;
}

.circle-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--white);
    z-index: 2;
}

.calories-number {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    font-family: var(--font-primary);
}

.calories-unit {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
}

.calories-subtitle {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.circle-ring {
    position: absolute;
    top: -10px;
    left: -10px;
    width: calc(100% + 20px);
    height: calc(100% + 20px);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 50%;
    animation: ringRotate 10s linear infinite;
}

@keyframes circleGlow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 40px rgba(102, 126, 234, 0.5);
        transform: scale(1.02);
    }
}

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

.nutrition-dashboard {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.nutrition-card {
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    border-left: 4px solid transparent;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.nutrition-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: var(--transition-slow);
}

.nutrition-card:hover::before {
    left: 100%;
}

.protein-card {
    border-left-color: #dc3545;
}

.carbs-card {
    border-left-color: #ffc107;
}

.fats-card {
    border-left-color: #28a745;
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.nutrient-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.25rem;
}

.protein-card .nutrient-icon {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.carbs-card .nutrient-icon {
    background: linear-gradient(135deg, #ffc107, #e0a800);
}

.fats-card .nutrient-icon {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.nutrient-info {
    flex: 1;
}

.nutrient-name {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: var(--space-xs);
}

.nutrient-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    font-family: var(--font-primary);
}

.nutrient-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s ease-out;
}

.protein-fill {
    background: linear-gradient(90deg, #dc3545, #ff6b7a);
}

.carbs-fill {
    background: linear-gradient(90deg, #ffc107, #ffd93d);
}

.fats-fill {
    background: linear-gradient(90deg, #28a745, #5cb85c);
}

.nutrient-percentage {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
    text-align: right;
}

.food-analysis {
    background: var(--gray-50);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    border-left: 4px solid #667eea;
}

.analysis-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.analysis-header i {
    color: #667eea;
    font-size: 1.25rem;
}

.analysis-header h3 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.analysis-content p {
    color: var(--gray-700);
    line-height: 1.6;
    margin-bottom: var(--space-lg);
}

.analysis-tags {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.tag {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
}

/* ================================
   DIETARY ALERTS SECTION
   ================================ */

.dietary-alerts {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-100);
}

.alerts-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.alerts-header i {
    color: #667eea;
    font-size: 1.25rem;
}

.alerts-header h3 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-800);
    margin: 0;
}

.alerts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.alert-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    align-items: center;
    gap: var(--space-md);
    transition: var(--transition-normal);
    border-left: 4px solid transparent;
    position: relative;
    overflow: hidden;
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: var(--transition-slow);
}

.alert-card:hover::before {
    left: 100%;
}

.diabetic-alert {
    border-left-color: #dc3545;
}

.gluten-alert {
    border-left-color: #ffc107;
}

.lactose-alert {
    border-left-color: #17a2b8;
}

.alert-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.diabetic-alert .alert-icon {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.gluten-alert .alert-icon {
    background: linear-gradient(135deg, #ffc107, #e0a800);
}

.lactose-alert .alert-icon {
    background: linear-gradient(135deg, #17a2b8, #138496);
}

.alert-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.alert-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 0.95rem;
}

.alert-status {
    font-size: 0.825rem;
    color: var(--gray-600);
    font-weight: 400;
}

.alert-indicator {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition-normal);
    flex-shrink: 0;
}

/* Alert States */
.alert-card.safe {
    background: rgba(40, 167, 69, 0.05);
    border-left-color: #28a745;
}

.alert-card.safe .alert-indicator {
    background: #28a745;
    color: var(--white);
}

.alert-card.warning {
    background: rgba(255, 193, 7, 0.05);
    border-left-color: #ffc107;
}

.alert-card.warning .alert-indicator {
    background: #ffc107;
    color: var(--gray-800);
}

.alert-card.danger {
    background: rgba(220, 53, 69, 0.05);
    border-left-color: #dc3545;
}

.alert-card.danger .alert-indicator {
    background: #dc3545;
    color: var(--white);
}

.alert-card.unknown .alert-indicator {
    background: var(--gray-400);
    color: var(--white);
}

.alerts-legend {
    justify-content: center;
    gap: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--gray-600);
}

.safe-icon {
    color: #28a745;
}

.warning-icon {
    color: #ffc107;
}

.danger-icon {
    color: #dc3545;
}

/* Alert animations */
.alert-card.updating .alert-indicator {
    animation: alertPulse 1.5s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
}

/* Responsive alerts */
@media (min-width: 768px) {
    .alerts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .alerts-legend {
        gap: var(--space-2xl);
    }
}

@media (min-width: 1024px) {
    .alerts-grid {
        gap: var(--space-lg);
    }
}

@media (min-width: 768px) {
    .nutrition-dashboard {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .results-header {
        flex-wrap: nowrap;
    }
}

/* ================================
   ERROR SECTION
   ================================ */

.error-container {
    text-align: center;
    background: var(--white);
    border-radius: var(--radius-2xl);
    padding: var(--space-2xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-100);
}

.error-animation {
    margin-bottom: var(--space-2xl);
    position: relative;
}

.error-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    position: relative;
    animation: errorShake 2s ease-in-out infinite;
}

.error-icon i {
    font-size: 2.5rem;
    color: var(--white);
}

.error-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    margin: -60px 0 0 -60px;
    border: 2px solid rgba(220, 53, 69, 0.3);
    border-radius: 50%;
    animation: rippleExpand 2s ease-out infinite;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes rippleExpand {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.error-content h3 {
    font-family: var(--font-primary);
    font-size: 1.5rem;
    font-weight: 600;
    color: #dc3545;
    margin-bottom: var(--space-md);
}

.error-content p {
    color: var(--gray-600);
    margin-bottom: var(--space-2xl);
    line-height: 1.6;
}

.retry-btn {
    background: var(--primary-gradient);
    color: var(--white);
    border: none;
    border-radius: var(--radius-xl);
    padding: var(--space-lg) var(--space-xl);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-md);
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.retry-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

/* ================================
   FOOTER
   ================================ */

.app-footer {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    color: var(--gray-600);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer-links i {
    color: #dc3545;
    animation: heartBeat 2s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ================================
   MODAL FOTOCAMERA
   ================================ */

/* Modal Overlay */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: var(--space-lg);
    animation: fadeIn 0.3s ease-out;
}

.modal[hidden] {
    display: none;
}

/* Camera Card Container */
.camera-card {
    background: var(--white);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: scaleIn 0.3s ease-out;
}

/* Camera Header */
.camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg) var(--space-xl);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
}

.camera-header h2 {
    font-family: var(--font-primary);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.camera-header h2 i {
    font-size: 1.5rem;
}

.camera-header .btn-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
}

.camera-header .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Camera Container */
.camera-container {
    position: relative;
    background: #000;
    min-height: 400px;
    max-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Switch Camera Button */
#switchCameraBtn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 55px;
    height: 55px;
    background: rgba(102, 126, 234, 0.95);
    border: 3px solid var(--white);
    border-radius: 50%;
    color: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
    z-index: 10;
}

#switchCameraBtn:hover {
    background: rgba(102, 126, 234, 1);
    transform: rotate(180deg) scale(1.1);
}

#switchCameraBtn:active {
    transform: rotate(180deg) scale(0.95);
}

/* Camera Controls Footer */
.camera-controls {
    padding: var(--space-xl);
    background: var(--gray-50);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-lg);
}

.camera-capture-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border: 4px solid var(--white);
    font-size: 1.75rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    transition: var(--transition-normal);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.camera-capture-btn i {
    font-size: 1.75rem;
}

.camera-capture-btn span {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.camera-capture-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.camera-capture-btn:active {
    transform: scale(0.95);
}

.camera-capture-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    animation: cameraRingPulse 2s ease-in-out infinite;
}

@keyframes cameraRingPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.3);
        opacity: 0;
    }
}

/* Responsive Camera Modal */
@media (max-width: 768px) {
    .modal {
        padding: 0;
    }
    
    .camera-card {
        max-height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }
    
    .camera-container {
        min-height: 50vh;
        max-height: 70vh;
    }
    
    .camera-controls {
        padding: var(--space-lg);
    }
    
    .camera-capture-btn {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }
    
    #switchCameraBtn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
        font-size: 1.1rem;
    }
}

@media (orientation: landscape) and (max-height: 600px) {
    .camera-container {
        max-height: 400px;
    }
    
    .camera-controls {
        padding: var(--space-md);
    }
    
    .camera-capture-btn {
        width: 60px;
        height: 60px;
        font-size: 1.2rem;
    }
}

/* ================================
   ANIMATIONS & UTILITIES
   ================================ */

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

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

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

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Hover effects for interactive elements */
.action-btn,
.analyze-btn,
.retry-btn,
.new-analysis-btn {
    transition: var(--transition-normal);
}

.action-btn:active,
.analyze-btn:active,
.retry-btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Focus states for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: buttonSpin 1s linear infinite;
}

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

/* Responsive breakpoints */
@media (min-width: 1024px) {
    .app-container {
        max-width: 700px;
    }
    
    .app-main {
        padding: var(--space-2xl) var(--space-2xl);
    }
    
    .upload-title {
        font-size: 2.5rem;
    }
    
    .calories-circle-enhanced {
        width: 180px;
        height: 180px;
    }
    
    .calories-number {
        font-size: 3rem;
    }
}

/* Print styles */
@media print {
    .bg-effects,
    .camera-section,
    .upload-section,
    .loading-section,
    .error-section {
        display: none !important;
    }
    
    .app-container {
        box-shadow: none;
        background: white;
    }
    
    .app-header {
        background: none;
        color: black;
    }
}

/* ================================
   SAFETY DISCLAIMER
   ================================ */

.safety-disclaimer {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(245, 101, 101, 0.1));
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    margin: var(--space-lg) 0;
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    backdrop-filter: blur(10px);
    animation: disclaimerPulse 2s ease-in-out infinite;
}

.disclaimer-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
}

.disclaimer-content {
    flex: 1;
}

.disclaimer-content h4 {
    font-family: var(--font-primary);
    font-weight: 600;
    color: #dc2626;
    margin-bottom: var(--space-sm);
    font-size: 1.1rem;
}

.disclaimer-content p {
    color: var(--gray-700);
    line-height: 1.5;
    font-size: 0.95rem;
}

.disclaimer-content strong {
    color: #dc2626;
    font-weight: 600;
}

@keyframes disclaimerPulse {
    0%, 100% {
        border-color: rgba(239, 68, 68, 0.3);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.5);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
}

/* ================================
   FOOTER STYLES - MINIMAL
   ================================ */

.app-footer {
    background: rgba(15, 15, 35, 0.8);
    /* backdrop-filter: blur(10px); */
    /* border-top: 1px solid rgba(255, 255, 255, 0.1); */
    /* margin-top: var(--space-2xl); */
    padding: var(--space-lg);
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--gray-400);
    font-size: 0.85rem;
    margin: 0;
}

