/* Modern 3D Food App Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Indian Food Colors */
    --saffron: #FF9933;
    --mint: #138808;
    --curry: #F59E0B;
    --turmeric: #FCD34D;
    --cardamom: #10B981;

    /* Neutrals */
    --dark: #1A202C;
    --dark-soft: #2D3748;
    --gray: #4A5568;
    --light-gray: #E2E8F0;
    --white: #FFFFFF;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #FF9933 0%, #F59E0B 50%, #138808 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, #FFF8F0 0%, #FFFFFF 100%);
    color: var(--dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.app {
    min-height: 100vh;
    position: relative;
}

/* Hero Section */
.hero-container {
    position: relative;
    height: 50vh;
    min-height: 320px;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.7);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        rgba(0, 0, 0, 0.3) 0%,
        rgba(0, 0, 0, 0.5) 100%
    );
}

.hero-content-wrapper {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 2rem;
    max-width: 600px;
    animation: fadeInUp 0.8s ease-out;
}

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

.brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

.brand-badge:hover {
    transform: scale(1.05);
}

.logo-3d {
    width: 40px;
    height: 40px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.brand-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero-heading {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 900;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    letter-spacing: -1px;
}

.hero-tagline {
    font-size: clamp(1rem, 3vw, 1.25rem);
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    margin: 0 auto;
}

/* Upload Section */
.upload-section {
    position: relative;
    padding: 3rem 1.5rem;
    min-height: 40vh;
}

.upload-container {
    max-width: 500px;
    margin: -80px auto 0;
    position: relative;
    z-index: 10;
}

/* Preview Container */
.preview-container {
    display: none;
    position: relative;
    width: 100%;
    height: 300px;
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-xl);
    animation: scaleIn 0.4s ease-out;
}

.preview-container.show {
    display: block;
}

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

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 5;
}

.remove-image:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: scale(1.1);
}

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(30px) saturate(150%);
    border-radius: 32px;
    padding: 3rem 2rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.6s ease-out;
    transform-style: preserve-3d;
}

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

.camera-icon-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.camera-icon {
    width: 100px;
    height: 100px;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(255, 153, 51, 0.3));
}

.upload-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 0.5rem;
    text-align: center;
    letter-spacing: -0.5px;
}

.upload-subtitle {
    font-size: 1rem;
    color: var(--gray);
    text-align: center;
    margin-bottom: 2.5rem;
}

/* Button Group */
.button-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1.25rem 1.5rem;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.action-btn:hover::before {
    transform: translateX(100%);
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.primary-btn {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 6px 20px rgba(255, 153, 51, 0.4);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(255, 153, 51, 0.5);
}

.primary-btn:active {
    transform: translateY(0);
}

.secondary-btn {
    background: white;
    color: var(--dark);
    border: 2px solid var(--light-gray);
    box-shadow: var(--shadow-sm);
}

.secondary-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--saffron);
}

.analyze-btn {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 8px 30px rgba(255, 153, 51, 0.4);
    margin-top: 1rem;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 8px 30px rgba(255, 153, 51, 0.4);
    }
    50% {
        box-shadow: 0 8px 40px rgba(255, 153, 51, 0.6);
    }
}

.analyze-btn:hover {
    transform: translateY(-3px) scale(1.02);
}

.sparkle {
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.file-info {
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray);
}

/* Meal Description Input */
.description-input-wrapper {
    margin-top: 2rem;
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

.description-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.75rem;
}

.label-required {
    color: #EF4444;
    font-size: 1.25rem;
}

.meal-description-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--light-gray);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--dark);
    background: white;
    resize: vertical;
    transition: all 0.3s ease;
    min-height: 80px;
}

.meal-description-input:focus {
    outline: none;
    border-color: var(--saffron);
    box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.1);
}

.meal-description-input::placeholder {
    color: var(--gray);
    opacity: 0.6;
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

.char-counter #charCount {
    font-weight: 600;
    color: var(--dark);
}

