/* static/css/tirra-sidebar.css
   Tirra Outdoor sidebar: warm paper + terracotta topographic rail
   No green palette. Designed to sit on top of the existing TrackHorizon/Tirra shell.
*/

:root {
    --tirra-paper: #fbf6ed;
    --tirra-paper-2: #f6ecdf;
    --tirra-ink: #2d2925;
    --tirra-muted: #7d6d60;
    --tirra-terracotta: #b9613f;
    --tirra-terracotta-dark: #8f442c;
    --tirra-terracotta-soft: #e9c4ad;
    --tirra-sand: #dcc7af;
    --tirra-line: rgba(143, 68, 44, .22);
    --tirra-shadow: rgba(72, 49, 36, .18);
    --sidebar-width: 270px;
}

/* Sidebar frame */
.tirra-sidebar {
    width: var(--sidebar-width);
    background: transparent !important;
    border-right: 0 !important;
    overflow: visible !important;
    isolation: isolate;
    box-shadow: none !important;
}

/* Stretched SVG defines the sculpted paper/folder silhouette */
.tirra-sidebar-shape {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: visible;
    filter: drop-shadow(12px 2px 18px var(--tirra-shadow));
    pointer-events: none;
}

.tirra-sidebar-paper {
    fill: var(--tirra-paper);
}

.tirra-sidebar-edge {
    fill: none;
    stroke: var(--tirra-terracotta);
    stroke-width: 2.25;
    vector-effect: non-scaling-stroke;
}

/* Terracotta field-map rail at far left */
.tirra-sidebar-rail {
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    overflow: hidden;
    background:
        linear-gradient(180deg, #b85f3e 0%, #c97853 45%, #a95235 100%);
    border-right: 1px solid rgba(255,255,255,.28);
    z-index: -2;
}

.tirra-sidebar-rail::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 45% 12%, rgba(255,255,255,.10), transparent 24%),
        radial-gradient(circle at 70% 68%, rgba(83,37,24,.10), transparent 28%);
    mix-blend-mode: soft-light;
}

.tirra-sidebar-rail svg {
    width: 100%;
    height: 100%;
    opacity: .32;
}

.tirra-sidebar-rail path {
    fill: none;
    stroke: #f6d6c4;
    stroke-width: .85;
    vector-effect: non-scaling-stroke;
}

/* Scrollable content */
.tirra-sidebar-inner {
    position: relative;
    padding: 18px 22px 20px 30px;
    color: var(--tirra-ink);
    scrollbar-color: rgba(185,97,63,.28) transparent !important;
}

.tirra-sidebar-inner::-webkit-scrollbar {
    width: 5px !important;
}

.tirra-sidebar-inner::-webkit-scrollbar-thumb {
    background: rgba(185,97,63,.25) !important;
}

/* Brand */
.tirra-sidebar-brand {
    padding: 8px 8px 24px 8px;
    text-align: left;
}

.tirra-mountain-mark {
    width: 94px;
    height: 34px;
    color: var(--tirra-terracotta-dark);
    margin-bottom: 4px;
}

.tirra-mountain-mark svg {
    width: 100%;
    height: 100%;
}

.tirra-mountain-mark path {
    fill: none;
    stroke: currentColor;
    stroke-width: 2.15;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tirra-wordmark {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 2.9rem;
    line-height: .9;
    letter-spacing: -.04em;
    color: #211e1b;
}

.tirra-outdoor {
    margin-top: 7px;
    font-size: .82rem;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--tirra-terracotta-dark);
}

.tirra-outdoor::before,
.tirra-outdoor::after {
    content: "—";
    margin: 0 .35rem;
    color: var(--tirra-sand);
}

.tirra-tagline {
    margin-top: 8px;
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    font-size: .69rem;
    line-height: 1.4;
    color: var(--tirra-muted);
}

/* Section labels */
.tirra-sidebar .sidebar-section-label {
    width: 100%;
    padding: 1.1rem .55rem .45rem;
    border: 0;
    background: transparent;
    color: var(--tirra-terracotta-dark) !important;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
    user-select: none;
}

.tirra-sidebar button.sidebar-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
}

.tirra-sidebar .sidebar-section-label .fa-chevron-down {
    font-size: .58rem;
    color: var(--tirra-muted) !important;
    transition: transform .2s ease;
}

/* Navigation */
.tirra-sidebar .sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0 .3rem 0 0;
}

.tirra-sidebar .sidebar-nav li {
    margin: 3px 0;
}

