:root {
    --gnome-bg: #f6f5f4;
    --gnome-card: #ffffff;
    --gnome-accent: #3584e4;
    --gnome-text: #2e3436;
    --gnome-secondary: #949d9f;
    --gnome-danger: #e01b24;
    --gnome-success: #2ec27e;
    --gnome-header: #ffffff;
    --gnome-radius-lg: 28px;
    --gnome-radius-md: 16px;
    --gnome-border: rgba(0, 0, 0, 0.06);
    --gnome-focus: rgba(53, 132, 228, 0.34);
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--gnome-bg);
    color: var(--gnome-text);
    line-height: 1.45;
}

/* Slightly softer GNOME-like ambient backdrop */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 10% 10%, rgba(53, 132, 228, 0.08), transparent 30%),
                radial-gradient(circle at 85% 20%, rgba(46, 194, 126, 0.06), transparent 26%);
    z-index: -1;
}

.navbar {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 10px 20px;
    border-radius: 999px;
    padding: 0.5rem 1rem !important;
    position: sticky;
    top: 15px;
    z-index: 1030;
}

@media (max-width: 991.98px) {
    .navbar {
        margin: 10px 10px;
        border-radius: 24px;
    }
    
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.95);
        margin-top: 10px;
        padding: 15px;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    }
}

.brand-icon-wrapper {
    transition: transform 0.3s ease;
}

.navbar-brand:hover .brand-icon-wrapper {
    transform: rotate(15deg) scale(1.1);
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover {
    transform: translateY(-1px);
}

.app-profile-trigger, .app-language-trigger {
    transition: all 0.2s ease;
}

.app-profile-trigger:hover, .app-language-trigger:hover {
    background: #fff !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08) !important;
    transform: translateY(-1px);
}

.object-fit-cover {
    object-fit: cover;
}

.navbar .container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
}

.navbar-brand {
    color: var(--gnome-text) !important;
    font-weight: 800;
    letter-spacing: -0.5px;
    border-radius: 14px;
    padding: 0.25rem 0.35rem;
}

.nav-link {
    color: var(--gnome-text) !important;
    font-weight: 600;
    opacity: 0.82;
    transition: all 0.18s ease;
    border-radius: 999px;
    padding: 0.45rem 0.92rem !important;
    border: 1px solid transparent;
    text-decoration: none !important;
}

.navbar-brand,
.navbar .dropdown-item {
    text-decoration: none !important;
}

.nav-link:hover {
    opacity: 1;
    background-color: rgba(53, 132, 228, 0.1);
    border-color: rgba(53, 132, 228, 0.18);
}

.nav-link.is-active {
    opacity: 1;
    color: #124487 !important;
    background: rgba(53, 132, 228, 0.14);
    border-color: rgba(53, 132, 228, 0.24);
}

/* Carousel Customization - Book Leafing Effect */
.carousel-adventure-container {
    perspective: 3000px;
    padding: 20px 0;
    min-height: 620px;
}

#adventureCarousel .carousel-inner,
#sharedAdventureCarousel .carousel-inner {
    overflow: visible;
    transform-style: preserve-3d;
    position: relative;
    height: 500px; /* Fixed height for the card area */
}

@media (max-width: 768px) {
    #adventureCarousel .carousel-inner,
    #sharedAdventureCarousel .carousel-inner {
        height: 700px; /* More height for stacked mobile layout */
    }
    
    .carousel-adventure-container {
        padding: 10px 0;
        min-height: 820px;
    }
}

#adventureCarousel .carousel-item,
#sharedAdventureCarousel .carousel-item {
    transition: transform 1.2s cubic-bezier(0.645, 0.045, 0.355, 1);
    backface-visibility: hidden;
    transform-style: preserve-3d;
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block !important;
    opacity: 0;
    visibility: hidden;
    z-index: 1;
}

#adventureCarousel .carousel-item.active,
#sharedAdventureCarousel .carousel-item.active {
    opacity: 1;
    visibility: visible;
    z-index: 10;
    transform: rotateY(0deg) translateZ(0.1px); /* Slight Z to avoid flicker */
}

/* Book flip transition logic */
#adventureCarousel .carousel-item-next.carousel-item-start,
#adventureCarousel .carousel-item-prev.carousel-item-end,
#sharedAdventureCarousel .carousel-item-next.carousel-item-start,
#sharedAdventureCarousel .carousel-item-prev.carousel-item-end {
    transform: rotateY(0deg) translateZ(0);
    opacity: 1;
    visibility: visible;
    z-index: 15;
}

/* Flip forward - leafing left */
#adventureCarousel .carousel-item.active.carousel-item-start,
#sharedAdventureCarousel .carousel-item.active.carousel-item-start {
    transform: rotateY(-180deg) translateZ(0);
    transform-origin: left center;
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

/* Flip backward - leafing right */
#adventureCarousel .carousel-item.active.carousel-item-end,
#sharedAdventureCarousel .carousel-item.active.carousel-item-end {
    transform: rotateY(180deg) translateZ(0);
    transform-origin: right center;
    opacity: 1;
    visibility: visible;
    z-index: 5;
}

#adventureCarousel .carousel-item-next,
#sharedAdventureCarousel .carousel-item-next {
    transform: rotateY(0deg);
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

#adventureCarousel .carousel-item-prev,
#sharedAdventureCarousel .carousel-item-prev {
    transform: rotateY(0deg);
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* Controls removed from here as they are moved to top in HTML */
#adventureCarousel .carousel-control-prev,
#adventureCarousel .carousel-control-next,
#adventureCarousel .carousel-indicators,
#sharedAdventureCarousel .carousel-control-prev,
#sharedAdventureCarousel .carousel-control-next,
#sharedAdventureCarousel .carousel-indicators {
    display: none !important;
}

.carousel-indicators-top .indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--gnome-accent);
    opacity: 0.3;
    border: none;
    padding: 0;
    transition: all 0.3s ease;
}

.carousel-indicators-top .indicator-dot.active {
    opacity: 1;
    width: 24px;
    border-radius: 4px;
}

.btn-white {
    background: white;
    color: var(--gnome-text);
    border: 1px solid rgba(0,0,0,0.05);
}

.btn-white:hover {
    background: #f8f9fa;
    transform: scale(1.05);
}

