:root {
    --mct-blue: #1E40AF;
    --mct-blue-dark: #172554;
    --mct-orange: #FF5A1F;
    --mct-orange-dark: #E64A12;
    --mct-cyan: #06B6D4;
    --mct-white: #FFFFFF;
    --mct-gray-50: #F5F5F5;
    --mct-text: #0F172A;
    --mct-text-muted: #64748B;
    --mct-focus-ring: rgba(6, 182, 212, 0.25);
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    font-family: "Inter", "Segoe UI", "Nunito", Arial, sans-serif;
    color: var(--mct-text);
    background: var(--mct-gray-50);
}

html {
    height: 100%;
    overflow-y: auto;
}

.builder-page {
    height: auto;
    min-height: 100%;
    overflow: visible;
    background: var(--mct-gray-50);
}

.trip-hero {
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.14) 0%, #F5F5F5 100%);
    border-bottom: 1px solid rgba(30, 64, 175, 0.18);
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
}

a {
    color: var(--mct-blue);
}

a:hover {
    color: var(--mct-orange);
}

.btn-primary,
.btn.btn-primary {
    --bs-btn-bg: var(--mct-orange);
    --bs-btn-border-color: var(--mct-orange);
    --bs-btn-color: var(--mct-white);
    --bs-btn-hover-bg: var(--mct-orange-dark);
    --bs-btn-hover-border-color: var(--mct-orange-dark);
    --bs-btn-active-bg: var(--mct-orange-dark);
    --bs-btn-active-border-color: var(--mct-orange-dark);
    --bs-btn-focus-shadow-rgb: 6, 182, 212;
}

.btn-outline-primary,
.btn.btn-outline-primary {
    --bs-btn-color: var(--mct-blue);
    --bs-btn-border-color: var(--mct-blue);
    --bs-btn-hover-bg: var(--mct-blue);
    --bs-btn-hover-border-color: var(--mct-blue);
    --bs-btn-hover-color: var(--mct-white);
    --bs-btn-active-bg: var(--mct-blue-dark);
    --bs-btn-active-border-color: var(--mct-blue-dark);
    --bs-btn-focus-shadow-rgb: 6, 182, 212;
}

.badge.bg-primary,
.text-bg-primary {
    background-color: var(--mct-blue) !important;
    color: var(--mct-white) !important;
}

.badge.bg-info,
.text-bg-info {
    background-color: var(--mct-cyan) !important;
    color: var(--mct-white) !important;
}

.form-control:focus,
.form-select:focus,
textarea.form-control:focus {
    border-color: var(--mct-cyan);
    box-shadow: 0 0 0 0.2rem var(--mct-focus-ring);
}

:focus-visible {
    outline: 2px solid var(--mct-cyan);
    outline-offset: 2px;
}

.navbar-brand {
    color: var(--mct-text) !important;
}

.navbar .nav-link {
    color: var(--mct-blue);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus-visible {
    color: var(--mct-orange);
}

.btn-secondary,
.btn.btn-secondary {
    --bs-btn-bg: var(--mct-blue);
    --bs-btn-border-color: var(--mct-blue);
    --bs-btn-color: var(--mct-white);
    --bs-btn-hover-bg: var(--mct-blue-dark);
    --bs-btn-hover-border-color: var(--mct-blue-dark);
    --bs-btn-active-bg: var(--mct-blue-dark);
    --bs-btn-active-border-color: var(--mct-blue-dark);
}

.brand-logo-horizontal {
    height: 32px;
    width: auto;
    display: block;
}

.brand-wordmark {
    font-weight: 800;
    letter-spacing: 0.2px;
    line-height: 1;
}

.brand-mycity {
    color: var(--mct-blue);
}

.brand-trips {
    color: var(--mct-orange);
}

.brand-tld {
    color: var(--mct-text-muted);
}

.auth-page {
    background: linear-gradient(160deg, var(--mct-blue-dark) 0%, var(--mct-blue) 100%);
}

.auth-card {
    background: var(--mct-white);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.24);
}

.auth-link {
    color: var(--mct-blue);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    color: var(--mct-orange);
}

.auth-brand-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    object-fit: cover;
}

.navbar-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(30, 64, 175, 0.25);
    display: block;
}