.tirra-sidebar .sidebar-link {
    position: relative;
    display: grid;
    grid-template-columns: 29px minmax(0, 1fr);
    align-items: center;
    gap: .5rem;
    min-height: 40px;
    padding: .48rem .65rem .48rem .55rem;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #3e3732 !important;
    background: transparent;
    text-decoration: none;
    font-size: .84rem;
    font-weight: 500;
    line-height: 1.15;
    transition:
        background .16s ease,
        color .16s ease,
        transform .16s ease,
        box-shadow .16s ease,
        border-color .16s ease;
}

.tirra-sidebar .sidebar-icon {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    color: var(--tirra-terracotta-dark);
    background: rgba(185,97,63,.055);
    transition: inherit;
}

.tirra-sidebar .sidebar-icon i {
    width: auto !important;
    margin: 0 !important;
    opacity: 1 !important;
    font-size: .84rem;
}

.tirra-sidebar .sidebar-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hover stays subtle: no neon / no green */
.tirra-sidebar .sidebar-link:hover {
    background: rgba(185,97,63,.08) !important;
    color: #211e1b !important;
    border-color: rgba(185,97,63,.12) !important;
    transform: translateX(2px);
}

.tirra-sidebar .sidebar-link:hover .sidebar-icon {
    background: rgba(185,97,63,.13);
    color: var(--tirra-terracotta-dark);
}

/* Active item: warm terracotta tab */
.tirra-sidebar .sidebar-link.active {
    background:
        linear-gradient(135deg,
            #c87450 0%,
            #b95e3d 100%) !important;
    color: #fffaf4 !important;
    border-color: rgba(143,68,44,.28) !important;
    box-shadow:
        0 8px 18px rgba(143,68,44,.18),
        inset 0 1px 0 rgba(255,255,255,.22);
    font-weight: 600;
}

.tirra-sidebar .sidebar-link.active::after {
    content: "";
    position: absolute;
    right: -2px;
    top: 50%;
    width: 6px;
    height: 24px;
    transform: translateY(-50%);
    border-radius: 6px;
    background: rgba(185,94,61,.14);
    
    z-index: -1;
}

.tirra-sidebar .sidebar-link.active .sidebar-icon {
    background: rgba(255,250,244,.18);
    color: #fffaf4;
}

/* Dividers */
.tirra-sidebar .sidebar-divider {
    height: 1px;
    margin: .65rem .55rem .15rem;
    background:
        linear-gradient(90deg,
            transparent,
            rgba(143,68,44,.22) 18%,
            rgba(143,68,44,.22) 82%,
            transparent);
}

/* Secondary lists */
.sidebar-nav-secondary {
    margin-top: .3rem !important;
}

/* Footer */
.tirra-sidebar-footer {
    margin-top: 1.35rem;
    padding: 1rem .55rem 1.5rem;
}

.tirra-footer-rule {
    width: 48px;
    height: 1px;
    background: var(--tirra-terracotta);
    margin-bottom: .65rem;
}

.tirra-footer-copy {
    font-family: Georgia, 'Times New Roman', serif;
    text-transform: uppercase;
    letter-spacing: .15em;
    color: var(--tirra-terracotta-dark);
    font-size: .62rem;
    line-height: 1.55;
    margin-bottom: 1rem;
}

.tirra-sidebar .sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    width: 100%;
    padding: .55rem .75rem;
    border: 1px solid rgba(143,68,44,.20);
    border-radius: 14px;
    background: rgba(255,255,255,.38);
    color: var(--tirra-terracotta-dark);
    text-decoration: none;
    font-size: .78rem;
    font-weight: 600;
    transition: .16s ease;
}

.tirra-sidebar .sidebar-logout-btn:hover {
    background: rgba(185,97,63,.09);
    border-color: rgba(143,68,44,.32);
    color: #6f311f;
}

/* Main content follows wider Tirra panel */
.app-main {
    margin-left: var(--sidebar-width);
}

/* Full map pages also respect new width */
.map-full-page {
    left: var(--sidebar-width);
}

/* The header stays above the sidebar, but use Tirra colours when relevant */
.header-resort-badge {
    background: #f7e8da !important;
    color: var(--tirra-terracotta-dark) !important;
}

.header-user-btn .user-avatar {
    background: var(--tirra-terracotta-dark) !important;
}

.header-brand .brand-icon {
    background: var(--tirra-terracotta) !important;
}

