/* Renergy4all - Custom Styles
   ===========================
   Styles CSS personnalisés pour compléter Tailwind CSS
*/

/* Variables CSS pour cohérence des couleurs */
:root {
    --primary-blue: #2563eb;
    --primary-yellow: #fbbf24;
    --primary-green: #10b981;
    --dark-blue: #1e3a8a;
    --light-gray: #f9fafb;
    --text-dark: #1f2937;
}

/* Optimisations pour performances */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scroll behavior personnalisé */
html {
    scroll-behavior: smooth;
}

/* Amélioration de l'accessibilité */
:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* Animation de chargement pour les images */
img {
    opacity: 0;
    animation: imageLoad 0.5s ease-in forwards;
}

@keyframes imageLoad {
    to {
        opacity: 1;
    }
}

/* Animation pour le titre Hero - Renergy4all Group */
/* Animation complète qui se répète toutes les 30 secondes */
.hero-title-animated {
    display: inline-block;
    position: relative;
    color: white;
    text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    white-space: nowrap;
    width: 0;
    animation: 
        typing 2s steps(18, end) forwards,
        energyAnimation 10s 2s ease-in-out forwards,
        cycleAnimation 30s infinite;
}

/* Effet de frappe dactylographique (2 secondes) */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

/* Animation énergétique (10 secondes, démarre après typing) */
@keyframes energyAnimation {
    0% {
        background: linear-gradient(
            135deg,
            #FF8C00 0%,
            #FFA500 25%,
            #FFD700 50%,
            #1E90FF 75%,
            #1E40AF 100%
        );
        background-size: 300% 300%;
        background-position: 0% 50%;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        filter: drop-shadow(0 0 15px rgba(255, 140, 0, 0.6))
                drop-shadow(0 0 25px rgba(30, 144, 255, 0.4));
    }
    25% {
        background-position: 50% 50%;
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.7))
                drop-shadow(0 0 30px rgba(255, 140, 0, 0.5));
    }
    50% {
        background-position: 100% 50%;
        filter: drop-shadow(0 0 25px rgba(30, 144, 255, 0.8))
                drop-shadow(0 0 35px rgba(30, 64, 175, 0.6));
    }
    75% {
        background-position: 50% 50%;
        filter: drop-shadow(0 0 20px rgba(255, 165, 0, 0.6))
                drop-shadow(0 0 30px rgba(30, 144, 255, 0.4));
    }
    100% {
        background: none;
        color: white;
        -webkit-text-fill-color: white;
        filter: none;
    }
}

/* Cycle complet toutes les 30 secondes */
@keyframes cycleAnimation {
    0%, 6.67% {
        /* Pendant typing (0-2s) */
        width: 0;
        color: white;
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
    }
    6.67%, 40% {
        /* Après typing jusqu'à 12s (2-12s) */
        width: 100%;
    }
    40%, 100% {
        /* Blanc figé (12-30s = 18s de pause) */
        width: 100%;
        background: none;
        color: white;
        -webkit-text-fill-color: white;
        filter: none;
        text-shadow: 3px 3px 10px rgba(0, 0, 0, 0.9);
    }
}

/* Arc électrique qui traverse les lettres R → P (2 secondes) */
.hero-title-animated::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 100%;
    transform: translateY(-50%);
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(30, 144, 255, 0.8) 2%,
        rgba(135, 206, 250, 1) 4%,
        rgba(30, 144, 255, 0.8) 6%,
        transparent 8%
    );
    background-size: 1250% 100%;
    background-position: -100% 0;
    filter: blur(1px);
    mix-blend-mode: screen;
    animation: electricArc 2s ease-out forwards,
               arcCycle 30s infinite;
    z-index: 10;
    pointer-events: none;
}

@keyframes electricArc {
    0% {
        background-position: 0% 0;
        opacity: 1;
    }
    100% {
        background-position: 100% 0;
        opacity: 0;
    }
}

/* Cycle de l'arc électrique toutes les 30s */
@keyframes arcCycle {
    0%, 6.67% {
        background-position: 0% 0;
        opacity: 1;
    }
    6.67% {
        background-position: 100% 0;
        opacity: 0;
    }
    6.68%, 100% {
        background-position: 100% 0;
        opacity: 0;
    }
}

/* Halo énergétique pendant la phase animée (2-12s) */
.hero-title-animated::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    height: 140%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle,
        rgba(255, 140, 0, 0.15) 0%,
        rgba(255, 215, 0, 0.1) 30%,
        rgba(30, 144, 255, 0.08) 50%,
        transparent 70%
    );
    animation: energyHalo 10s 2s ease-in-out forwards,
               haloCycle 30s infinite;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
}

@keyframes energyHalo {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.15);
    }
    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
    80% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(1.15);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Cycle du halo toutes les 30s */
