body, html {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
}

/* On ne met le padding-left que sur desktop */
@media (min-width: 769px) {
    body { padding-left: 19%; }
}

.rm-container {
    grid-template-columns: 1fr;
}

/* Conteneur principal de la page */
.rm-container {
    display: flex;
    height: 100vh;
}

/* Barre latérale */
.rm-sidebar {
    width: 250px;
    background-color: #002554;
    color: white;
    padding: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
}

.rm-sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rm-sidebar-logo {
    width: 100%;
    max-width: 200px;
    margin-bottom: 20px;
}

.rm-ports-dropdown {
    padding: 10px;
    margin-bottom: 20px;
    border: none;
    border-radius: 4px;
    background-color: #34495e;
    color: white;
    font-size: 14px;
}

.rm-sidebar-button {
    padding: 10px;
    border: none;
    border-radius: 4px;
    background-color: #5bc5ed;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 14px;
}

.rm-sidebar-button:hover {
    background-color: #0e8bdf;
}

/* Conteneur principal des résultats */
.result-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Conteneur principal des informations du port */
.port-info {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 25px;
}

/* En-tête avec le nom du port et le logo SHOM */
.port-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.port-name {
    font-size: 26px;
    font-weight: 600;
    color: #2c3e50;
}

.shom-logo {
    height: 55px;
    border-radius: 8px;
}

/* Conteneur pour les informations de marée (hauteur et dernière mesure) */
.tide-info-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.tide-info {
    flex: 1;
}

/* Hauteur de la marée */
.tide-height {
    padding: 12px 16px;
    background-color: #eaf2f8;
    border-radius: 8px;
    border-left: 4px solid #5bc5ed;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.tide-height-icon {
    margin-right: 12px;
    color: #5bc5ed;
    font-size: 20px;
}

.tide-height-value {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

/* Dernière mesure */
.last-date {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #5bc5ed;
}

/* Conteneur principal pour le tableau et la courbe */
.main-content {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

/* Conteneur pour le tableau des marées (à gauche) */
.hlt-container {
    flex: 1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    background-color: white;
}

/* Style pour le tableau des marées */
.hlt table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    font-size: 14px;
}

.hlt th, .hlt td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.hlt th {
    background-color: #5bc5ed;
    color: white;
    font-weight: 500;
}

.hlt tr:nth-child(even) {
    background-color: #f8f9fa;
}

.hlt tr:hover {
    background-color: #e9f7fe;
}

/* Conteneur pour la courbe des marées (en grand) */
.tide-chart {
    flex: 2;
    height: 230px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden; /* EMPÊCHE LE SCROLL MANUEL */
    border: 1px solid #eee;
}

/* Conteneur pour l'image de la courbe avec défilement horizontal */
.chart-image-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.tide-chart img {
    height: auto;
    width: 100%;
    position: absolute;
    left: 0;
    top: 0;
    display: block;
    transition: left 0.8s ease-out;
}

/* Style pour l'iframe */
.vignette {
    display: none;
}

.iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Style pour les messages d'erreur */
.error-message {
    color: #e74c3c;
    background-color: #fadbd8;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    .result-container {
        margin-left: 0;
    }

    .main-content {
        flex-direction: column;
    }

    .tide-chart {
        height: 300px;
    }

    .tide-info-container {
        flex-direction: column;
    }
}

/*  ! tooltips état du marai */

.tide-height-value {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted #666;
    display: inline-block;
}

.tide-height-value::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    white-space: normal;
    width: 250px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    line-height: 1.4;
}

.tide-height-value::before {
    content: "";
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
}

/* Affichage au survol */
.tide-height-value:hover::after, 
.tide-height-value:hover::before {
    opacity: 1;
    visibility: visible;
}

.niveaux {
    position: relative;
    height: 300px; 
    width: 50px;
    margin-right: 100px;
    margin-bottom: 20px; /* Espace pour le chiffre 0 */
}

.hauteur {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0b00e3;
background: linear-gradient(180deg, rgba(11, 0, 227, 1) 0%, rgba(255, 255, 255, 1) 100%);
    border: 2px solid #000;
    border-radius: 10px;
    box-sizing: border-box;
}

/* Les lignes de graduation */
.graduation {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.4);
    z-index: 5;
}