/* Tablet/mobile: conventional drawer for usability */
@media (max-width: 991.98px) {
    :root {
        --sidebar-width: min(270px, 88vw);
    }

    .tirra-sidebar {
        transform: translateX(-108%);
        filter: none;
    }

    .tirra-sidebar.open {
        transform: translateX(0);
    }

    .app-main {
        margin-left: 0 !important;
    }

    .map-full-page {
        left: 0 !important;
    }

    .tirra-sidebar-shape {
        filter: drop-shadow(10px 0 22px rgba(72,49,36,.28));
    }
}

/* Very short screens: compact brand block so menu remains reachable */
@media (max-height: 720px) and (min-width: 992px) {
    .tirra-sidebar-brand {
        padding-bottom: 12px;
    }

    .tirra-wordmark {
        font-size: 2.15rem;
    }

    .tirra-tagline {
        display: none;
    }

    .tirra-sidebar .sidebar-link {
        min-height: 35px;
        padding-top: .38rem;
        padding-bottom: .38rem;
    }

    .tirra-sidebar .sidebar-section-label {
        padding-top: .8rem;
    }
}


/* V2: compact reference-style spine */
.tirra-sidebar::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: linear-gradient(180deg, #b9613f 0%, #c97a54 48%, #9f4d32 100%);
    z-index: 0;
}

.tirra-sidebar-inner {
    z-index: 1;
}

/* Keep the silhouette crisp rather than scalloped */
.tirra-sidebar-shape {
    filter: drop-shadow(8px 2px 14px rgba(72,49,36,.14));
}

.tirra-sidebar-edge {
    stroke-width: 1.8;
}

/* Slightly tighter brand to recover vertical space */
.tirra-sidebar-brand {
    padding-bottom: 18px;
}


/* ============================================================
   V3 OVERRIDES — true folded-strip sidebar
   Fixes the "soft scallop" problem by separating:
   - terracotta fold behind
   - cream navigation sheet in front
   ============================================================ */

:root {
    --sidebar-width: 286px;
}

/* Overall frame */
.tirra-sidebar {
    width: var(--sidebar-width) !important;
    overflow: visible !important;
    background: transparent !important;
    border-right: 0 !important;
}

/* Remove old single-shape asset if any */
.tirra-sidebar-shape { display: none !important; }

/* Remove old empty left strip look */
.tirra-sidebar::before {
    display: none !important;
}