.carousel-item {
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
/* Replaced by book leafing effect above */

a {
    color: color-mix(in srgb, var(--gnome-accent) 88%, #124487 12%);
    text-decoration-thickness: 1.5px;
    text-underline-offset: 2px;
}

a:hover {
    color: #124487;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.dropdown-item:focus-visible,
.nav-link:focus-visible,
.navbar-toggler:focus-visible {
    outline: 3px solid var(--gnome-focus);
    outline-offset: 2px;
}

.map-container {
    height: 400px;
    width: 100%;
    margin-bottom: 30px;
    border-radius: 28px;
    z-index: 1;
    border: 1px solid rgba(0,0,0,0.05);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.hero-section {
    background: linear-gradient(rgba(0,0,0,0.3), rgba(0,0,0,0.3)), url('https://images.unsplash.com/photo-1469854523086-cc02fe5d8800?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80');
    background-size: cover;
    background-position: center;
    color: white;
    padding: 100px 0;
    margin-bottom: 40px;
    border-radius: 28px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.card {
    border: none;
    background: var(--gnome-card);
    border-radius: var(--gnome-radius-lg);
    box-shadow: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    border: 1px solid var(--gnome-border);
    overflow: hidden;
}

.card:active {
    transform: translateY(-1px) scale(0.998);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.08) !important;
}

.btn {
    border-radius: var(--gnome-radius-md);
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    transition: all 0.2s;
    border: none;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--gnome-accent);
    color: white;
    box-shadow: 0 4px 12px rgba(53, 132, 228, 0.2);
}

.btn-primary:hover {
    background-color: #2a76d0;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(53, 132, 228, 0.3);
}

.btn-success {
    background-color: var(--gnome-success);
    color: white;
    box-shadow: 0 4px 12px rgba(46, 194, 126, 0.2);
}

.btn-light {
    background-color: rgba(0,0,0,0.05);
    color: var(--gnome-text);
}

.btn-light:hover {
    background-color: rgba(0,0,0,0.08);
}

.btn-outline-primary {
    color: var(--gnome-accent);
    background-color: rgba(53, 132, 228, 0.1);
}

.badge {
    font-weight: 600;
    padding: 0.5em 1em;
    border-radius: 12px;
}

.progress {
    border-radius: 12px;
    background-color: rgba(0,0,0,0.05);
    height: 8px;
}

.form-control, .form-select {
    border-radius: var(--gnome-radius-md);
    border: 1px solid rgba(0,0,0,0.1);
    padding: 0.8rem 1.1rem;
    background-color: #ffffff;
    width: 100%;
    min-width: 0;
}

.form-control:focus {
    border-color: var(--gnome-accent);
    box-shadow: 0 0 0 4px rgba(53, 132, 228, 0.1);
}

/* Gnome-like UI elements */
.gnome-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.gnome-group {
    background: #ffffff;
    border-radius: calc(var(--gnome-radius-lg) - 4px);
    padding: 0.5rem;
    border: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(36, 31, 49, 0.06);
}

.gnome-row {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid rgba(0,0,0,0.03);
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    border-radius: var(--gnome-radius-md);
    gap: 0.5rem;
    min-width: 0;
}

.gnome-row:last-child {
    border-bottom: none;
}

.gnome-row:hover {
    background-color: rgba(0,0,0,0.02);
}

.gnome-row-title {
    font-weight: 600;
    flex-grow: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.gnome-row-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(53, 132, 228, 0.1);
    color: var(--gnome-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1rem;
}

.fi {
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    width: 1.5em;
    height: 1.1em;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.05);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}


.fi-circular {
    border-radius: 50% !important;
    width: 1.8em;
    height: 1.8em;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.immich-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    max-height: min(70vh, 680px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
}

.immich-gallery-item {
    position: relative;
    padding: 0;
    border: 0;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    touch-action: manipulation;
}

.immich-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.immich-gallery-item:hover img {
    transform: scale(1.04);
}

.immich-gallery-item:focus-visible {
    outline: 3px solid rgba(53, 132, 228, 0.45);
    outline-offset: 2px;
}

.immich-gallery-video-badge {
    position: absolute;
    right: 0.4rem;
    bottom: 0.4rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    pointer-events: none;
}

.immich-gallery-status {
    margin-bottom: 0.75rem;
}

.immich-lightbox-dialog {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    margin: 0;
}

.immich-lightbox-content {
    height: 100vh;
    background: rgba(10, 13, 19, 0.86) !important;
    border: 0 !important;
    border-radius: 0;
    box-shadow: none;
}

.immich-lightbox-body {
    position: relative;
    min-height: calc(100vh - 64px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 4.2rem;
}

.immich-lightbox-media {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - 120px);
    object-fit: contain;
}

.immich-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 2.8rem;
    height: 2.8rem;
    border-radius: 999px;
    z-index: 5;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.immich-lightbox-prev {
    left: 1rem;
}

.immich-lightbox-next {
    right: 1rem;
}

.shared-immich-trigger {
    background: rgba(53, 132, 228, 0.08);
    color: var(--gnome-text);
    border: 1px solid rgba(53, 132, 228, 0.2);
}

.shared-immich-trigger:hover {
    background: rgba(53, 132, 228, 0.14);
}

.shared-immich-modal-dialog {
    max-width: 900px;
}

.shared-immich-modal-content {
    border-radius: 20px;
    overflow: hidden;
}

.shared-immich-modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1rem 1.25rem;
}

.shared-immich-modal-body {
    background: #f8f9fb;
    padding: 1rem 1.25rem 1.25rem;
}

.shared-immich-modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
    justify-content: flex-start;
    padding: 0.75rem 1.25rem;
}

.shared-immich-modal-body .immich-gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.6rem;
    max-height: min(55vh, 520px);
}

.profile-achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.9rem;
}

.profile-achievement-item {
    min-width: 0 !important;
}

@media (max-width: 576px) {
    .shared-immich-modal-header,
    .shared-immich-modal-body,
    .shared-immich-modal-footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
}

.flag-wrapper {
    display: inline-flex;
    align-items: center;
    background: #ffffff;
    padding: 6px 14px;
    border-radius: 24px;
    font-size: 0.9rem;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(0,0,0,0.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    max-width: 100%;
}

.flag-wrapper--icon {
    padding: 5px;
    min-width: 2rem;
    min-height: 2rem;
    justify-content: center;
    border-radius: 999px;
}

.flag-wrapper--icon .fi {
    margin-right: 0 !important;
}

.flag-wrapper:hover {
    background: #f8f9fa;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.flag-wrapper .fi {
    box-shadow: none;
    border-radius: 4px;
}

/* Enhanced Date Styling */
.date-badge {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--gnome-text);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    font-variant-numeric: tabular-nums;
}

