html {
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #333;
    background-image: url('background.svg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #121212;
    color: #f5f5f5;
    background-image: url('background-dark.svg'); /* Use dark mode background image */
}

body.dark-mode #main-header {
    background-color: rgba(34, 34, 34, 0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

body.dark-mode .hero-content h1,
body.dark-mode h2,
body.dark-mode .title-small {
    color: #ABB2BF; /* Soft light grey for dark mode headings and title */
}

body.dark-mode nav a {
    color: #bbbbbb;
}

body.dark-mode nav a:hover,
body.dark-mode nav a.active {
    color: #90ee90; /* Lighter green for dark mode active/hover */
}

body.dark-mode .feature-item {
    background: #282c34;
    border: 1px solid #3a3f4b;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

body.dark-mode .feature-item h3 {
    color: #4CAF50; /* Less flashy green for dark mode feature titles */
}

body.dark-mode .feature-item p {
    color: #abb2bf;
}

body.dark-mode .scroll-down-button,
body.dark-mode .scroll-up-button {
    background-color: #3a3f4b;
}

body.dark-mode .scroll-down-button svg {
    fill: #f5f5f5;
}

body.dark-mode .form-group label {
    color: #f5f5f5;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background-color: #3a3f4b;
    border: 1px solid #5c6370;
    color: #f5f5f5;
}

body.dark-mode button[type="submit"] {
    background-color: #61afef;
}

body.dark-mode button[type="submit"]:hover {
    background-color: #529cd0;
}

/* Dark Mode Switch */
.switch-container {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    margin-right: 20px;
}

.switch-checkbox {
    display: none;
}

.switch-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* Light mode track */
    border-radius: 28px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.switch-label:before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #fff; /* Light mode thumb */
    top: 4px;
    left: 4px;
    transition: transform 0.3s;
}

.switch-checkbox:checked + .switch-label {
    background-color: #4CAF50; /* Dark mode track */
}

.switch-checkbox:checked + .switch-label:before {
    transform: translateX(22px);
}

/* Dark mode specific styles for the switch */
body.dark-mode .switch-label {
    background-color: #555; /* Dark mode track */
}

body.dark-mode .switch-checkbox:checked + .switch-label {
    background-color: #61afef; /* Dark mode track when checked */
}

body.dark-mode .switch-label:before {
    background-color: #f5f5f5; /* Dark mode thumb */
}

body.dark-mode .switch-checkbox:checked + .switch-label:before {
    background-color: #f5f5f5; /* Dark mode thumb when checked */
}

@media (max-width: 768px) {
    .switch-container {
        width: 40px;
        height: 22px;
    }

    .switch-label:before {
        width: 16px;
        height: 16px;
        top: 3px;
        left: 3px;
    }

    .switch-checkbox:checked + .switch-label:before {
        transform: translateX(18px);
    }
}

html {
    scroll-snap-type: y mandatory;
}

section {
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 20px;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    scroll-margin-top: 30px; /* Offset for fixed header */
}

#hero {
    color: #333;
}

.hero-content h1 {
    font-size: 8rem;
    margin: -30px 0 50px 0; /* Réduit l'espace entre le logo et le texte */
    color: #0056b3;
}

.hero-content {
    margin-top: -100px; /* Remonte l'ensemble du contenu de la section hero */
}

.hero-content p {
    font-size: 2.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

body.dark-mode .hero-content p {
    color: #ABB2BF; /* Make hero description readable in dark mode */
}

#features {
    display: flex;
    flex-direction: column;
    padding-top: 0; /* Sera ajusté par la media query */
    padding-bottom: 130px; /* Augmenté pour compenser la réduction en haut */
    box-sizing: border-box;
}

.features-grid {
    padding-top: 60px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); /* Blocs encore plus larges */
    gap: 25px;
    text-align: left;
}

.feature-item {
    background: #ffffff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    position: relative;
    border: 1px solid #f0f0f0;
}

.feature-icon {
    position: absolute;
    top: 25px; /* Aligné avec le padding du parent pour un alignement parfait */
    right: 25px;
    opacity: 0.7;
}

.feature-item h3 {
    font-size: 1.6rem; /* Police légèrement agrandie */
    color: #34A853;
    margin-top: 0;
}

.feature-item p {
    font-size: 1rem;
    line-height: 1.6;
}

.container {
    max-width: 1200px; /* Conteneur encore plus large */
    margin: 0 auto;
}

h2 {
    font-size: 3.8rem;
    margin-bottom: 60px; /* Espace agrandi sous le titre */
    color: #0056b3;
}

@keyframes logo-fade-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.logo svg {
    margin-bottom: 20px;
    animation: logo-fade-in 1.5s ease-out forwards;
}

.logo-small svg {
    margin-top: 15px;
}