/* Keep the left topographic rail, but slimmer and integrated */
.tirra-sidebar-rail {
    display: block !important;
    width: 52px !important;
    left: 0 !important;
    border-right: 1px solid rgba(255,255,255,.20);
    background:
        linear-gradient(180deg, #b4603f 0%, #c87753 52%, #a44e33 100%) !important;
    z-index: -4 !important;
}

/* Place content on the cream sheet */
.tirra-sidebar-inner {
    position: relative;
    z-index: 3;
    padding: 18px 18px 20px 40px !important;
}

/* --- LAYER 1: terracotta folded strip behind the sheet --- */
.tirra-sidebar-fold {
    position: absolute;
    top: 0;
    right: 10px;
    width: 76px;
    height: 100%;
    z-index: -2;
    overflow: visible;
    filter: drop-shadow(8px 0 10px rgba(125, 66, 44, .12));
    pointer-events: none;
}

.tirra-fold-fill {
    fill: #c46e49;
    opacity: .98;
}

/* --- LAYER 2: cream navigation sheet in front --- */
.tirra-sidebar-sheet {
    position: absolute;
    top: 0;
    right: 22px;
    width: 262px;
    height: 100%;
    z-index: -1;
    overflow: visible;
    filter: drop-shadow(12px 3px 16px rgba(72, 49, 36, .12));
    pointer-events: none;
}

.tirra-sheet-fill {
    fill: var(--tirra-paper);
}

.tirra-sheet-edge {
    fill: none;
    stroke: var(--tirra-terracotta);
    stroke-width: 1.7;
    vector-effect: non-scaling-stroke;
}

/* Hide old path classes if inherited */
.tirra-sidebar-paper,
.tirra-sidebar-edge {
    display: none !important;
}

/* Tighter, straighter nav treatment */
.tirra-sidebar .sidebar-link {
    border-radius: 10px !important;
    min-height: 39px;
    padding: .48rem .62rem .48rem .5rem !important;
}

.tirra-sidebar .sidebar-link.active {
    border-radius: 12px !important;
    box-shadow:
        0 8px 18px rgba(143,68,44,.16),
        inset 0 1px 0 rgba(255,255,255,.18) !important;
}

.tirra-sidebar .sidebar-link.active::after {
    right: -5px !important;
    width: 8px !important;
    height: 26px !important;
    border-radius: 8px !important;
    background: rgba(185,94,61,.18) !important;
}

.tirra-sidebar .sidebar-nav {
    padding-right: .1rem !important;
}

.tirra-sidebar-brand {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.tirra-sidebar-footer {
    position: relative;
    overflow: hidden;
}

@media (max-width: 991.98px) {
    :root { --sidebar-width: min(286px, 90vw); }

    .tirra-sidebar {
        transform: translateX(-108%);
    }

    .tirra-sidebar.open {
        transform: translateX(0);
    }

    .tirra-sidebar-sheet {
        right: 18px;
        width: calc(min(286px, 90vw) - 24px);
    }

    .tirra-sidebar-fold {
        right: 8px;
    }

    .tirra-sidebar-inner {
        padding-left: 34px !important;
        padding-right: 16px !important;
    }
}

@media (max-height: 720px) and (min-width: 992px) {
    .tirra-sidebar-inner {
        padding-top: 14px !important;
    }

    .tirra-sidebar-brand {
        padding-bottom: 12px !important;
    }

    .tirra-wordmark {
        font-size: 2.25rem !important;
    }
}


/* ============================================================
   V4 — clean rectangular Tirra sidebar
   Purpose: remove colour overlap and exaggerated folded shapes.
   ============================================================ */

:root {
    --sidebar-width: 268px;
}

/* Reset previous silhouette systems */
.tirra-sidebar-fold,
.tirra-sidebar-sheet,
.tirra-sidebar-shape {
    display: none !important;
}

/* Main sidebar stays visually rectangular */
.tirra-sidebar {
    width: var(--sidebar-width) !important;
    background: transparent !important;
    border-right: 0 !important;
    overflow: visible !important;
}

/* One subtle terracotta spine only */
.tirra-sidebar::before {
    content: "" !important;
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 7px;
    background: #b9613f;
    z-index: 0;
}

/* Remove the broad orange/topographic rail completely.
   This was causing the colour overlap / mismatch. */
.tirra-sidebar-rail {
    display: none !important;
}

/* Single cream sheet */
.tirra-sidebar-sheet-v4 {
    position: absolute;
    top: 0;
    left: 7px;
    width: 258px;
    height: 100%;
    z-index: -1;
    overflow: visible;
    filter: drop-shadow(8px 2px 14px rgba(72,49,36,.12));
    pointer-events: none;
}

.tirra-sheet-v4-fill {
    fill: #fbf6ed;
}

.tirra-sheet-v4-edge {
    fill: none;
    stroke: #b9613f;
    stroke-width: 1.6;
    vector-effect: non-scaling-stroke;
}

/* Navigation content sits cleanly within the sheet */
.tirra-sidebar-inner {
    position: relative;
    z-index: 2;
    padding: 18px 24px 20px 30px !important;
}

/* Keep menu styling restrained */
.tirra-sidebar .sidebar-link {
    border-radius: 9px !important;
    min-height: 39px;
    padding: .48rem .6rem .48rem .5rem !important;
}

.tirra-sidebar .sidebar-link.active {
    border-radius: 10px !important;
    background: linear-gradient(135deg,#c87450 0%,#b95e3d 100%) !important;
    color: #fffaf4 !important;
    box-shadow: 0 6px 14px rgba(143,68,44,.14) !important;
}

/* Remove the old protruding active pseudo-shape */
.tirra-sidebar .sidebar-link.active::after {
    display: none !important;
}

.tirra-sidebar .sidebar-divider {
    background: rgba(143,68,44,.16) !important;
}

/* Brand area: no colour overlap */
.tirra-sidebar-brand {
    background: transparent !important;
}

.tirra-logo-image {
    display: block;
    width: 170px;
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
    object-fit: contain;
    object-position: left center;
}

/* Footer clean-up */
.tirra-sidebar-footer {
    background: transparent !important;
}

/* Main content aligns to compact sidebar */
.app-main {
    margin-left: var(--sidebar-width) !important;
}

.map-full-page {
    left: var(--sidebar-width) !important;
}

@media (max-width: 991.98px) {
    :root { --sidebar-width: min(268px, 90vw); }

    .tirra-sidebar-sheet-v4 {
        width: calc(min(268px, 90vw) - 10px);
    }

    .tirra-sidebar-inner {
        padding-left: 28px !important;
        padding-right: 20px !important;
    }

    .app-main,
    .map-full-page {
        margin-left: 0 !important;
        left: 0 !important;
    }
}