.date-badge i {
    color: var(--gnome-accent);
    font-size: 0.9rem;
}

.date-range {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(53, 132, 228, 0.08);
    padding: 6px 14px;
    border-radius: 14px;
    font-weight: 700;
    color: var(--gnome-accent);
    font-size: 0.95rem;
}

.date-range i {
    font-size: 1rem;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.pulse-badge {
    animation: pulse 2s infinite;
}

.grayscale {
    filter: grayscale(100%);
    opacity: 0.6;
}

.next-trip-card {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
}

.trip-card-checkbox {
    width: 1.25rem; 
    height: 1.25rem; 
    border-radius: 6px;
}

.trip-card-country {
    letter-spacing: 0.5px; 
    font-size: 0.7rem;
}

.trip-card-btn-list {
    width: 32px; 
    height: 32px; 
    border-radius: 8px;
}

.modal-24px {
    border-radius: 24px;
}

.stats-visited-progress {
    height: 6px; 
    background-color: rgba(255,255,255,0.2);
}

.badge-progress {
    height: 10px; 
    border-radius: 10px; 
    background-color: rgba(0,0,0,0.05); 
    border: 1px solid rgba(0,0,0,0.02);
}

.badge-completed-size {
    font-size: 0.6rem;
}

.next-trip-badge-dest {
    letter-spacing: 0.1em; 
    font-size: 0.7rem;
}

.next-trip-badge-date {
    font-size: 0.75rem;
}

.next-trip-dest-title {
    letter-spacing: -0.02em;
}

.countdown-wrapper-text {
    letter-spacing: 0.1em;
}

.trip-item-time {
    font-size: 0.7rem;
}

.map-preview-size {
    height: 200px;
}

.badge-card-detailed {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 20px; 
    border: 1px solid #f0f0f0 !important;
}

.badge-card-detailed:hover {
    transform: translateY(-10px);
    box-shadow: 0 1rem 3rem rgba(0,0,0,.1) !important;
}

.badge-card-detailed:hover .progress-bar {
    filter: brightness(1.1);
    box-shadow: 0 0 10px rgba(53, 132, 228, 0.4);
}

.bg-success-soft {
    background-color: rgba(25, 135, 84, 0.1);
}

.pulse {
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    70% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { transform: translate(-50%, -50%) scale(0.95); box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

.badge-icon-container div {
    transition: all 0.3s ease;
}

.badge-card-detailed:hover .badge-icon-container div:first-child {
    transform: scale(1.1) rotate(5deg);
    background-color: white !important;
}

.badge-icon-container-size {
    width: 80px; 
    height: 80px;
}

.badge-icon-check-size {
    width: 24px; 
    height: 24px; 
    font-size: 0.7rem;
}

.badge-desc-min-height {
    min-height: 40px;
}

.badge-completed-pill-size {
    font-size: 0.7rem;
}

.badge-progress-height {
    height: 6px; 
    border-radius: 10px;
}

.badge-item {
    filter: grayscale(100%);
    opacity: 0.6;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.countdown-card-style {
    min-height: 300px; 
    transition: background-color 0.5s ease;
}

.weather-badge {
    border-width: 1px;
    border-style: solid;
}

.badge-item-completed-badge {
    font-size: 0.6rem;
}

.rounded-4 {
    border-radius: 1.5rem !important;
}

.btn,
.form-control,
.form-select,
.card,
.modal-content {
    backdrop-filter: blur(2px);
}

.shared-stats-card {
    border-radius: 28px;
}

.shared-map-size {
    height: 500px;
}

.gnome-row-icon-success {
    background: rgba(46, 194, 126, 0.1);
}

.gnome-row-icon-warning {
    background: rgba(255, 193, 7, 0.1);
}

.gnome-row-icon-info {
    background: rgba(53, 132, 228, 0.1);
}

.ls-wide {
    letter-spacing: 0.05em;
}

.shadow-xs {
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.italic {
    font-style: italic;
}

.stats-main-card {
    border-radius: 28px;
}

.chart-container {
    height: 200px;
}

.stat-bar {
    min-height: 4px;
    transition: height 0.5s ease;
}

.badge-progress {
    height: 10px;
    border-radius: 10px;
    background-color: rgba(0,0,0,0.05);
    border: 1px solid rgba(0,0,0,0.02);
}

.map-arrow-icon {
    background: transparent;
    border: 0;
    pointer-events: none;
}

.map-arrow-icon div {
    line-height: 1;
}

.map-arrow-glyph {
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-left: 16px solid #3584e4;
    transform-origin: 2px 50%;
    filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.9));
}

.map-legend {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 10px 12px;
    font-size: 0.75rem;
    color: #2e3436;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.map-legend-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.map-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.map-legend small {
    display: block;
    margin-top: 6px;
    opacity: 0.75;
}

.map-legend-compact {
    font-size: 0.7rem;
    min-width: 120px;
}

.leaflet-control-layers {
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}

.calendar-page .calendar-shell {
    min-height: 600px;
    background: #fff;
    padding: 20px;
    border-radius: 15px;
}

.calendar-page .fc-event {
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 6px;
    border: none !important;
    font-weight: 600;
    font-size: 0.85em;
}

.calendar-page .fc-toolbar-title {
    font-weight: 700 !important;
    color: var(--gnome-text);
}

.calendar-page .fc-button-primary {
    background-color: var(--gnome-accent) !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 8px 16px !important;
    font-weight: 600 !important;
}

.calendar-page .fc-daygrid-day:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.calendar-page .trip-overdue {
    box-shadow: inset 0 0 0 2px #e01b24 !important;
}

.calendar-page .trip-ongoing {
    box-shadow: inset 0 0 0 2px #2ec27e !important;
}

.calendar-page .undated-trip-item {
    display: block;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 12px;
    padding: 10px 12px;
    overflow-wrap: anywhere;
}

/* Shares page layout and controls */
.shares-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.shares-item {
    min-width: 0;
    display: flex;
}

.shares-item > .card {
    width: 100%;
}

.shares-card {
    border: 1px solid rgba(53, 132, 228, 0.12);
    background: linear-gradient(160deg, #ffffff 0%, #fbfdff 100%);
}

.shares-title-row {
    gap: 0.75rem;
}

.shares-title-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.shares-expire-badge {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.shares-actions {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.5rem;
    align-items: stretch;
}

.shares-main-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    border: 1px solid rgba(53, 132, 228, 0.25);
    background: rgba(53, 132, 228, 0.1);
    color: var(--gnome-accent);
}

/* Shared public page visual polish */
.shared-hero-inner h1 {
    letter-spacing: -0.02em;
}

.shared-hero-inner .lead {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
}

.shared-overview-card {
    border: 1px solid rgba(53, 132, 228, 0.15);
    background: linear-gradient(170deg, #ffffff 0%, #f7fbff 100%);
}

.shared-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 900px) {
    .shared-stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.shared-stat-item {
    min-width: 0;
}

.shared-stat-item .gnome-row-icon {
    background: rgba(53, 132, 228, 0.12);
    border: 1px solid rgba(53, 132, 228, 0.16);
}

.shared-trips-container {
    width: 100%;
}

.shared-trip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.shared-card-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    min-width: 0;
    display: flex;
}

.shared-card-wrapper > .card {
    width: 100%;
}

.shared-trip-card {
    border: 1px solid rgba(53, 132, 228, 0.1);
    background: linear-gradient(165deg, #ffffff 0%, #f9fbff 100%);
}

.shared-trip-card .card-header {
    border-bottom: 1px solid rgba(53, 132, 228, 0.08);
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.03) 0%, rgba(53, 132, 228, 0.01) 100%);
    min-height: 4rem;
    align-content: center;
}

.shared-trip-head {
    gap: 0.65rem;
}

.shared-trip-head .badge {
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.shared-view-corner-btn {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border-radius: 10px;
}

.shared-trip-public-details {
    margin-top: auto;
    padding-top: 0.15rem;
}

.shared-trip-public-details p {
    overflow-wrap: anywhere;
}

.shared-trip-details {
    border-color: rgba(53, 132, 228, 0.12);
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.04) 0%, rgba(53, 132, 228, 0.01) 100%);
}

.shared-cta-panel {
    border: 1px solid rgba(53, 132, 228, 0.15);
    background: linear-gradient(170deg, #ffffff 0%, #f6faff 100%);
    box-shadow: 0 10px 28px rgba(36, 31, 49, 0.1);
}

.shared-cta-actions {
    flex-wrap: wrap;
}

.shared-cta-primary {
    background: linear-gradient(135deg, #3584e4 0%, #4a9af0 100%);
    color: #fff;
    box-shadow: 0 10px 22px rgba(53, 132, 228, 0.28);
}

.shared-cta-secondary {
    border: 1px solid rgba(53, 132, 228, 0.2);
    background: rgba(53, 132, 228, 0.08);
    color: var(--gnome-accent);
}

.shared-trip-card a:not(.btn),
.shared-cta-panel a:not(.btn) {
    color: #1f5ca8;
    text-decoration: none;
    border-bottom: 1px dotted rgba(31, 92, 168, 0.4);
}

.shared-trip-card a:not(.btn):hover,
.shared-cta-panel a:not(.btn):hover {
    color: #17477f;
    border-bottom-color: rgba(23, 71, 127, 0.65);
}

@media (max-width: 640px) {
    .shared-cta-actions {
        flex-direction: column;
    }
    .shared-cta-actions .btn {
        width: 100%;
    }
}

.shares-main-action:hover {
    background: rgba(53, 132, 228, 0.18);
}

.shares-icon-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.shares-delete-form {
    display: inline-flex;
}

@media (max-width: 620px) {
    .shares-actions {
        grid-template-columns: 1fr 1fr;
    }
    .shares-main-action {
        grid-column: 1 / -1;
    }
}

/* Keep inner content inside cards and avoid overlap in dense sections. */
.card .card-header,
.card .card-body,
.card .card-footer,
.card .modal-header,
.card .modal-body,
.card .modal-footer {
    min-width: 0;
}

.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6,
.card p,
.card small,
.card a,
.card span {
    overflow-wrap: anywhere;
}

.card .d-flex {
    min-width: 0;
}

.card .d-flex > * {
    min-width: 0;
}

/* Local non-vendor icon treatment (emoji/symbol based) */
.ui-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.1em;
    line-height: 1;
    font-style: normal;
}

.ui-icon--round {
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 50%;
    background: rgba(53, 132, 228, 0.12);
    color: #1f5ca8;
    font-size: 0.85rem;
}

.card,
.gnome-group,
.modal-content,
.shared-overview-card,
.shared-trip-card,
.shared-cta-panel,
.shares-card {
    box-shadow: 0 8px 24px rgba(36, 31, 49, 0.08);
}

/* Dashboard trip-card actions */
.trip-card-actions {
    margin-top: auto;
    padding-top: 0.35rem;
}

.trip-card-wrapper > .card,
.trip-card-wrapper .card {
    border: 1px solid rgba(53, 132, 228, 0.1);
    background: linear-gradient(165deg, #ffffff 0%, #f9fbff 100%);
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.trip-card-wrapper .card-header {
    border-bottom: 1px solid rgba(53, 132, 228, 0.08);
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.03) 0%, rgba(53, 132, 228, 0.01) 100%);
    min-height: 4rem;
    align-content: center;
}

.trip-card-wrapper .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.trip-card-wrapper .date-range {
    background: rgba(53, 132, 228, 0.12);
    color: #1f5ca8;
}

.trip-card-wrapper .badge.bg-success,
.trip-card-wrapper .badge.bg-secondary,
.trip-card-wrapper .badge.bg-info {
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.shared-card-wrapper > .card,
.shared-trip-card,
.shares-item > .card,
.shares-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.shared-trip-card .card-body,
.shares-card .card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.85rem;
}

.shared-trip-details,
.shares-actions {
    margin-top: 0.35rem;
}

.shares-actions {
    margin-top: auto;
}

.shared-trip-card .mb-4 {
    margin-bottom: 0.8rem !important;
}

.shared-trip-head {
    align-items: center !important;
}

.shared-trip-head .badge {
    min-width: 88px;
    text-align: center;
}

.shared-trip-header .badge {
    min-width: 88px;
    text-align: center;
}

.trip-title-row {
    min-width: 0;
}

.trip-title-row > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.trip-action-btn {
    min-height: 2.25rem;
    gap: 0.42rem;
    justify-content: center;
    font-weight: 650;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.trip-action-btn i {
    font-size: 0.9rem;
    opacity: 0.9;
}

.trip-action-btn:hover {
    transform: translateY(-1px);
}

.trip-action-btn:active {
    transform: translateY(0);
}

.trip-action-primary {
    box-shadow: 0 4px 10px rgba(53, 132, 228, 0.14);
}

.trip-action-secondary {
    background: rgba(53, 132, 228, 0.07);
    border-color: rgba(53, 132, 228, 0.2);
}

.trip-action-secondary:hover {
    background: rgba(53, 132, 228, 0.14);
    border-color: rgba(53, 132, 228, 0.28);
}

.trip-action-secondary.btn-primary {
    background: linear-gradient(135deg, #3584e4 0%, #2f78d6 100%);
    border-color: rgba(33, 95, 176, 0.42);
    color: #ffffff;
}

.trip-action-secondary.btn-primary:hover {
    background: linear-gradient(135deg, #2f78d6 0%, #286bc0 100%);
    color: #ffffff;
}

.trip-action-primary.btn-outline-success {
    background: rgba(46, 194, 126, 0.11);
    border-color: rgba(46, 194, 126, 0.45);
    color: #1c7b4d;
}

.trip-action-primary.btn-outline-success:hover {
    background: rgba(46, 194, 126, 0.2);
    border-color: rgba(46, 194, 126, 0.65);
    color: #145a38;
}

.trip-action-secondary.btn-outline-dark {
    color: #2160b2;
    border-color: rgba(53, 132, 228, 0.28);
    background: rgba(53, 132, 228, 0.08);
}

.trip-action-secondary.btn-outline-dark:hover {
    color: #194b8d;
    border-color: rgba(53, 132, 228, 0.38);
    background: rgba(53, 132, 228, 0.16);
}

.trip-action-danger {
    border-color: rgba(224, 27, 36, 0.28);
    color: #b42328;
    background: rgba(224, 27, 36, 0.06);
}

.trip-action-danger:hover {
    background: rgba(224, 27, 36, 0.13);
    border-color: rgba(224, 27, 36, 0.4);
    color: #941f24;
}

.trip-action-btn.disabled,
.trip-action-btn:disabled {
    opacity: 1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    color: #a0a7b0;
    border-color: rgba(158, 168, 181, 0.36);
    background: rgba(228, 232, 239, 0.6);
}

/* Action button polish on settings + shares + shared pages */
.settings-page .card,
.shares-card,
.shared-trip-card {
    border-color: rgba(53, 132, 228, 0.12);
}

.shares-actions .trip-action-btn,
.shared-cta-actions .trip-action-btn,
.settings-page .trip-action-btn {
    min-height: 2.35rem;
}

.shares-icon-btn.trip-action-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: 12px;
}

.shares-main-action.trip-action-btn {
    font-weight: 700;
}

.shared-cta-actions .trip-action-secondary {
    background: rgba(53, 132, 228, 0.1);
    border-color: rgba(53, 132, 228, 0.24);
}

.shared-cta-actions .trip-action-secondary:hover {
    background: rgba(53, 132, 228, 0.16);
}

.settings-page .card-body > h5 {
    letter-spacing: -0.01em;
}

.settings-page .card-body > p {
    max-width: 56ch;
}

.settings-shell {
    overflow: hidden;
}

.settings-sidebar {
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.07) 0%, rgba(53, 132, 228, 0.02) 100%);
}

.settings-nav-btn {
    justify-content: flex-start;
    border: 1px solid rgba(53, 132, 228, 0.16);
    background: rgba(53, 132, 228, 0.07);
}

.settings-nav-btn.is-active {
    background: rgba(53, 132, 228, 0.18);
    border-color: rgba(53, 132, 228, 0.34);
    color: #124487;
}

.settings-avatar-wrap {
    padding: 0.6rem 0.1rem;
}

.settings-avatar-preview {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(53, 132, 228, 0.28);
    background: #d8e8fb;
    flex: 0 0 auto;
}

.settings-subsection {
    border-color: rgba(53, 132, 228, 0.15) !important;
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.04) 0%, rgba(53, 132, 228, 0.01) 100%) !important;
}

.settings-subsection h6 {
    letter-spacing: -0.01em;
}

.service-panel-toggle {
    border: 1px solid rgba(53, 132, 228, 0.2);
    background: rgba(53, 132, 228, 0.08);
}

.service-panel-toggle[aria-expanded="true"] {
    background: rgba(53, 132, 228, 0.14);
    border-color: rgba(53, 132, 228, 0.3);
}

.service-panel-body {
    border-color: rgba(53, 132, 228, 0.16) !important;
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.05) 0%, rgba(53, 132, 228, 0.01) 100%) !important;
}