@keyframes haloCycle {
    0%, 6.67% {
        opacity: 0;
    }
    6.67%, 40% {
        /* Actif pendant la phase énergétique */
    }
    40%, 100% {
        opacity: 0;
    }
}

/* Style pour les liens */
a {
    transition: all 0.3s ease;
}

/* Logo scroll effect - transition douce entre logo complet et icône */
nav img[alt*="Logo"] {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 5rem; /* 80px - Taille normale logo complet */
    width: auto;
    max-height: 5rem;
}

/* Logo réduit au scroll - icône seule plus petite */
nav img[alt*="Logo"].logo-scrolled {
    height: 3rem; /* 48px - Icône seule plus petite */
    max-height: 3rem;
    width: auto;
}

/* Navigation au scroll - ajoute une ombre */
nav.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Responsive - Sur mobile, ajuster les tailles */
@media (max-width: 768px) {
    nav img[alt*="Logo"] {
        height: 4rem; /* 64px sur mobile (logo complet) */
        max-height: 4rem;
    }
    
    nav img[alt*="Logo"].logo-scrolled {
        height: 2.5rem; /* 40px sur mobile (icône seule) */
        max-height: 2.5rem;
    }
}

/* Style pour les boutons avec effet ripple */
button {
    position: relative;
    overflow: hidden;
}

button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::after {
    width: 300px;
    height: 300px;
}

/* Amélioration du chatbot */
#chatbot-window {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Style pour les messages du chatbot avec animation */
.chat-bubble {
    animation: slideIn 0.3s ease-out;
}

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

/* Amélioration des cards avec ombre progressive */
.card-hover {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-hover:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Style pour les sections avec parallax léger */
section {
    position: relative;
}

/* Amélioration du formulaire */
input:focus, 
textarea:focus, 
select:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Style pour les messages de succès/erreur */
.success-message {
    animation: slideInFromTop 0.5s ease-out;
}

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

/* Amélioration de la navigation sticky */
nav {
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

/* Style pour les icônes avec animation */
i {
    transition: transform 0.3s ease;
}

.card-hover:hover i {
    transform: scale(1.1);
}

/* Style pour le footer */
footer a:hover {
    text-decoration: underline;
}

/* Amélioration responsive pour petits écrans */
@media (max-width: 640px) {
    #chatbot-window {
        width: calc(100vw - 2rem);
        bottom: 5rem;
        right: 1rem;
    }
    
    .chat-bubble {
        max-width: 85%;
    }
}

/* Style pour le simulateur avec résultats animés */
#simulation-results > div {
    animation: fadeInUp 0.5s ease-out;
}

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

/* Amélioration du loader (si ajouté dans le futur) */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-blue);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Style pour les badges et étiquettes */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* Style pour les alertes */
.alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* ================================
   GALLERY STYLES
   ================================ */

/* Gallery items transition */
.gallery-item {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s ease-in-out;
}

/* Gallery filter button styles */
.gallery-filter-btn {
    transition: all 0.3s ease;
}

.gallery-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-filter-btn.active {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Gallery item hover effect */
.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Aspect ratio utility for gallery images */
.aspect-w-16 {
    position: relative;
    padding-bottom: 75%; /* 4:3 aspect ratio */
}

.aspect-w-16 > * {
    position: absolute;
    height: 100%;
    width: 100%;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

/* Dropdown menu styles */
.group:hover .group-hover\:opacity-100 {
    opacity: 1;
}

.group:hover .group-hover\:visible {
    visibility: visible;
}

/* Mobile submenu animation */
#mobile-projets-submenu {
    transition: all 0.3s ease;
}

/* Gallery statistics cards animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: countUp 0.6s ease-out forwards;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Hero background image - ajustement pour desktop */
.hero-bg-image {
    object-position: center center;
}

/* Sur desktop (écrans larges), réduire le zoom de l'image */
@media (min-width: 1024px) {
    .hero-bg-image {
        object-fit: contain;
        background-color: #1e3a8a;
    }
}

/* Sur tablette et mobile, garder object-cover */
@media (max-width: 1023px) {
    .hero-bg-image {
        object-fit: cover;
    }
}

/* Print styles */
@media print {
    nav, 
    footer, 
    #chatbot-widget,
    .no-print {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
    }
    
    h1 {
        font-size: 24pt;
    }
    
    h2 {
        font-size: 18pt;
    }
}

/* Accessibilité : Mode sombre (si activé par l'utilisateur) */
@media (prefers-color-scheme: dark) {
    /* Les styles seront ajoutés dans une future version */
}

/* Animations pour les statistiques et compteurs */
.counter {
    transition: all 0.3s ease;
}

/* Style pour les tooltips (future implémentation) */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 5px 10px;
    border-radius: 6px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}