/* ==========================================================================
   Variables — Palette vert sauge (cohérence alisonetfab)
   ========================================================================== */
:root {
    --primary: #8FBC8F;
    --primary-dark: #2E7D32;
    --primary-light: #a8d5a2;
    --bg: #1a1a17;
    --bg-card: #232320;
    --bg-input: #2c2c24;
    --text: #F5F0E8;
    --text-muted: #a09882;
    --border: rgba(245, 240, 232, 0.12);
    --danger: #e74c3c;
    --danger-dark: #c0392b;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    --transition: 0.2s ease;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-light); }

/* ==========================================================================
   Header
   ========================================================================== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(26, 26, 23, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}
.app-header .header-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text) !important;
}
.logo i { color: var(--primary); font-size: 1.3rem; }

.main-content { max-width: 960px; margin: 0 auto; padding: 1rem; }
.main-content.no-header { padding-top: 0; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-card);
    color: var(--text);
    min-height: 44px;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: #1a1a17; border-color: var(--primary-dark); font-weight: 600; }
.btn-primary:hover { background: var(--primary-dark); color: var(--text); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger-dark); }
.btn-danger:hover { background: var(--danger-dark); }
.btn-secondary { background: var(--bg-input); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-card); }
.btn-sm { padding: 0.35rem 0.6rem; font-size: 0.8rem; min-height: 36px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { padding: 0.3rem; min-height: 36px; min-width: 36px; justify-content: center; }
.btn-group { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.hide-mobile { display: none; }
@media (min-width: 640px) { .hide-mobile { display: inline; } }

/* ==========================================================================
   Forms
   ========================================================================== */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.form-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color var(--transition);
    min-height: 44px;
}
.form-input:focus { outline: none; border-color: var(--primary); }
.form-input-sm { padding: 0.35rem 0.5rem; font-size: 0.85rem; min-height: 36px; }
textarea.form-input { min-height: 80px; resize: vertical; }
select.form-input { appearance: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
.inline-edit {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text);
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    padding: 0.2rem 0;
    width: 100%;
    transition: border-color var(--transition);
}
.inline-edit:focus { outline: none; border-bottom-color: var(--primary); }

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
}
.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.card h2 i { color: var(--primary); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.card-header h2 { margin-bottom: 0; }

/* ==========================================================================
   Page layout
   ========================================================================== */
.page-container { padding-bottom: 2rem; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 600; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.breadcrumb { margin-bottom: 0.5rem; }
.breadcrumb a { font-size: 0.9rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.breadcrumb a:hover { color: var(--primary); }

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-draft { background: var(--bg-input); color: var(--text-muted); }
.badge-exported { background: var(--primary-dark); color: var(--text); }
.badge-modified { background: #f39c12; color: #1a1a17; }

/* ==========================================================================
   Voyages grid
   ========================================================================== */
.voyages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.voyage-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.voyage-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.voyage-card:active { transform: scale(0.98); }
.voyage-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.voyage-meta { display: flex; gap: 0.75rem; align-items: center; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.voyage-date { font-size: 0.8rem; color: var(--text-muted); }
.voyage-card-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }

/* ==========================================================================
   Days list
   ========================================================================== */
.days-list, .pages-list { display: flex; flex-direction: column; gap: 0.5rem; }
.day-item, .page-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.day-item:hover, .page-item:hover { border-color: var(--primary); }
.day-item:active, .page-item:active { background: var(--bg-card); }
.day-info, .page-info { flex: 1; min-width: 0; }
.day-num { font-weight: 600; color: var(--primary); margin-right: 0.5rem; }
.day-title { font-weight: 500; }
.day-pages, .page-type-label { font-size: 0.8rem; color: var(--text-muted); margin-left: 0.5rem; }
.day-actions, .page-actions { display: flex; gap: 0.25rem; flex-shrink: 0; }

.page-type-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-card); display: flex; align-items: center; justify-content: center; color: var(--primary); flex-shrink: 0; }
.page-title { font-weight: 500; }
.page-type-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 20px; font-size: 0.75rem; background: var(--primary); color: #1a1a17; font-weight: 600; text-transform: uppercase; }

/* ==========================================================================
   Markers
   ========================================================================== */
.markers-list { display: flex; flex-direction: column; gap: 0.5rem; }
.marker-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem; background: var(--bg-input); border-radius: var(--radius-sm); }
.marker-icon { color: var(--primary); }
.marker-coords { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* ==========================================================================
   States
   ========================================================================== */
.loading-state { display: flex; justify-content: center; align-items: center; padding: 4rem 0; color: var(--primary); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3rem 1rem; color: var(--text-muted); text-align: center; }
.empty-state i { color: var(--primary); opacity: 0.5; }
.empty-state-sm { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.9rem; }

/* ==========================================================================
   Modal
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow);
}
.modal-card h2 { font-size: 1.2rem; margin-bottom: 1rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }

/* ==========================================================================
   Login
   ========================================================================== */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 400px; box-shadow: var(--shadow); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 0.75rem; display: block; }
.login-header h1 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.login-header p { color: var(--text-muted); font-size: 0.9rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 0.75rem; text-align: center; }

/* ==========================================================================
   Image uploader
   ========================================================================== */
.image-uploader { position: relative; }
.upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
}
.upload-zone:hover { border-color: var(--primary); color: var(--primary); }
.upload-zone small { font-size: 0.75rem; }
.image-preview { position: relative; border-radius: var(--radius-sm); overflow: hidden; }
.image-preview img { width: 100%; max-height: 300px; object-fit: cover; }
.overlay-btn { position: absolute; bottom: 0.5rem; right: 0.5rem; background: rgba(0,0,0,0.7) !important; }
.upload-progress { display: flex; flex-direction: column; align-items: center; padding: 2rem; color: var(--primary); gap: 0.5rem; }