/* Header */
#main-header {
    position: fixed;
    top: 0; /* Always visible */
    left: 0;
    width: 100%;
    height: 90px;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
    display: flex;
    align-items: center;
}

#main-header.sticky {
    top: 0;
}

.header-container {
    display: flex;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding-right: 20px; /* Keep right padding */
    justify-content: space-between; /* Distribute items to ends */
}

.header-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    padding-left: 50px; /* 50px from left edge */
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-grow: 1; /* Allow nav to take available space */
    justify-content: center; /* Center the links */
}

nav li {
    margin: 0 20px;
    position: relative;
}

nav a {
    text-decoration: none;
    color: #0056b3;
    font-weight: bold;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
}

nav a:hover,
nav a.active {
    color: #34A853;
}

nav a::after {
    content: '\25BC'; /* Unicode for a small downward triangle */
    font-size: 0.6em;
    margin-left: 5px;
    transition: transform 0.3s ease;
}

nav a:hover::after {
    transform: rotate(180deg); /* Optional: rotate arrow on hover */
}

.logo-small {
    margin-right: 15px;
    vertical-align: middle;
}

.title-small {
    font-size: 1.8rem;
    color: #0056b3;
    margin: 0;
}

/* Formulaire de Contact */
form {
    margin-top: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.code-block {
    background-color: #282c34; /* Dark background */
    border: 1px solid #61afef; /* Blue border */
    border-radius: 8px;
    padding: 20px;
    margin: 20px auto; /* Center the block */
    max-width: 800px; /* Limit width for better readability */
    text-align: left;
    overflow-x: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.code-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: #abb2bf; /* Light text color */
}

.code-block code {
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.95em;
    line-height: 1.5;
}

/* Basic syntax highlighting (manual application needed in HTML) */
.code-block .comment {
    color: #888; /* Brighter grey for comments */
    font-weight: bold;
}

.code-block .keyword {
    color: #c678dd;
}

.code-block .string {
    color: #98c379;
}

.code-block .number {
    color: #d19a66;
}

.code-block .function {
    color: #61afef;
}

.code-block .tag {
    color: #e06c75;
}

.code-block .attribute {
    color: #e5c07b;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

button[type="submit"] {
    background-color: #0056b3;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s;
}

button[type="submit"]:hover {
    background-color: #0069d9;
}

.scroll-down-button {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background-color: #0056b3;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.scroll-up-button {
    position: absolute;
    top: 120px; /* Adjusted to be below the header */
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background-color: #0056b3;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease-in-out;
}

.scroll-down-button:hover {
    transform: translateX(-50%) scale(1.1);
}

.scroll-down-button.up {
    transform: translateX(-50%) rotate(180deg);
}

.scroll-down-button.up:hover {
    transform: translateX(-50%) rotate(180deg) scale(1.1);
}

.scroll-down-button svg,
.scroll-up-button svg {
    transition: transform 0.3s ease-in-out;
    animation: bounce 2s infinite; /* Applique l'animation par défaut */
}



@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(8px);
    }
    60% {
        transform: translateY(4px);
    }
}

.hamburger-menu {
    display: none; /* Hidden by default */
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    margin-left: 20px;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #000;
    margin: 5px 0;
    transition: 0.4s;
}

body.dark-mode .hamburger-menu span {
    background-color: #f5f5f5;
}

@media (max-width: 768px) {
    .header-container {
        justify-content: space-between;
    }

    .main-nav {
        display: none; /* Hide the nav on mobile */
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }

    body.dark-mode .main-nav {
        background-color: #282c34;
    }

    body.dark-mode .main-nav a {
        color: #f5f5f5;
    }

    .main-nav.active {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        align-items: center;
    }

    .main-nav li {
        margin: 15px 0;
    }

    .hamburger-menu {
        display: block; /* Show the hamburger on mobile */
    }

    html {
        scroll-snap-type: none;
    }

    section {
        height: auto;
        padding: 70px 20px;
    }
    
    #hero {
        height: 100vh;
        padding-top: 70px;
    }

    .scroll-up-button,
    #features .scroll-down-button,
    #integration .scroll-down-button,
    #contact .scroll-down-button {
        display: none;
    }
    
    #hero .scroll-down-button {
        display: flex;
        width: 50px;
        height: 50px;
        bottom: 80px; /* Raised the button to be more visible */
    }

    .hero-content h1 {
        font-size: 4rem;
    }   
    .hero-content p {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 2.5rem;
        margin-bottom: 40px;
        margin-top: -50px; /* Déplace le titre de 50px vers le haut sur mobile */
    }

    .features-grid {
        grid-template-columns: 1fr;
        padding-top: 40px;
    }

    #main-header {
        height: 70px;
    }

    .title-small {
        font-size: 1.5rem;
    }

    #features {
        padding-top: 90px; /* Ajuste le padding pour le header fixe sur mobile */
    }
}