.meal-description-input:invalid {
    border-color: #EF4444;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

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

.loader-3d {
    position: relative;
    width: 100px;
    height: 100px;
}

.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--saffron);
    border-radius: 50%;
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.spinner-ring:nth-child(2) {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-top-color: var(--curry);
    animation-delay: 0.2s;
}

.spinner-ring:nth-child(3) {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top-color: var(--mint);
    animation-delay: 0.4s;
}

.loading-text {
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error Toast */
.error-toast {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    animation: slideInUp 0.4s ease-out;
    max-width: 90%;
}

.error-toast.show {
    display: block;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Results Section */
.results-section {
    display: none;
    min-height: 100vh;
    padding: 2rem 1.5rem;
    background: linear-gradient(180deg, #FFF8F0 0%, #FFFFFF 100%);
}

.results-section.show {
    display: block;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.results-container {
    max-width: 600px;
    margin: 0 auto;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--light-gray);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 2rem;
}

.back-btn svg {
    width: 20px;
    height: 20px;
}

.back-btn:hover {
    background: white;
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

.results-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 2rem;
    text-align: center;
}

/* 3D Macro Grid */
.macro-grid-3d {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.macro-card-3d {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: cardFloat 0.6s ease-out forwards;
    opacity: 0;
}

@keyframes cardFloat {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.macro-card-3d:nth-child(1) { animation-delay: 0.1s; }
.macro-card-3d:nth-child(2) { animation-delay: 0.2s; }
.macro-card-3d:nth-child(3) { animation-delay: 0.3s; }
.macro-card-3d:nth-child(4) { animation-delay: 0.4s; }

.macro-card-3d:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: var(--shadow-xl);
}

.card-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.macro-card-3d:hover .card-glow {
    opacity: 1;
}

.calories-card .card-glow {
    background: radial-gradient(circle at center, rgba(251, 146, 60, 0.2), transparent);
}

.protein-card .card-glow {
    background: radial-gradient(circle at center, rgba(239, 68, 68, 0.2), transparent);
}

.carbs-card .card-glow {
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.2), transparent);
}

.fat-card .card-glow {
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.2), transparent);
}

.macro-icon-3d {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.macro-value-3d {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--dark);
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.macro-label-3d {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Details Card */
.details-card {
    display: none;
    background: white;
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-top: 2rem;
    line-height: 1.8;
    color: var(--dark);
}

.details-card:not(:empty) {
    display: block;
    animation: slideUp 0.6s ease-out;
}

.details-card strong {
    color: var(--saffron);
    font-weight: 700;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .hero-container {
        height: 35vh;
        min-height: 280px;
        max-height: 350px;
    }

    .hero-content-wrapper {
        padding: 1rem;
    }

    .brand-badge {
        padding: 8px 16px;
        margin-bottom: 1rem;
    }

    .logo-3d {
        width: 32px;
        height: 32px;
    }

    .brand-text {
        font-size: 1.25rem;
    }

    .hero-heading {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }

    .hero-tagline {
        font-size: 0.9rem;
    }

    .upload-section {
        padding: 2rem 1rem;
    }

    .upload-container {
        margin: -60px auto 0;
    }

    .glass-card {
        padding: 2rem 1.5rem;
    }

    .camera-icon-wrapper {
        margin-bottom: 1.5rem;
    }

    .camera-icon {
        width: 80px;
        height: 80px;
    }

    .upload-title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }

    .upload-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }

    .button-group {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1rem;
    }

    .action-btn {
        padding: 1rem 1.25rem;
    }

    .file-info {
        font-size: 0.75rem;
    }

    .macro-grid-3d {
        gap: 1rem;
    }

    .macro-card-3d {
        padding: 1.5rem 1rem;
    }

    .macro-value-3d {
        font-size: 2rem;
    }

    .macro-icon-3d {
        font-size: 2.5rem;
    }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection Color */
::selection {
    background: var(--saffron);
    color: white;
}