/* ==========================================================================
   Audio manager
   ========================================================================== */
.audio-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.75rem; }
.audio-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; background: var(--bg-input); border-radius: var(--radius-sm); }
.audio-name { flex: 1; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.audio-actions { display: flex; gap: 0.2rem; }
.audio-upload { margin-top: 0.5rem; }

/* ==========================================================================
   Rich text editor
   ========================================================================== */
.rich-text-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.rte-toolbar {
    display: flex;
    gap: 0.2rem;
    padding: 0.4rem;
    background: var(--bg-input);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.rte-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    transition: background var(--transition);
}
.rte-btn:hover { background: var(--bg-card); }
.rte-separator { width: 1px; background: var(--border); margin: 0 0.2rem; }
.rte-content {
    padding: 0.75rem;
    min-height: 120px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
}
.rte-content h2 { font-size: 1.2rem; margin-bottom: 0.5rem; }
.rte-content h3 { font-size: 1.05rem; margin-bottom: 0.4rem; }
.rte-content p { margin-bottom: 0.5rem; }
.rte-content a { color: var(--primary); }

/* ==========================================================================
   RTE link bar
   ========================================================================== */
.rte-link-bar {
    display: flex;
    gap: 0.3rem;
    padding: 0.4rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    animation: slideDown 0.12s ease-out;
}
.rte-link-input {
    flex: 1;
    padding: 0.3rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    font-family: inherit;
    min-height: 36px;
}
.rte-link-input:focus { outline: none; border-color: var(--primary); }
.rte-btn-active { background: var(--primary) !important; color: #1a1a17 !important; }

/* ==========================================================================
   Map label form (inside Google Maps InfoWindow)
   ========================================================================== */
.map-label-form { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.map-label-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
}
.map-label-input:focus { border-color: #8FBC8F; }
.map-label-actions { display: flex; justify-content: flex-end; gap: 4px; }
.map-label-btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}
.map-label-btn-ok { background: #8FBC8F; color: #1a1a17; }
.map-label-btn-ok:hover { background: #2E7D32; color: white; }
.map-label-btn-danger { background: #e74c3c; color: white; }
.map-label-btn-danger:hover { background: #c0392b; }

/* ==========================================================================
   Map widget
   ========================================================================== */
.map-widget { position: relative; }
.map-container-widget { width: 100%; height: 450px; border-radius: var(--radius-sm); overflow: hidden; }
.card-fullscreen .map-widget { flex: 1; min-height: 0; }
.card-fullscreen .map-container-widget { height: 100%; }
@media (max-width: 640px) { .map-container-widget { height: 55vh; } }
.map-geolocate-btn {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 2px;
    background: white;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    cursor: pointer;
    color: #666;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.map-geolocate-btn:hover { color: #333; }
.map-mode-indicator {
    background: var(--primary-dark);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    text-align: center;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    justify-content: center;
}

/* ==========================================================================
   Toolbar
   ========================================================================== */
.toolbar { display: flex; gap: 0.4rem; padding: 0.5rem 0; margin-bottom: 0.5rem; flex-wrap: wrap; align-items: center; }
.toolbar-spacer { flex: 1; }
.map-toolbar .btn-sm, .map-toolbar .btn-icon { min-height: 44px; min-width: 44px; padding: 0.5rem 0.8rem; }
.card-fullscreen { position: fixed; inset: 0; z-index: 500; border-radius: 0; margin: 0; overflow: hidden; display: flex; flex-direction: column; }
.card-fullscreen .toolbar { position: relative; z-index: 501; }
.card-fullscreen .map-mode-indicator { position: relative; z-index: 501; }

/* ==========================================================================
   Video preview
   ========================================================================== */
.video-preview { margin-top: 1rem; aspect-ratio: 16/9; border-radius: var(--radius-sm); overflow: hidden; }
.video-preview iframe { width: 100%; height: 100%; border: none; }

/* ==========================================================================
   Actions bar
   ========================================================================== */
.actions-bar { display: flex; align-items: center; gap: 1rem; }

/* ==========================================================================
   Inline add form
   ========================================================================== */
.inline-add-form {
    background: var(--bg-input);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    animation: slideDown 0.15s ease-out;
}
.inline-add-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
}
.inline-add-body { display: flex; flex-direction: column; gap: 0.5rem; }
.inline-add-actions { display: flex; justify-content: flex-end; gap: 0.4rem; }
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Utilities
   ========================================================================== */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-md { margin-top: 1rem; }

/* ==========================================================================
   Toast / Snackbar
   ========================================================================== */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 360px;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    animation: toastSlideUp 0.2s ease-out;
}
.toast-success { border-left: 3px solid var(--primary); }
.toast-success i { color: var(--primary); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-error i { color: var(--danger); }
.toast-info { border-left: 3px solid var(--text-muted); }
.toast-info i { color: var(--text-muted); }
@keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Save indicator
   ========================================================================== */
.save-indicator {
    position: fixed;
    top: 4rem;
    right: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    z-index: 50;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 640px) {
    .main-content { padding: 0.5rem; }
    .card { padding: 1rem; }
    .page-header h1 { font-size: 1.2rem; }
    .page-header { display: flex; flex-direction: column; gap: 0.75rem; }
    .header-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .voyages-grid { grid-template-columns: 1fr; }
}