.precise {
    height: 10%;
    width: 100%;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
    position: relative;
    box-sizing: border-box;
}

.precise::after {
    content: attr(data-label);
    position: absolute;
    right: 125%;
    bottom: -8px;
    font-size: 13px;
    font-weight: bold;
    color: #333;
}

.bateau-wrapper {
    position: absolute;
    left: 0;
    width: 100%;
    height: 0;
    transition: bottom 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
}

.bateau-wrapper::before {
    content: "";
    position: absolute;
    left: 0;
    width: 60px;
    height: 3px;
    background-color: var(--boat-before-color, #006fe2);
    top: -1.5px;
    transform: translateY(-100%);
}

.bateau {
    position: absolute;
    left: 65px;
    top: -25px;
    font-size: 2.5rem;
    color: #006fe2;
}

.bateau {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.tide-arrow i {
    font-size: 0.6em;
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.2));
}

.graduation {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.3);
}

.graduation::after {
    content: attr(data-label);
    position: absolute;
    right: 125%;
    top: -7px; /* Centre le texte sur le trait */
    font-size: 13px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.tableau-complet {
    padding-left: 1%;
    padding-bottom: 1%;
    padding-right: 1%;
    padding-top: 1%;
    color: #0051a8;
    display: flex;
    flex-direction: column;
    text-align: center !important;
    justify-content: center !important;
}

.tableau-complet h1 {
    font-size: 130%;
    margin: 0;
}

.top-layout {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 30px;
}

.left-stats {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.jauge-et-texte {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
    padding-left: 5%;
    margin-right: 30%;
}

.tide-data-cards {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.tableau-complet {
    position: absolute;
    width: 320px;
    height: 310px;
    flex-shrink: 0;
    bottom: 0;
    right: 0;
    border-radius: 10px;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    -ms-border-radius: 10px;
    -o-border-radius: 10px;
}

.bottom-layout {
    width: 100%;
}

.tide-chart {
    width: 100%;
    flex: none;
}

.hlt-container {
    display: flex !important;
    justify-content: center !important;
    text-align: center ! important;
}

@media (max-width: 900px) {
    .top-layout {
        flex-direction: column;
    }
    .tableau-complet {
        width: 100%;
        position: relative;
    }
}

@media (max-width: 768px) {
    .rm-container {
        flex-direction: column;
        height: auto;
    }

    .rm-sidebar {
        width: 100%;
        height: auto;
        max-height: 80vh;
        position: fixed;
        left: 0;
        top: 3%;
        z-index: 1000;
        padding: 10px 10px;
        padding-bottom: 50px;
        transform: translateY(-92%);
        transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        border-radius: 13px;
        -webkit-border-radius: 13px;
        -moz-border-radius: 13px;
        -ms-border-radius: 13px;
        -o-border-radius: 13px;
}

    .rm-sidebar:hover {
        transform: translateY(0);
        -webkit-transform: translateY(0);
        -moz-transform: translateY(0);
        -ms-transform: translateY(0);
        -o-transform: translateY(0);
}

    .rm-sidebar::after {
        content: "▼ MENU";
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        font-size: 20px;
        font-weight: bold;
        color: #5bc5ed;
        z-index: 9999;
    }

    .rm-sidebar-content {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .rm-sidebar-button {
        height: 2%;
        margin-top: 20%;
    }

    .rm-sidebar-logo {
        max-width: 120px;
        height: auto;
        margin-bottom: 5px;
    }

    .port-name {
        font-size: 70%;
    }

    .tide-height-value .last-date {
        font-size: 50%;
    }

    .result-container {
        padding-top: 60px;
    }

    .top-layout, .jauge-et-texte, .main-content {
        flex-direction: column;
        align-items: center;
        margin-right: 0 !important;
        padding-left: 0 !important;
    }

    .tableau-complet {
        position: relative;
        width: 100%;
        height: auto;
        margin-top: 20px;
    }

    .niveaux {
        margin-right: 0;
    }

    .chart-image-container {
        position: relative;
        overflow-y: scroll;
    }

    .chart-image-container img {
        height: 100%;
        width: auto;
        position: absolute;
    }
}

.last-date span {
    font-size: 50px;
}

.last-date .deusième {
    font-size: 30px;
}