.trip-header-compact {
    background: var(--mct-white);
    border: 1px solid rgba(30, 64, 175, 0.15);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.trip-days-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.trip-day-tab {
    border: 1px solid rgba(30, 64, 175, 0.35);
    background: var(--mct-white);
    color: var(--mct-blue);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
}

.trip-day-tab.is-active {
    background: var(--mct-blue);
    color: var(--mct-white);
}

.day-panel.is-hidden {
    display: none;
}

.activity-title {
    color: var(--mct-orange);
}

.activity-item-main {
    min-width: 0;
    flex: 1 1 auto;
}

.reorder-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    user-select: none;
    -webkit-user-select: none;
}

.reorder-day-panel.is-hidden {
    display: none;
}

.reorder-activity-item {
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    width: 100%;
    max-width: 100%;
}

.reorder-activity-main {
    min-width: 0;
    flex: 1 1 auto;
}

.reorder-activity-item.dragging {
    opacity: 0.55;
}

.reorder-activity-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.reorder-drag-handle {
    color: var(--mct-text-muted);
    cursor: grab;
    line-height: 1;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.reorder-transfer-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.reorder-day-tabs-wrap {
    margin-left: 1rem;
    margin-right: 1rem;
}

@media (max-width: 767.98px) {
    .site-footer .footer-brand-content {
        display: none;
    }

    .site-footer .footer-copyright {
        text-align: center;
    }

    .builder-page main {
        padding-bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1030;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
        background: var(--mct-white);
        border-top: 1px solid rgba(30, 64, 175, 0.2);
        box-shadow: 0 -4px 14px rgba(15, 23, 42, 0.12);
        padding: 0.45rem 0.25rem calc(0.45rem + env(safe-area-inset-bottom));
    }

    .mobile-bottom-nav__item {
        color: var(--mct-text-muted);
        text-decoration: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        font-size: 0.72rem;
        font-weight: 600;
        min-height: 46px;
    }

    .mobile-bottom-nav__item i {
        font-size: 1.05rem;
        line-height: 1;
    }

    .mobile-bottom-nav__item.is-active {
        color: var(--mct-blue);
    }

    .mobile-bottom-nav__item.is-disabled {
        color: #b3bcc8;
        pointer-events: none;
    }
}

@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none;
    }
}

.activity-item-actions {
    flex: 0 0 auto;
}

@media (max-width: 640px) {
    .activity-item-row {
        flex-direction: column;
        align-items: stretch !important;
    }

    .activity-item-actions {
        justify-content: flex-end;
        width: 100%;
    }
}

.image-grid,
.activity-thumbnails,
.trip-gallery,
.activity-gallery {
    display: grid;
    gap: 10px;
}

.image-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.image-tile,
.activity-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    background: #e9ecef;
}

.image-tile img {
    display: block;
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.image-tile form,
.activity-thumbnail .activity-thumbnail-delete-form {
    position: absolute;
    top: 6px;
    right: 6px;
}

.activity-thumbnails {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    max-width: 420px;
}

.activity-thumbnail img {
    display: block;
    width: 100%;
    height: 80px;
    object-fit: cover;
}

.activity-thumbnail-upload-form {
    margin: 0;
}

.activity-thumbnail-upload {
    width: 100%;
    height: 80px;
    border: 1px dashed rgba(30, 64, 175, 0.45);
    border-radius: 8px;
    background: #f8fafc;
    color: var(--mct-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
}

.activity-thumbnail-upload:hover {
    border-color: var(--mct-blue);
    background: #eef2ff;
}

.activity-thumbnail-upload i {
    font-size: 1.1rem;
}

.activity-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.trip-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 190px;
}

.trip-gallery img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

.trip-gallery-main {
    grid-column: span 2;
    grid-row: span 2;
}

.trip-card-cover {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.activity-gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.activity-gallery img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 8px;
}

.day-map-canvas {
    height: 260px;
    border: 1px solid rgba(30, 64, 175, 0.2);
    border-radius: 10px;
    overflow: hidden;
}

@media (max-width: 640px) {
    .trip-gallery {
        grid-template-columns: 1fr;
        grid-auto-rows: 180px;
    }

    .trip-gallery-main {
        grid-column: auto;
        grid-row: auto;
    }
}

#album-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
}

