/* ===================================
   NutriCartes - Styles personnalisés
   ================================== */

/* Reset et base */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typographie display */
.font-display {
    font-family: 'Poppins', sans-serif;
}

/* Material Symbols - Prévention du flash de texte (FOIT) */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    user-select: none;
    font-size: 24px;
    width: 24px;
    height: 24px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    overflow: hidden;
    /* Cacher le texte avant que la font ne soit chargée */
    color: transparent;
    transition: color 0.3s ease;
}

/* Une fois la font chargée par le navigateur */
.fonts-loaded .material-symbols-outlined {
    color: inherit;
}

/* Logos et Images */
.logo-white {
    filter: brightness(0) invert(1);
}

/* Technique pour rendre transparent le fond blanc des logos générés */
.logo-multiply {
    mix-blend-mode: multiply;
}

.logo-premium {
    filter: drop-shadow(0 0 15px rgba(16, 185, 129, 0.4));
    transition: transform 0.3s ease;
}

.logo-premium:hover {
    transform: scale(1.05);
}

/* Feature Icons */
.feature-icon-container {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f3f4f6;
    border-radius: 12px;
}

.feature-icon-container .material-symbols-outlined {
    font-size: 32px !important;
    width: 32px;
    height: 32px;
}


/* ===================================
   Cartes alimentaires
   ================================== */

.food-card {
    min-width: 100%;
    scroll-snap-align: start;
    touch-action: pan-y;
}

#cards-wrapper {
    touch-action: pan-y;
}

/* Niveaux de la carte */
.card-level {
    transition: max-height 0.3s ease-in-out, opacity 0.2s ease-in-out;
}

.card-level.collapsed {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

.card-level.expanded {
    max-height: 2000px;
    opacity: 1;
    overflow-y: auto;
}

/* Boutons accordéon */
.accordion-btn {
    transition: all 0.2s ease-in-out;
}

.accordion-btn:active {
    transform: scale(0.98);
}

.accordion-btn .material-symbols-outlined {
    transition: transform 0.3s ease-in-out;
}

.accordion-btn.active .material-symbols-outlined {
    transform: rotate(180deg);
}

/* ===================================
   Points tricolores (indicateurs)
   ================================== */

.indicator-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.indicator-dot.green {
    background-color: #10b981;
}

.indicator-dot.orange {
    background-color: #f59e0b;
}

.indicator-dot.red {
    background-color: #ef4444;
}

/* ===================================
   Navigation dots
   ================================== */

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #d1d5db;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
}

.nav-dot.active {
    background-color: #10b981;
    width: 24px;
    border-radius: 5px;
}

/* ===================================
   Swipe horizontal
   ================================== */

#cards-container {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
}

#cards-wrapper {
    display: flex;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Pendant le swipe, désactiver la transition */
#cards-wrapper.swiping {
    transition: none;
}

/* ===================================
   Animations
   ================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.4s ease-out;
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

/* ===================================
   Three-dot menu (dropdown)
   ================================== */

.card-menu {
    position: relative;
}

.card-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    min-width: 180px;
    overflow: hidden;
    z-index: 1000;
    transform: scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.2s ease-out;
    transform-origin: top right;
}

.card-menu-dropdown.show {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.card-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.card-menu-item:hover {
    background-color: #f3f4f6;
}

.card-menu-item.danger:hover {
    background-color: #fee2e2;
    color: #dc2626;
}

/* ===================================
   Badges et scores
   ================================== */

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.score-badge.excellent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.score-badge.good {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.score-badge.moderate {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

/* ===================================
   Tableaux nutritionnels
   ================================== */

.nutrient-row {
    transition: background-color 0.15s ease-in-out;
}

.nutrient-row:hover {
    background-color: #f9fafb;
}

/* ===================================
   Images responsive
   ================================== */

.nutrition-image {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ===================================
   Modal
   ================================== */

#food-modal {
    backdrop-filter: blur(4px);
}

#food-modal.show {
    display: flex !important;
    animation: fadeIn 0.2s ease-out;
}

/* ===================================
   Loading spinner
   ================================== */

#loading-spinner.hidden {
    display: none !important;
}

/* ===================================
   Utilitaires
   ================================== */

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Touch feedback */
.touch-feedback:active {
    opacity: 0.7;
    transform: scale(0.98);
}

/* ===================================
   Bottom Navigation
   ================================== */

#bottom-nav {
    padding: 0.75rem 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    color: #6b7280;
    transition: all 0.2s ease;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-item:hover {
    color: #10b981;
}

.nav-item.active {
    color: #10b981;
    font-weight: 600;
}

.nav-item .material-symbols-outlined {
    transition: transform 0.2s ease;
}

.nav-item.active .material-symbols-outlined {
    transform: scale(1.1);
}

/* ===================================
   Filter Buttons
   ================================== */

.filter-btn {
    background-color: #f3f4f6;
    color: #6b7280;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.filter-btn:hover {
    background-color: #e5e7eb;
}

.filter-btn.active {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #10b981;
}

/* ===================================
   List View
   ================================== */

.food-list-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}

.food-list-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.food-list-card:active {
    transform: translateY(0);
}

/* ===================================
   Responsive - Mobile first
   ================================== */

@media (min-width: 640px) {
    .food-card {
        border-radius: 1rem;
    }
}

/* ===================================
   Accessibilité
   ================================== */

.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 visible pour navigation clavier */
*:focus-visible {
    outline: 2px solid #10b981;
    outline-offset: 2px;
}