/* NutriScan Custom Styles */

:root {
    --primary-green: #10b981;
    --primary-blue: #3b82f6;
    --primary-purple: #8b5cf6;
    --primary-pink: #ec4899;
    --gray-800: #1f2937;
    --gray-600: #4b5563;
    --gray-400: #9ca3af;
}

/* Contenedor principal optimizado para mejor uso del espacio */
.container {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-left: auto;
    margin-right: auto;
}

/* Ancho máximo aumentado para aprovechar mejor el espacio horizontal */
@media (min-width: 640px) {
    .container {
        max-width: 100%;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 100%;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 100%;
        padding-left: 2rem;
        padding-right: 2rem;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1400px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1600px;
    }
}

/* Mejoras para el centrado de elementos */
.result-card h4 {
    text-align: center;
    justify-content: center;
}

.result-card p {
    text-align: center;
}

.text-center {
    text-align: center !important;
}

/* Mejoras para micronutrientes */
.micro-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.2);
}

.grid.md\:grid-cols-4 {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .grid.md\:grid-cols-4 {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (min-width: 1024px) {
    .grid.md\:grid-cols-4 {
        max-width: 85%;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Mejoras para espacio lateral */
.result-card {
    max-width: 100%;
    padding: 2rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .result-card {
        padding: 2.5rem;
    }
}

@media (min-width: 1024px) {
    .result-card {
        padding: 3rem;
    }
}

/* Optimización para sección de análisis */
#analizar .container {
    max-width: 100%;
}

#analizar .mx-auto {
    max-width: 100%;
}

/* Mejoras para upload area */
#upload-area {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Mejoras para preview area */
#preview-area {
    max-width: 100%;
}

/* Mejoras para results area */
#results-area {
    max-width: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Animaciones personalizadas */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* Header animations */
.header-animate {
    animation: fadeInUp 0.6s ease-out;
}

/* Hero section animations */
.hero-title {
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.hero-buttons {
    animation: fadeInUp 0.8s ease-out 0.6s both;
}

.hero-stats {
    animation: fadeInUp 0.8s ease-out 0.8s both;
}

/* Upload area styles */
#upload-area {
    transition: all 0.3s ease;
}

#upload-area:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.upload-zone {
    position: relative;
    overflow: hidden;
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.upload-zone:hover::before {
    left: 100%;
}

/* Progress bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-blue));
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Results cards */
.result-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Nutrient bars */
.nutrient-bar {
    background-color: #f3f4f6;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.nutrient-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease-in-out;
}

.nutrient-fill.protein {
    background: linear-gradient(90deg, #ef4444, #f97316);
}

.nutrient-fill.carbs {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

.nutrient-fill.fats {
    background: linear-gradient(90deg, #10b981, #059669);
}

.nutrient-fill.fiber {
    background: linear-gradient(90deg, #8b5cf6, #7c3aed);
}

/* Micronutrient indicators */
.micro-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.micro-indicator.high {
    background-color: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.micro-indicator.medium {
    background-color: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.5);
}

.micro-indicator.low {
    background-color: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

/* Recommendations */
.recommendation-item {
    background: linear-gradient(135deg, #f0f9ff, #ecfdf5);
    border-left: 4px solid var(--primary-blue);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.recommendation-item.supplement {
    border-left-color: var(--primary-green);
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
}

/* Loading animation */
.loading-pulse {
    animation: pulse 2s infinite;
}

/* Food detection overlay */
.food-overlay {
    position: absolute;
    border: 2px solid var(--primary-green);
    border-radius: 4px;
    background-color: rgba(16, 185, 129, 0.1);
    transition: all 0.3s ease;
}

.food-label {
    position: absolute;
    top: -25px;
    left: 0;
    background-color: var(--primary-green);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem !important;
    }
    
    .upload-area {
        padding: 1rem !important;
    }
    
    .upload-zone {
        padding: 2rem !important;
    }
    
    .result-grid {
        grid-template-columns: 1fr !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .result-card {
        background-color: #1f2937;
        color: white;
    }
    
    .nutrient-bar {
        background-color: #374151;
    }
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus states */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Micronutrient level indicators */
.micro-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.micro-indicator.low {
    background-color: #ef4444;
}

.micro-indicator.medium {
    background-color: #f59e0b;
}

.micro-indicator.high {
    background-color: #10b981;
}

/* Quick analysis specific styles */
.recommendation-item {
    transition: all 0.3s ease;
}

.recommendation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Result cards animations */
.result-card {
    animation: slideInUp 0.6s ease-out;
}

.result-card:nth-child(2) {
    animation-delay: 0.1s;
}

.result-card:nth-child(3) {
    animation-delay: 0.2s;
}

.result-card:nth-child(4) {
    animation-delay: 0.3s;
}

/* Loading animation for quick analysis */
.quick-loading {
    animation: pulse 2s infinite;
}

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

/* Hover effects for action buttons */
.action-button {
    transition: all 0.3s ease;
}

.action-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* Responsive improvements for mobile */
@media (max-width: 768px) {
    /* Optimización general para móviles */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Área de subida optimizada para móviles */
    #upload-area {
        padding: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    #upload-area .border-dashed {
        padding: 2rem 1rem !important;
    }
    
    #upload-area i {
        font-size: 3rem !important;
        margin-bottom: 1rem !important;
    }
    
    #upload-area h4 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #upload-area p {
        font-size: 0.875rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Preview area optimizado */
    #preview-area {
        padding: 1.5rem !important;
    }
    
    #preview-area .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Results area optimizado */
    #results-area {
        padding: 1.5rem !important;
    }
    
    /* Formularios de ingredientes */
    .ingredient-item {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .ingredient-name,
    .ingredient-amount,
    .ingredient-unit {
        width: 100% !important;
    }
    
    .food-description-form {
        padding: 1.5rem !important;
    }
    
    .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .analysis-method-badge {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }
    
    /* Mejoras para sección de análisis */
    section#analizar {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Textos de encabezado más pequeños en móvil */
    section#analizar h3 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    section#analizar p {
        font-size: 1rem !important;
    }
    
    /* Botones apilados en móvil */
    .flex.flex-col.sm\:flex-row {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Hero buttons en móvil */
    .hero-buttons {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }
    
    /* Estadísticas del hero en móvil */
    .hero-stats .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    /* Ajustes adicionales para maximizar el uso del espacio en móvil */
    body {
        margin: 0;
        padding: 0;
    }
    
    header {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    section {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

/* ===== NUEVOS ESTILOS PARA FORMULARIO DE DESCRIPCIÓN MANUAL ===== */

/* Formulario de descripción manual */
.food-description-form {
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.ingredient-item {
    transition: all 0.3s ease;
}

.ingredient-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.ingredient-name:focus,
.ingredient-amount:focus,
.ingredient-unit:focus {
    ring-width: 2px;
    ring-color: #10b981 !important;
    border-color: transparent !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2) !important;
}

/* Botones del formulario mejorados */
.form-button-primary {
    background: linear-gradient(135deg, #10b981, #3b82f6);
    color: white;
    transition: all 0.3s ease;
}

.form-button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.form-button-secondary {
    border: 2px solid #d1d5db;
    color: #374151;
    transition: all 0.3s ease;
}

.form-button-secondary:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

/* Indicadores de calidad nutricional mejorados */
.nutrient-level-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
}

.nutrient-level-low {
    background-color: #ef4444;
}

.nutrient-level-medium {
    background-color: #f59e0b;
}

.nutrient-level-high {
    background-color: #10b981;
}

/* Animaciones para resultados mejorados */
.enhanced-results .result-card {
    animation: slideInUp 0.6s ease-out;
}

.enhanced-results .result-card:nth-child(2) {
    animation-delay: 0.1s;
}

.enhanced-results .result-card:nth-child(3) {
    animation-delay: 0.2s;
}

.enhanced-results .result-card:nth-child(4) {
    animation-delay: 0.3s;
}

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

/* Mejoras para el preview de imagen */
.image-preview-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
}

.image-preview-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Estilos para badges de método de análisis */
.analysis-method-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 1rem;
}

.method-hybrid {
    background-color: #dcfce7;
    color: #166534;
}

.method-automatic {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Estilos para las sugerencias de alimentos */
.food-suggestions {
    background: linear-gradient(135deg, #f0f9ff, #ecfdf5);
    border-radius: 0.75rem;
    padding: 1rem;
    margin-top: 1rem;
}

.suggestion-tag {
    display: inline-block;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    padding: 0.25rem 0.75rem;
    margin: 0.25rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.suggestion-tag:hover {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

/* Responsive improvements for form */
@media (max-width: 768px) {
    /* Optimización general para móviles */
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Área de subida optimizada para móviles */
    #upload-area {
        padding: 1.5rem !important;
        margin-bottom: 1.5rem !important;
    }
    
    #upload-area .border-dashed {
        padding: 2rem 1rem !important;
    }
    
    #upload-area i {
        font-size: 3rem !important;
        margin-bottom: 1rem !important;
    }
    
    #upload-area h4 {
        font-size: 1.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    #upload-area p {
        font-size: 0.875rem !important;
        margin-bottom: 0.75rem !important;
    }
    
    /* Preview area optimizado */
    #preview-area {
        padding: 1.5rem !important;
    }
    
    #preview-area .grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }
    
    /* Results area optimizado */
    #results-area {
        padding: 1.5rem !important;
    }
    
    /* Formularios de ingredientes */
    .ingredient-item {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .ingredient-name,
    .ingredient-amount,
    .ingredient-unit {
        width: 100% !important;
    }
    
    .food-description-form {
        padding: 1.5rem !important;
    }
    
    .grid.md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    
    .analysis-method-badge {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }
    
    /* Mejoras para sección de análisis */
    section#analizar {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    /* Textos de encabezado más pequeños en móvil */
    section#analizar h3 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }
    
    section#analizar p {
        font-size: 1rem !important;
    }
    
    /* Botones apilados en móvil */
    .flex.flex-col.sm\:flex-row {
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    /* Hero buttons en móvil */
    .hero-buttons {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: stretch !important;
    }
    
    /* Estadísticas del hero en móvil */
    .hero-stats .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}