/* ==========================================================================
   TAILWIND UTILITIES
   Classes utilitaires style Tailwind pour la compatibilite du contenu legacy
   ========================================================================== */

/* Layout & Flexbox */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.overflow-hidden { overflow: hidden; }

/* IMPORTANT : .container N'EST PAS défini ici pour éviter le conflit
   avec .matcha-guide .container (max-width: 1600px).
   Utiliser directement .matcha-guide .container dans les templates. */

/* Typographie */
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }

/* Couleurs de texte - Gray (WCAG AA compliant sur fond blanc) */
.text-gray-100 { color: #f3f4f6; }  /* Decoratif uniquement */
.text-gray-200 { color: #e5e7eb; }  /* Decoratif uniquement */
.text-gray-300 { color: #d1d5db; }  /* Decoratif uniquement */
.text-gray-400 { color: #6b7280; }  /* Corrige: 5.0:1 au lieu de #9ca3af (2.6:1) */
.text-gray-500 { color: #525252; }  /* Corrige: 7.2:1 au lieu de #6b7280 (5.0:1) */
.text-gray-600 { color: #4b5563; }  /* OK: 7.5:1 */
.text-gray-700 { color: #374151; }  /* OK: 10.3:1 */
.text-gray-800 { color: #1f2937; }  /* OK: 14.0:1 */
.text-gray-900 { color: #111827; }  /* OK: 16.8:1 */

/* Couleurs de texte - Emerald/Green */
.text-emerald-500 { color: #10b981; }
.text-emerald-600 { color: #059669; }
.text-emerald-700 { color: #047857; }
.text-emerald-800 { color: #065f46; }
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-green-700 { color: #15803d; }

/* Couleurs de texte - Autres */
.text-white { color: #ffffff; }
.text-black { color: #000000; }
.text-red-500 { color: #ef4444; }
.text-red-600 { color: #dc2626; }
.text-yellow-500 { color: #eab308; }
.text-blue-500 { color: #3b82f6; }
.text-blue-600 { color: #2563eb; }

/* Fonds - Gray */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-800 { background-color: #1f2937; }
.bg-gray-900 { background-color: #111827; }

/* Fonds - Emerald/Green */
.bg-emerald-50 { background-color: #ecfdf5; }
.bg-emerald-100 { background-color: #d1fae5; }
.bg-emerald-500 { background-color: #10b981; }
.bg-green-50 { background-color: #f0fdf4; }
.bg-green-100 { background-color: #dcfce7; }
.bg-green-500 { background-color: #22c55e; }

/* Bordures */
.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-0 { border-width: 0; }
.border-2 { border-width: 2px; }
.border-t { border-top-width: 1px; border-style: solid; }
.border-b { border-bottom-width: 1px; border-style: solid; }
.border-l { border-left-width: 1px; border-style: solid; }
.border-r { border-right-width: 1px; border-style: solid; }

/* Couleurs de bordure */
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-gray-300 { border-color: #d1d5db; }
.border-emerald-500 { border-color: #10b981; }
.border-green-500 { border-color: #22c55e; }

/* Border Radius */
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-auto { margin: auto; }

.mx-auto { margin-left: auto; margin-right: auto; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-16 { margin-top: 4rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }
.mb-14 { margin-bottom: 3.5rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-20 { margin-bottom: 5rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-auto { margin-right: auto; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }

.pt-0 { padding-top: 0; }
.pt-2 { padding-top: 0.5rem; }
.pt-4 { padding-top: 1rem; }
.pb-0 { padding-bottom: 0; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pl-4 { padding-left: 1rem; }
.pr-4 { padding-right: 1rem; }

/* Width & Height */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.min-h-screen { min-height: 100vh; }
.max-w-full { max-width: 100%; }
.size-full { width: 100%; height: 100%; }
.size-auto { width: auto; height: auto; }

/* Gap (Flexbox/Grid) */
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flexbox */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.top-0 { top: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-0 { left: 0; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-50 { z-index: 50; }

/* Shadows
   IMPORTANT : ces classes utilisent des valeurs neutres sans écraser
   les variables CSS --shadow-* du thème principal.
   Ne pas appliquer .shadow-sm/.shadow-md/.shadow-lg sur des éléments
   qui ont déjà un box-shadow via leur sélecteur composant. */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); }
.shadow-none { box-shadow: none; }

/* Transitions */
.transition { transition: all 0.15s ease-in-out; }
.transition-colors { transition: color, background-color, border-color 0.15s ease-in-out; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.ease-in-out { transition-timing-function: ease-in-out; }

/* Opacity */
.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

/* Pointer Events */
.pointer-events-none { pointer-events: none; }
.pointer-events-auto { pointer-events: auto; }

/* Object Fit */
.object-cover { object-fit: cover; }
.object-contain { object-fit: contain; }
.object-center { object-position: center; }

/* List Style */
.list-none { list-style-type: none; }
.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }

/* Whitespace */
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Visibility */
.visible { visibility: visible; }
.invisible { visibility: hidden; }

/* Selection */
.select-none { user-select: none; }
.select-text { user-select: text; }

/* Screen Reader */
.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;
}

/* ==========================================================================
   EXTENSIONS TAILWIND
   ========================================================================== */

/* Arbitrary Values - Colors */
.text-\[\#3A4A3B\] { color: #3A4A3B; }
.text-\[\#4A5A4B\] { color: #4A5A4B; }
.bg-\[\#3A4A3B\] { background-color: #3A4A3B; }

/* Arbitrary Values - Sizes */
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-\[12px\] { font-size: 12px; }
.text-\[13px\] { font-size: 13px; }
.text-\[14px\] { font-size: 14px; }

/* Letter Spacing */
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Font Family */
.font-sans { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; }
.font-serif { font-family: ui-serif, Georgia, Cambria, "Times New Roman", serif; }
.font-mono { font-family: ui-monospace, SFMono-Regular, monospace; }

/* Border Width Variants */
.border-l-2 { border-left-width: 2px; }
.border-l-4 { border-left-width: 4px; }
.border-r-2 { border-right-width: 2px; }
.border-r-4 { border-right-width: 4px; }
.border-t-2 { border-top-width: 2px; }
.border-t-4 { border-top-width: 4px; }
.border-b-2 { border-bottom-width: 2px; }
.border-b-4 { border-bottom-width: 4px; }

/* Border Colors - Emerald */
.border-emerald-100 { border-color: #d1fae5; }
.border-emerald-200 { border-color: #a7f3d0; }
.border-emerald-300 { border-color: #6ee7b7; }
.border-emerald-400 { border-color: #34d399; }

/* ==========================================================================
   HOVER / FOCUS / GROUP STATES
   ========================================================================== */

.hover\:bg-gray-50:hover { background-color: #f9fafb; }
.hover\:bg-gray-100:hover { background-color: #f3f4f6; }
.hover\:bg-gray-200:hover { background-color: #e5e7eb; }
.hover\:text-gray-900:hover { color: #111827; }
.hover\:text-emerald-600:hover { color: #059669; }
.hover\:text-emerald-700:hover { color: #047857; }
.hover\:border-emerald-500:hover { border-color: #10b981; }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
.hover\:opacity-80:hover { opacity: 0.8; }

/* Group Hover */
.group { position: relative; }
.group:hover .group-hover\:text-emerald-600 { color: #059669; }
.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:visible { visibility: visible; }

/* Focus States */
.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5); }

/* ==========================================================================
   RESPONSIVE — Mobile-first
   IMPORTANT : Aucun override global de .flex ou .items-center ici.
   Utiliser .flex-col et les classes dédiées pour les layouts mobiles.
   ========================================================================== */

@media (max-width: 768px) {
    /* Visibilité responsive */
    .md\:hidden { display: none !important; }
    .md\:block { display: block !important; }

    /* Réduction typographique sur tablette/mobile */
    .text-2xl { font-size: 1.25rem; }
    .text-xl  { font-size: 1.125rem; }
    .text-lg  { font-size: 1rem; }

    /* Espacement réduit */
    .p-6  { padding: 1rem; }
    .p-8  { padding: 1.25rem; }
    .px-6 { padding-left: 1rem; padding-right: 1rem; }
    .py-4 { padding-top: 0.875rem; padding-bottom: 0.875rem; }

    .gap-6 { gap: 1rem; }
    .gap-5 { gap: 0.875rem; }
    .gap-4 { gap: 0.75rem; }
}

@media (max-width: 480px) {
    .text-2xl { font-size: 1.125rem; }
    .text-xl  { font-size: 1rem; }

    .p-5 { padding: 0.875rem; }
    .p-4 { padding: 0.75rem; }

    /* Classes dédiées pour empiler en colonne — pas d'override global de .flex */
    .flex-mobile-col { flex-direction: column; }
    .items-mobile-stretch { align-items: stretch; }
}

/* ==========================================================================
   TOUCH TARGETS MINIMUM (44×44px)
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    button,
    [role="button"],
    a,
    input[type="button"],
    input[type="submit"],
    select {
        min-height: 44px;
        min-width: 44px;
    }

    .px-3 { padding-left: 0.875rem; padding-right: 0.875rem; }
    .py-2 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
}

/* ==========================================================================
   ACCESSIBILITE — Focus & Contraste
   ========================================================================== */

.transition:focus-visible,
.cursor-pointer:focus-visible {
    outline: 3px solid #5D8A4E;
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .border { border-width: 2px; }
    .border-gray-200 { border-color: #000000; }
    .shadow-sm, .shadow, .shadow-md, .shadow-lg {
        box-shadow: 0 0 0 2px #000000;
    }
}

@media (prefers-reduced-motion: reduce) {
    .transition,
    .transition-colors {
        transition: none !important;
    }
}
