/* ═══════════════════════════════════════════════════════════
   Port Trafic — Transat  |  style.css
   Charte graphique Global System / Port Trafic
   Palette : dark tech navy, blue #0066CC, cyan #00C2FF
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --bg:       #080c18;
    --bg-card:  #0d1526;
    --bg-card2: #101d34;
    --border:   #1a2840;
    --blue:     #0066CC;
    --blue-lt:  #1a7fe0;
    --cyan:     #00C2FF;
    --text:     #e8eff5;
    --muted:    #8a9bb0;
    --green:    #22c55e;
    --gold:     #f59e0b;
    --red:      #ef4444;
    --radius:   12px;
    --shadow:   0 8px 32px rgba(0, 0, 0, 0.55);
    --font:     'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.65;
    min-height: 100vh;
    padding-bottom: 76px;
}

/* Grille de fond façon Port Trafic */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 102, 204, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 102, 204, .04) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
    z-index: 0;
}

/* Lueur bleue en haut à droite */
body::after {
    content: '';
    position: fixed;
    top: -120px;
    right: -120px;
    width: 480px;
    height: 480px;
    background: radial-gradient(circle, rgba(0, 102, 204, .18) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container { position: relative; z-index: 1; }
.site-header { position: relative; z-index: 200; }
.bottom-nav  { position: relative; z-index: 200; }

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }
::selection { background: rgba(0, 102, 204, .25); }

/* ── Header ────────────────────────────────────────────── */
.site-header {
    background: rgba(8, 12, 24, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
    position: sticky;
    top: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.header-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--blue);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.header-logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.header-logo-text strong {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 0.3px;
}

.header-logo-text span {
    font-size: 0.65rem;
    color: var(--cyan);
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.site-header nav a,
.back-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 600;
    margin-left: 16px;
    transition: color 0.2s;
    letter-spacing: 0.2px;
}

.site-header nav a:hover,
.back-link:hover { color: var(--cyan); }

/* ── Container ─────────────────────────────────────────── */
.container {
    max-width: 920px;
    margin: 0 auto;
    padding: 20px 14px;
}

/* ── Card ──────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* Trait cyan en haut */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue) 0%, var(--cyan) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::before { opacity: 1; }

.card h2 {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--cyan);
    margin-bottom: 16px;
}

/* ── Bateau Hero ───────────────────────────────────────── */
.boat-card { padding: 20px 20px 0; }

.boat-hero {
    position: relative;
    height: 220px;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    margin: 0 -20px;
    margin-bottom: 14px;
}

@media (min-width: 600px) {
    .boat-hero { height: 300px; }
}

.boat-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.boat-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px 16px;
    background: linear-gradient(transparent, rgba(5, 10, 20, 0.85));
}

.boat-name {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.boat-route {
    font-size: 0.78rem;
    color: var(--cyan);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.boat-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 4px;
}

.stat {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 6px;
    text-align: center;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.62rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-top: 2px;
}

.no-data {
    font-size: 0.85rem;
    color: var(--muted);
    font-style: italic;
    padding: 4px 0;
}

/* ── Réglette de progression ───────────────────────────── */
.progress-wrapper { padding: 4px 0 2px; }

.progress-track {
    height: 12px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 6px;
    position: relative;
    margin: 22px 0 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue) 0%, var(--cyan) 100%);
    border-radius: 6px;
    transition: width 0.7s ease;
    min-width: 4px;
    box-shadow: 0 0 12px rgba(0, 194, 255, 0.4);
}

.progress-boat {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
    z-index: 2;
    animation: bobbing 3.5s ease-in-out infinite;
}

@keyframes bobbing {
    0%, 100% { transform: translate(-50%, -50%) rotate(-4deg); }
    50%       { transform: translate(-50%, -62%) rotate(4deg); }
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
}

.progress-labels span:last-child { text-align: right; }

.progress-pct {
    text-align: center;
    font-size: 0.82rem;
    margin-top: 10px;
    color: var(--cyan);
    font-weight: 700;
    letter-spacing: 0.3px;
}

/* ── Carte Leaflet ─────────────────────────────────────── */
.map-card { padding: 20px 20px 0; }

#map {
    height: 340px;
    border-radius: 0 0 10px 10px;
    margin: 0 -20px;
    border-top: 1px solid var(--border);
}

@media (min-width: 600px) { #map { height: 460px; } }

.boat-icon-marker {
    font-size: 1.9rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.8));
    animation: bobbing 3.5s ease-in-out infinite;
}

/* ── Tableau Historique ────────────────────────────────── */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    min-width: 520px;
}

thead th {
    padding: 9px 12px;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cyan);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid rgba(26, 40, 64, 0.8);
    transition: background 0.15s;
}

tbody tr:hover { background: var(--bg-card2); }

/* Dernière position (première ligne du tableau inversé) */
tbody tr:first-child { background: rgba(0, 102, 204, 0.08); }
tbody tr:first-child td { color: var(--gold); }

td {
    padding: 9px 12px;
    white-space: nowrap;
    color: var(--text);
}

.empty-table {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    font-style: italic;
    font-size: 0.88rem;
}

/* ── Galerie Photos ────────────────────────────────────── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.photo-thumb {
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}

.photo-thumb:hover {
    transform: scale(1.05);
    border-color: var(--cyan);
    box-shadow: 0 0 12px rgba(0, 194, 255, 0.3);
}

.empty-photos {
    text-align: center;
    padding: 36px 16px;
    color: var(--muted);
    font-style: italic;
    font-size: 0.88rem;
    line-height: 2;
}

/* ── Lightbox ──────────────────────────────────────────── */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.lightbox.active { display: flex; }

.lightbox img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.9);
    border: 1px solid var(--border);
}

.lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--muted);
    background: none;
    border: none;
    line-height: 1;
    transition: color 0.2s;
}

.lightbox-close:hover { color: var(--text); }

/* ── Navigation Bottom ─────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 12, 24, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 200;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.64rem;
    letter-spacing: 0.3px;
    font-weight: 600;
    transition: color 0.2s;
    gap: 3px;
}

.bottom-nav a.active,
.bottom-nav a:hover { color: var(--cyan); }

.nav-icon { font-size: 1.2rem; line-height: 1; }

/* ── Pages Upload ──────────────────────────────────────── */
.upload-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--cyan);
}

.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="text"] {
    padding: 13px 16px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group input[type="number"]:focus,
.form-group input[type="password"]:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.form-group input[type="file"] {
    padding: 12px 14px;
    background: var(--bg-card2);
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.field-hint {
    font-size: 0.70rem;
    color: var(--muted);
    padding-left: 2px;
}

.photo-preview {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    display: none;
}

.photo-preview img {
    width: 100%;
    max-height: 240px;
    object-fit: cover;
    display: block;
}

.btn {
    padding: 14px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font);
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.btn:hover  {
    background: var(--blue-lt);
    box-shadow: 0 0 16px rgba(0, 102, 204, 0.4);
    transform: translateY(-1px);
}
.btn:active { transform: scale(0.98); }

.btn-success       { background: #16a34a; }
.btn-success:hover {
    background: #15803d;
    box-shadow: 0 0 16px rgba(22, 163, 74, 0.4);
}

.alert {
    padding: 13px 16px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 16px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* ── Label section ─────────────────────────────────────── */
.section-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    color: var(--cyan);
    margin-bottom: 8px;
}

/* ── Responsive Desktop ────────────────────────────────── */
@media (min-width: 700px) {
    .boat-photo { width: 140px; height: 100px; }
    .boat-name  { font-size: 2.3rem; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
}