.trip-form-layout .trip-form-section .btn[data-bs-toggle="collapse"] {
    border: 1px solid rgba(53, 132, 228, 0.2);
    background: rgba(53, 132, 228, 0.08);
    border-radius: 14px !important;
}

.trip-form-layout .trip-form-section .btn[data-bs-toggle="collapse"][aria-expanded="true"] {
    background: rgba(53, 132, 228, 0.14);
    border-color: rgba(53, 132, 228, 0.3);
}

.trip-form-section-body {
    border-color: rgba(53, 132, 228, 0.14) !important;
    background: linear-gradient(180deg, rgba(53, 132, 228, 0.05) 0%, rgba(53, 132, 228, 0.01) 100%) !important;
}

@media (max-width: 640px) {
    .settings-page .trip-action-btn,
    .shared-cta-actions .trip-action-btn {
        width: 100%;
    }

    .shares-actions .trip-action-btn {
        min-height: 2.2rem;
    }

    .settings-sidebar {
        border-right: 0 !important;
        border-bottom: 1px solid rgba(53, 132, 228, 0.18);
    }

    .settings-avatar-wrap {
        align-items: flex-start !important;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .immich-lightbox-dialog {
        max-width: 100vw;
        margin: 0;
    }

    .immich-lightbox-content {
        border-radius: 0;
    }

    .immich-lightbox-body {
        padding: 0.75rem 3.1rem;
    }

    .immich-lightbox-media {
        max-height: calc(100vh - 108px);
    }

    .immich-lightbox-nav {
        width: 2.4rem;
        height: 2.4rem;
    }

    .immich-lightbox-prev {
        left: 0.45rem;
    }

    .immich-lightbox-next {
        right: 0.45rem;
    }

    .trip-card-wrapper {
        margin-bottom: 0.9rem !important;
    }

    .trip-card-wrapper .card-header,
    .trip-card-wrapper .card-body {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .trip-card-wrapper .trip-card-country {
        font-size: 0.68rem;
        opacity: 0.86;
    }

    .trip-card-actions {
        gap: 0.45rem !important;
    }

    .trip-action-btn {
        min-height: 2.15rem;
        border-radius: 14px !important;
        font-size: 0.92rem;
    }

    .trip-card-wrapper .card-header {
        min-height: 3.45rem;
    }

    .shared-trip-grid {
        grid-template-columns: 1fr;
    }

    .shared-trip-card .card-header,
    .shared-trip-card .card-body {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .shared-trip-card .card-header {
        min-height: 3.45rem;
    }

    .shared-trip-card .date-range {
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }
}

/* -------------------------------------------------------------------------- */
/* Global visual consistency pass                                              */
/* -------------------------------------------------------------------------- */

body {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.card {
    border-color: rgba(53, 132, 228, 0.1);
}

@media (hover: hover) {
    .card:hover {
        transform: translateY(-3px);
        box-shadow: 0 10px 24px rgba(36, 31, 49, 0.11) !important;
    }
}

@media (hover: none) {
    .card:hover {
        transform: none;
        box-shadow: 0 8px 22px rgba(36, 31, 49, 0.09) !important;
    }
}

.btn-light {
    background-color: rgba(53, 132, 228, 0.08);
    border: 1px solid rgba(53, 132, 228, 0.18);
}

.btn-light:hover {
    background-color: rgba(53, 132, 228, 0.14);
    border-color: rgba(53, 132, 228, 0.28);
}

.form-control,
.form-select {
    border-color: rgba(53, 132, 228, 0.2);
}

.form-control::placeholder,
.form-select::placeholder {
    color: #8d97a3;
}

.modal-content {
    border: 1px solid rgba(53, 132, 228, 0.12);
}

@media (max-width: 768px) {
    .container {
        width: min(1200px, 100% - 1.1rem);
    }

    .card {
        border-radius: 20px;
    }

    .btn {
        white-space: normal;
    }
}

/* -------------------------------------------------------------------------- */
/* Project-owned utility + component layer (Bootstrap replacement baseline)   */
/* -------------------------------------------------------------------------- */

* { box-sizing: border-box; }

.container {
    width: min(1200px, 100% - 2rem);
    margin-inline: auto;
}

.row {
    --gutter-x: 1.5rem;
    --gutter-y: 0;
    display: flex;
    flex-wrap: wrap;
    margin-top: calc(-1 * var(--gutter-y));
    margin-left: calc(-0.5 * var(--gutter-x));
    margin-right: calc(-0.5 * var(--gutter-x));
}

.row > [class*="col-"] ,
.row > .col,
.row > .col-12,
.row > .col-md-3,
.row > .col-md-4,
.row > .col-md-5,
.row > .col-md-6,
.row > .col-md-7,
.row > .col-md-8,
.row > .col-md-10,
.row > .col-md-11,
.row > .col-lg-3,
.row > .col-lg-4,
.row > .col-lg-9,
.row > .col-lg-10,
.row > .col-lg-12 {
    flex: 0 0 auto;
    max-width: 100%;
    margin-top: var(--gutter-y);
    padding-left: calc(0.5 * var(--gutter-x));
    padding-right: calc(0.5 * var(--gutter-x));
}

.col { flex: 1 0 0%; }
.col-12 { width: 100%; max-width: 100%; }
.col-6 { width: 50%; max-width: 50%; }

@media (min-width: 768px) {
    .col-md-3 { width: 25%; max-width: 25%; }
    .col-md-4 { width: 33.3333%; max-width: 33.3333%; }
    .col-md-5 { width: 41.6667%; max-width: 41.6667%; }
    .col-md-6 { width: 50%; max-width: 50%; }
    .col-md-7 { width: 58.3333%; max-width: 58.3333%; }
    .col-md-8 { width: 66.6667%; max-width: 66.6667%; }
    .col-md-10 { width: 83.3333%; max-width: 83.3333%; }
    .col-md-11 { width: 91.6667%; max-width: 91.6667%; }
    .col-md-12 { width: 100%; max-width: 100%; }
    .d-md-block { display: block !important; }
}

@media (min-width: 992px) {
    .col-lg-3 { width: 25%; max-width: 25%; }
    .col-lg-4 { width: 33.3333%; max-width: 33.3333%; }
    .col-lg-9 { width: 75%; max-width: 75%; }
    .col-lg-10 { width: 83.3333%; max-width: 83.3333%; }
    .col-lg-12 { width: 100%; max-width: 100%; }
}

.g-0 { --gutter-x: 0; --gutter-y: 0; }
.g-2 { --gutter-x: 0.5rem; --gutter-y: 0.5rem; }
.g-3 { --gutter-x: 0.75rem; --gutter-y: 0.75rem; }
.g-4 { --gutter-x: 1rem; --gutter-y: 1rem; }

.d-flex { display: flex !important; }
.d-inline-flex { display: inline-flex !important; }
.d-block { display: block !important; }
.d-grid { display: grid !important; }
.d-none { display: none !important; }

.flex-wrap { flex-wrap: wrap !important; }
.flex-column { flex-direction: column !important; }
.flex-grow-1 { flex-grow: 1 !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-baseline { align-items: baseline !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-start { justify-content: flex-start !important; }

.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.top-0 { top: 0 !important; }
.start-0 { left: 0 !important; }
.start-50 { left: 50% !important; }
.start-100 { left: 100% !important; }
.bottom-0 { bottom: 0 !important; }
.end-0 { right: 0 !important; }
.translate-middle { transform: translate(-50%, -50%); }
.translate-middle-x { transform: translateX(-50%); }

.text-center { text-align: center !important; }
.text-start { text-align: left !important; }
.text-end { text-align: right !important; }

.bg-white { background: #fff !important; }
.bg-light { background: #f8f9fa !important; }
.bg-primary { background: #3584e4 !important; }
.bg-success { background: #2ec27e !important; }
.bg-warning { background: #f5c211 !important; }
.bg-info { background: #62a0ea !important; }
.bg-dark { background: #241f31 !important; }
.bg-secondary { background: #77767b !important; }

.border { border: 1px solid rgba(0, 0, 0, 0.1) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid rgba(0, 0, 0, 0.08) !important; }
.border-bottom { border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important; }
.border-end { border-right: 1px solid rgba(0, 0, 0, 0.08) !important; }
.border-light { border-color: rgba(0, 0, 0, 0.08) !important; }

.rounded { border-radius: 0.5rem !important; }
.rounded-2 { border-radius: 0.6rem !important; }
.rounded-3 { border-radius: 0.8rem !important; }
.rounded-5 { border-radius: 2rem !important; }
.rounded-pill { border-radius: 999px !important; }
.rounded-circle { border-radius: 50% !important; }

.shadow { box-shadow: 0 8px 24px rgba(0,0,0,0.12) !important; }
.shadow-lg { box-shadow: 0 16px 40px rgba(0,0,0,0.18) !important; }

.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-normal { font-weight: 400 !important; }

.small { font-size: 0.875rem !important; }
.fs-2 { font-size: 1.5rem !important; }
.h2 { font-size: 2rem !important; }
.h4 { font-size: 1.5rem !important; }
.display-1 { font-size: clamp(2.5rem, 6vw, 4.5rem) !important; }
.display-4, .display-5 {
    font-size: clamp(1.8rem, 4vw, 2.8rem) !important;
}

/* Enhanced Carousel Flags */
.carousel-item .fi {
    width: 2em !important;
    height: 1.33em !important;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.carousel-nav-top {
    z-index: 100;
}
.lead { font-size: 1.1rem; }

.m-0 { margin: 0 !important; }
.mx-auto { margin-left: auto !important; margin-right: auto !important; }
.ms-auto { margin-left: auto !important; }
.ms-1 { margin-left: 0.25rem !important; }
.ms-2 { margin-left: 0.5rem !important; }
.me-1 { margin-right: 0.25rem !important; }
.me-2 { margin-right: 0.5rem !important; }
.me-3 { margin-right: 1rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
.px-2 { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
.px-3 { padding-left: 1rem !important; padding-right: 1rem !important; }
.px-4 { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
.px-5 { padding-left: 3rem !important; padding-right: 3rem !important; }
.py-1 { padding-top: 0.25rem !important; padding-bottom: 0.25rem !important; }
.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
.py-5 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
.pt-0 { padding-top: 0 !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pb-0 { padding-bottom: 0 !important; }
.pb-4 { padding-bottom: 1.5rem !important; }

.w-100 { width: 100% !important; }
.w-75 { width: 75% !important; }
.h-100 { height: 100% !important; }
.min-vh-100 { min-height: 100vh; }
.overflow-hidden { overflow: hidden !important; }
.overflow-auto { overflow: auto !important; }

.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
}

.alert-info {
    background: rgba(53,132,228,0.12);
    color: #1f5ca8;
    border: 1px solid rgba(53,132,228,0.2);
}

.form-label { display: inline-block; margin-bottom: 0.35rem; }
.form-text { color: #6c757d; font-size: 0.8rem; }
.form-check-input { width: 1rem; height: 1rem; }

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 1.05rem;
    height: 1.05rem;
    border: 1px solid rgba(53, 132, 228, 0.45);
    border-radius: 0.3rem;
    background: #fff;
    display: inline-grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    transform: scale(0);
    transition: transform 0.15s ease;
    box-shadow: inset 1em 1em #ffffff;
    clip-path: polygon(14% 44%, 0 59%, 44% 100%, 100% 17%, 84% 0, 43% 62%);
}

input[type="checkbox"]:checked {
    background: linear-gradient(145deg, #3584e4 0%, #4a9af0 100%);
    border-color: #2f7bda;
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(53, 132, 228, 0.45);
    outline-offset: 2px;
}

.input-group {
    display: flex;
    width: 100%;
}

.input-group > .form-control { flex: 1 1 auto; }

.modal {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: none;
}

.modal.show { display: block; }

.modal-dialog {
    max-width: min(520px, calc(100% - 1.5rem));
    margin: 1.75rem auto;
}

.modal-content {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}

.modal-header,
.modal-body,
.modal-footer { padding: 1rem 1.25rem; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-title {
    margin: 0;
}

.modal-header .btn-close {
    margin-left: auto;
    flex: 0 0 auto;
}

.btn-close {
    position: relative;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.04);
    cursor: pointer;
    padding: 0;
}

.btn-close::before,
.btn-close::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 2px;
    background: #2e3436;
    border-radius: 2px;
    transform-origin: center;
}

.btn-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.btn-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.btn-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.btn-close-white {
    border-color: rgba(255, 255, 255, 0.34);
    background: rgba(255, 255, 255, 0.08);
}

.btn-close-white::before,
.btn-close-white::after {
    background: #ffffff;
}

.modal-footer { display: flex; justify-content: flex-end; gap: 0.5rem; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.48);
    z-index: 1040;
}

body.immich-lightbox-open .modal-backdrop {
    background: rgba(8, 11, 18, 0.58);
    backdrop-filter: blur(7px);
}

body.modal-open { overflow: hidden; }

.toast {
    max-width: 380px;
    background: #3584e4;
    border-radius: 1rem;
}

.toast.show { display: block; }

.app-badge-toast {
    background: linear-gradient(140deg, #3584e4 0%, #2a76d0 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 28px rgba(18, 68, 135, 0.3);
    min-width: 320px;
}

.app-badge-toast-icon {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
}

.app-badge-toast-message {
    max-width: 260px;
    line-height: 1.35;
}

.navbar-expand-lg .navbar-collapse { display: flex; }
.navbar-nav { display: flex; gap: 0.3rem; }
.app-navbar-collapse {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    margin-top: 0 !important;
}

.app-navbar-nav {
    width: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.app-navbar-nav .nav-link,
.app-language-dropdown .btn {
    white-space: nowrap;
}

.navbar-toggler {
    margin-left: auto;
}
.app-navbar-collapse {
    flex: 1 1 auto;
    justify-content: flex-end;
    margin-top: 0 !important;
}

.app-navbar-nav {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: nowrap;
}

.app-language-dropdown {
    flex-shrink: 0;
}

.app-language-trigger {
    min-width: 2.5rem;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.app-language-trigger .fi {
    font-size: 1.05rem;
}

.app-language-option {
    min-height: 2rem;
    justify-content: space-between;
    gap: 0.75rem;
}

.app-language-label {
    font-weight: 600;
}

.app-language-option .app-language-label {
    min-width: 5.5rem;
}

.app-language-option.is-active {
    background: rgba(53, 132, 228, 0.14);
    color: #124487;
}

.app-profile-dropdown {
    flex-shrink: 0;
}

.app-profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.2rem 0.55rem 0.2rem 0.25rem;
    border-radius: 999px;
    background: rgba(53, 132, 228, 0.08);
    border: 1px solid rgba(53, 132, 228, 0.16);
}

.app-profile-trigger:hover {
    background: rgba(53, 132, 228, 0.15);
    border-color: rgba(53, 132, 228, 0.3);
}

.app-user-avatar {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(53, 132, 228, 0.25);
    background: #d8e8fb;
}
.navbar-toggler {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(53, 132, 228, 0.08);
    border: 1px solid rgba(53, 132, 228, 0.2) !important;
    align-items: center;
    justify-content: center;
}

.navbar-toggler-icon {
    width: 20px;
    height: 14px;
    display: inline-block;
    background:
        linear-gradient(var(--gnome-text), var(--gnome-text)) center 0/20px 2px no-repeat,
        linear-gradient(var(--gnome-text), var(--gnome-text)) center 6px/20px 2px no-repeat,
        linear-gradient(var(--gnome-text), var(--gnome-text)) center 12px/20px 2px no-repeat;
}

.dropdown { position: relative; }
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    min-width: 180px;
    background: #fff;
    border-radius: 0.95rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 16px 34px rgba(17, 24, 39, 0.16);
    padding: 0.4rem;
    z-index: 1100;
}

.dropdown-menu.show { display: block; }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-radius: 0.65rem;
    color: #2e3436;
    text-decoration: none;
    transition: background-color 0.16s ease, color 0.16s ease;
}

.dropdown-item:hover {
    background: rgba(53, 132, 228, 0.1);
    color: #124487;
}

.collapse { display: none; }
.collapse.show { display: block; }

.progress-bar {
    height: 100%;
    border-radius: inherit;
}

.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1020;
}

.list-group { display: flex; flex-direction: column; }
.list-group-item { padding: 0.6rem 0.75rem; }

@media (max-width: 991px) {
    .navbar .container {
        flex-wrap: wrap;
    }

    .navbar-expand-lg .navbar-collapse {
        display: none !important;
        margin-top: 0.65rem;
        border: 1px solid rgba(0, 0, 0, 0.06);
        background: rgba(255, 255, 255, 0.94);
        border-radius: 16px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
        padding: 0.65rem;
    }
    .navbar-expand-lg .navbar-collapse.show {
        display: block !important;
    }
    .navbar-nav {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    .app-navbar-nav {
        width: 100%;
        flex-wrap: wrap;
    }
    .nav-link {
        border-radius: 12px;
        padding-left: 0.8rem !important;
        padding-right: 0.8rem !important;
    }
    .navbar-toggler { display: inline-flex; }
    .dropdown {
        margin-top: 0.5rem;
        width: 100%;
    }

    .app-profile-trigger {
        width: 100%;
        justify-content: flex-start;
    }

    .app-language-trigger {
        width: 100%;
        justify-content: center !important;
    }
    .dropdown-menu {
        width: 100%;
        left: 0;
        right: auto;
        position: static;
        margin-top: 0.45rem;
        box-shadow: 0 8px 18px rgba(17, 24, 39, 0.1);
    }
    .app-toast-container {
        left: 0;
        right: 0;
        bottom: 0;
        padding: 0.75rem !important;
    }
    .app-badge-toast {
        width: 100%;
        max-width: 100%;
    }
    .app-badge-toast-message {
        max-width: none;
    }
    .profile-achievements-head {
        align-items: stretch !important;
    }
    .profile-achievements-actions {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr;
    }
    .profile-achievements-actions .btn {
        width: 100%;
        justify-content: center;
    }
    .profile-achievements-grid {
        grid-template-columns: 1fr;
    }
}

/* Final responsive/layout harmonization (kept at file end to win cascade order). */
.container {
    width: min(1200px, 100% - 1.6rem);
}

@media (max-width: 992px) {
    .container {
        width: min(1200px, 100% - 1.15rem);
    }

    .trip-card-actions .trip-action-btn,
    .shared-cta-actions .trip-action-btn,
    .shares-actions .trip-action-btn {
        min-height: 2.2rem;
    }
}

@media (max-width: 640px) {
    .trip-card-wrapper,
    .shared-trip-item,
    .shares-item {
        margin-bottom: 0.8rem !important;
    }

    .trip-card-wrapper .card-header,
    .trip-card-wrapper .card-body,
    .shared-trip-card .card-body,
    .shares-card .card-body {
        padding-left: 0.9rem !important;
        padding-right: 0.9rem !important;
    }

    .app-badge-toast {
        min-width: 0;
    }
}

.trip-card-styled {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.trip-card-styled:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.1) !important;
}

.btn-floating-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: white;
    border: none;
    transition: all 0.2s ease;
}

.btn-floating-action:hover {
    background: #f8f9fa;
    transform: scale(1.1);
}

.trip-card-image-wrapper {
    width: 100%;
    overflow: hidden;
}

.trip-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.trip-card-styled:hover .trip-card-image-wrapper img {
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .trip-card-wrapper {
        padding-left: 8px;
        padding-right: 8px;
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .next-trip-dest-title {
        font-size: 2.2rem;
    }
    
    .profile-header h1 {
        font-size: 2rem;
    }
}

@media (max-width: 576px) {
    .trip-card-wrapper {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .next-trip-dest-title, .active-trip-dest-title {
        font-size: 1.8rem;
    }
}
body.compact-mode .container {
    width: min(1200px, 100% - 1.2rem);
}

body.compact-mode .card {
    border-radius: 18px;
}

body.compact-mode .trip-card-wrapper .card-header,
body.compact-mode .trip-card-wrapper .card-body,
body.compact-mode .shared-trip-card .card-header,
body.compact-mode .shared-trip-card .card-body,
body.compact-mode .shares-card .card-body {
    padding-top: 0.85rem !important;
    padding-bottom: 0.85rem !important;
}

body.compact-mode .btn {
    padding: 0.5rem 1rem;
}

body.compact-mode .gnome-row {
    padding: 0.75rem;
}