.actions-fab {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 50;
    border: 0;
    border-radius: 999px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: var(--mct-orange);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.actions-fab:hover {
    background: var(--mct-orange-dark);
}

.dots-icon {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 -8px 0 #fff, 0 8px 0 #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.actions-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(3, 8, 20, 0.6);
    padding: 16px;
}

.actions-modal.is-open {
    display: flex;
}

.actions-modal-panel {
    width: min(560px, 100%);
    max-height: 88vh;
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    padding: 20px;
    position: relative;
}

.actions-modal-panel h2 {
    margin: 0 0 14px;
    font-size: 1.25rem;
}

.actions-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border: 0;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    background: #e8ecf2;
    color: #223;
    font-weight: 700;
    cursor: pointer;
}

.actions-option {
    display: block;
    text-decoration: none;
    color: #1f2933;
    border: 1px solid #d8dee6;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    font-weight: 600;
}

.actions-option:hover {
    background: #f5f8fc;
}

.actions-option-primary {
    background: var(--mct-blue);
    border-color: var(--mct-blue);
    color: #fff;
}

.actions-option-primary:hover {
    background: var(--mct-orange);
    border-color: var(--mct-orange);
}

.actions-archives-title {
    margin: 14px 0 8px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #425466;
}

.actions-archives-empty {
    margin: 0;
    color: #6b7280;
}

@media (max-width: 640px) {
    .actions-fab {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 0.88rem;
    }

    .actions-modal-panel {
        padding: 16px;
    }
}

.slide {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(100%); 
}

.slide.active { transform: translateY(0); z-index: 10; }
.slide.prev { transform: translateY(-100%); z-index: 5; }

.photo-bg {
    flex: 1 1 auto;
    min-height: 0;
    background-size: cover;
    background-position: center;
}

/* BANDEAU BLANC */
.caption-bar {
    min-height: 110px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px calc(12px + env(safe-area-inset-bottom));
    z-index: 20;
    box-sizing: border-box;
}

.caption-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    flex: 1 1 auto;
}

.publisher-avatar {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    max-width: 38px;
    max-height: 38px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #eef1f4;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    line-height: 0;
}

.publisher-avatar-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
    display: block;
}

.publisher-avatar-fallback {
    font-size: 0.72rem;
    font-weight: 700;
    color: #5b6470;
}

.caption-content {
    min-width: 0;
}

.caption-content p {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
    color: #1f2933;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.caption-content .caption-empty {
    min-height: 1.35em;
}

.nav-controls button {
    padding: 10px 16px;
    margin-left: 8px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: rgba(255, 255, 255, 0.9);
    font-weight: bold;
    border-radius: 5px;
}

.nav-controls button:hover { background: #f0f0f0; }

@media (max-width: 992px) {
    .caption-bar {
        min-height: 120px;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
        gap: 10px;
    }

    .caption-content p {
        font-size: 1.1rem;
        -webkit-line-clamp: 3;
    }

    .publisher-avatar {
        width: 34px;
        height: 34px;
        min-width: 34px;
        min-height: 34px;
        max-width: 34px;
        max-height: 34px;
        flex-basis: 34px;
    }

    .nav-controls button {
        padding: 9px 12px;
        margin-left: 6px;
        font-size: 0.92rem;
    }
}

@media (max-width: 640px) {
    .caption-bar {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        min-height: 152px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    }

    .caption-left {
        align-items: center;
        gap: 10px;
    }

    .caption-content p {
        font-size: 1.02rem;
        -webkit-line-clamp: 3;
    }

    .nav-controls {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .nav-controls button {
        margin-left: 0;
        width: 100%;
    }
}

@supports (-webkit-touch-callout: none) {
    html, body {
        min-height: -webkit-fill-available;
    }

    #album-wrapper {
        min-height: -webkit-fill-available;
    }
}

/* Écran Login */
.login-screen { height: 100vh; background: var(--mct-blue); display: flex; justify-content: center; align-items: center; color: var(--mct-white); }
.login-box { background: var(--mct-blue-dark); padding: 30px; border-radius: 10px; text-align: center; }