@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    html {
        scroll-behavior: smooth;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
    }
    
    body {
        @apply font-inter text-gray-800 bg-gray-50;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    h1, h2, h3, h4, h5, h6 {
        @apply font-poppins font-semibold;
        line-height: 1.2;
    }
    
    /* Optimisation pour le touch sur mobile */
    input, select, textarea, button {
        font-size: 16px; /* Prévenir le zoom automatique sur iOS */
    }
}

@layer components {
    .btn-primary {
        @apply px-4 md:px-6 py-2 md:py-3 bg-blue-600 text-white font-medium rounded-lg shadow-md hover:bg-blue-700 transition-all duration-300 flex items-center gap-1 md:gap-2;
        min-height: 44px; /* Taille minimale pour le touch */
    }
    
    .btn-secondary {
        @apply px-4 md:px-6 py-2 md:py-3 bg-white border border-blue-600 text-blue-600 font-medium rounded-lg shadow-sm hover:bg-blue-50 transition-all duration-300 flex items-center gap-1 md:gap-2;
        min-height: 44px;
    }
    
    .card {
        @apply bg-white rounded-xl shadow-md overflow-hidden border border-gray-200 hover:shadow-lg transition-all;
    }
    
    .animate-fade-in {
        animation: fadeIn 0.6s ease forwards;
    }
    
    .animate-fade-in-up {
        animation: fadeInUp 0.6s ease forwards;
    }
    
    .animate-scale-in {
        animation: scaleIn 0.4s ease forwards;
    }
    
    .animate-delay-100 {
        animation-delay: 100ms;
    }
    
    .animate-delay-200 {
        animation-delay: 200ms;
    }
    
    .animate-delay-300 {
        animation-delay: 300ms;
    }
    
    .animate-delay-400 {
        animation-delay: 400ms;
    }
    
    .animate-delay-500 {
        animation-delay: 500ms;
    }
    
    .number-animation {
        animation: numberCount 0.8s ease-out;
    }
    
    .chart-animation {
        animation: chartGrow 1s ease-out;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes numberCount {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes chartGrow {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

/* Custom Leaflet styles */
.leaflet-container {
    @apply rounded-xl border border-gray-200;
    height: 100% !important;
    width: 100% !important;
    background-color: #f8fafc !important;
    touch-action: manipulation;
}

.leaflet-popup-content-wrapper {
    @apply rounded-lg shadow-md;
    max-width: 300px;
}

.leaflet-popup-content {
    @apply m-2 text-sm;
    line-height: 1.4;
}

.leaflet-popup-tip {
    @apply shadow-md;
}

/* Optimisation pour mobile */
@media (max-width: 640px) {
    .leaflet-container {
        border-radius: 12px;
        border-width: 1px;
    }
    
    .leaflet-popup-content {
        font-size: 13px;
        margin: 8px;
    }
    
    .leaflet-control-zoom {
        transform: scale(0.9);
        margin: 10px !important;
    }
}

/* Custom Chart.js tooltip */
.chartjs-tooltip {
    @apply bg-white shadow-lg rounded-lg border border-gray-200 p-2 md:p-3 opacity-0 transition-opacity duration-200;
    max-width: 250px;
    pointer-events: none;
}

.chartjs-tooltip-key {
    @apply inline-block w-3 h-3 rounded-full mr-1;
}

/* Corporate Memphis additions */
.memphis-pattern {
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.08) 0%, transparent 55%),
        radial-gradient(circle at 75% 75%, rgba(139, 92, 246, 0.08) 0%, transparent 55%),
        radial-gradient(circle at 50% 50%, rgba(236, 72, 153, 0.05) 0%, transparent 55%);
}

.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .bento-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Ajustement pour tablettes */
    .leaflet-control-zoom {
        margin: 15px !important;
    }
}

@media (max-width: 640px) {
    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-icon {
        width: 48px;
        height: 48px;
    }
    
    /* Ajustements pour mobiles */
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    /* Optimisation des marges pour mobile */
    section {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    
    /* Meilleure lisibilité sur mobile */
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    p, span, div {
        font-size: 0.875rem;
    }
}

/* Support pour les appareils très petits */
@media (max-width: 360px) {
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    h1 {
        font-size: 1.25rem;
    }
    
    h2 {
        font-size: 1.125rem;
    }
}

/* Amélioration de l'accessibilité au clavier */
button:focus, 
a:focus,
select:focus,
input:focus {
    @apply outline-none ring-2 ring-blue-500 ring-offset-2;
}

/* Support pour le mode somme */
@media (prefers-color-scheme: dark) {
    .leaflet-container {
        background-color: #1f2937 !important;
        filter: brightness(0.8) contrast(1.2);
    }
}

/* Correction pour iOS Safari */
@supports (-webkit-touch-callout: none) {
    .leaflet-container {
        -webkit-overflow-scrolling: touch;
    }
}