/* Tour Notes runtime — Dyar AlHaram visual identity:
   dark green #21362C · brand gold #d0b787 · cream #f5f1ea
   All classes prefixed .tn- to avoid conflicts with the tour skin. */
.tn-root, .tn-root * { box-sizing: border-box; }
/* While switching language, suppress every transition so nothing slides/animates. */
.tn-root.tn-switching, .tn-root.tn-switching * { transition: none !important; animation: none !important; }
.tn-root {
    --tn-green:   #21362c;
    --tn-green-d: #15241c;
    --tn-gold:    #d0b787;
    --tn-gold-d:  #c9a96e;
    --tn-cream:   #f5f1ea;
    --tn-muted:   #9fb0a6;
    --tn-danger:  #c1554d;
    --tn-line:    rgba(208,183,135,0.22);
    --tn-radius:  12px;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    color: var(--tn-cream);
}

/* ---------- Layer ---------- */
#tnLayer { position: fixed; inset: 0; z-index: 9000; pointer-events: none; overflow: hidden; }
#tnLayer .tn-pin { pointer-events: auto; }

/* ---------- Place-mode ---------- */
#tnPlaceCatcher {
    position: fixed; inset: 0; z-index: 9500; cursor: crosshair;
    background: rgba(33,54,44,.18); pointer-events: auto;
}
#tnPlaceHint {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 9600;
    background: linear-gradient(180deg, var(--tn-gold), var(--tn-gold-d)); color: var(--tn-green);
    padding: 9px 18px; border-radius: 22px; font-size: 14px; font-weight: 700;
    pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.35);
    white-space: nowrap; max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- FAB — gold pill, bottom-center ----------
   Stays above the panel (z-index 9250 > panel 9200).
   On mobile when the panel is full-screen, JS hides the FAB via .tn-fab-hidden. */
#tnFab {
    position: fixed;
    bottom: calc(22px + env(safe-area-inset-bottom, 0px));
    left: 50%; top: auto;
    transform: translateX(-50%);
    z-index: 9250; pointer-events: auto;
    height: 46px; padding: 0 20px 0 16px; border-radius: 24px; cursor: pointer;
    background: linear-gradient(180deg, #e2cfa6 0%, var(--tn-gold) 55%, var(--tn-gold-d) 100%);
    color: var(--tn-green); border: 1px solid rgba(255,255,255,.4);
    display: flex; align-items: center; gap: 8px;
    font-family: inherit; font-size: 14.5px; font-weight: 700;
    box-shadow: 0 8px 22px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.5);
    transition: transform .2s ease, box-shadow .2s ease, opacity .2s ease;
    white-space: nowrap;
}
#tnFab:hover { transform: translateX(-50%) translateY(-2px); box-shadow: 0 11px 26px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.6); }
/* Hidden during the tour's loading screen; fades in once the skin appears. */
#tnFab.tn-fab-prep { opacity: 0 !important; pointer-events: none !important; }
#tnFab { transition: transform .15s ease, box-shadow .15s ease, opacity .45s ease; }
#tnFab.tn-fab-hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px); }

/* Follow mode: JS sets `left` inline to track the tour drawer's edge.
   The horizontal-center transform is dropped so `left` is the true edge. */
#tnFab.tn-fab-follow { transform: none; transition: left .12s linear, transform .15s ease, box-shadow .15s ease; }
#tnFab.tn-fab-follow:hover { transform: translateY(-2px); }
#tnFab.tn-fab-follow.tn-fab-hidden { transform: translateY(8px); }
#tnFab svg  { width: 18px; height: 18px; display: block; flex-shrink: 0; }
#tnFab .tn-fab-label { line-height: 1; padding-bottom: 1px; }
#tnFab .tn-badge {
    position: absolute; top: -7px; inset-inline-end: -7px;
    background: var(--tn-green); color: var(--tn-gold);
    border: 1.5px solid var(--tn-gold); font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

/* ---------- Pins ---------- */
.tn-pin {
    position: fixed; transform: translate(-50%,-50%); cursor: pointer; z-index: 9050;
    width: 30px; height: 30px; border-radius: 50% 50% 50% 0; rotate: -45deg;
    background: linear-gradient(180deg, #e2cfa6 0%, var(--tn-gold) 55%, var(--tn-gold-d) 100%);
    border: 2px solid var(--tn-cream); box-shadow: 0 3px 9px rgba(0,0,0,.5);
    display: flex; align-items: center; justify-content: center;
    color: var(--tn-green); font-size: 13px; font-weight: 800;
    touch-action: none;
}
.tn-pin > span { rotate: 45deg; }
.tn-pin.tn-resolved { opacity: .6; filter: grayscale(.3); }
.tn-pin.tn-selected { outline: 3px solid var(--tn-cream); outline-offset: 2px; }

/* ---------- Side panel ---------- */
#tnPanel {
    position: fixed; top: 0; bottom: 0; width: 360px; max-width: 88vw; z-index: 9200;
    background: var(--tn-green); pointer-events: auto;
    display: flex; flex-direction: column;
    box-shadow: 0 0 40px rgba(0,0,0,.55); transition: transform .25s ease;
}
.tn-ltr #tnPanel { right: 0; transform: translateX(100%);  border-inline-start: 1px solid var(--tn-line); }
.tn-rtl #tnPanel { left:  0; transform: translateX(-100%); border-inline-end:   1px solid var(--tn-line); }
#tnPanel.tn-open { transform: translateX(0); }

.tn-panel-head {
    padding: 12px 14px;
    background: var(--tn-green-d);
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    border-bottom: 1px solid var(--tn-line);
    padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.tn-panel-head h2 { margin: 0; font-size: 16px; flex: 1; color: var(--tn-gold); letter-spacing: .3px; min-width: 80px; }
.tn-panel-head .tn-user { font-size: 11px; color: var(--tn-muted); width: 100%; padding: 0 2px; order: 10; }

.tn-toolbar {
    padding: 8px 12px; display: flex; gap: 8px; flex-wrap: wrap;
    border-bottom: 1px solid var(--tn-line);
}
.tn-toolbar select {
    background: var(--tn-green-d); color: var(--tn-cream); border: 1px solid var(--tn-line);
    border-radius: 8px; padding: 7px 9px; font-size: 13px; flex-shrink: 0;
}
.tn-toolbar input[type=search] {
    flex: 1; min-width: 80px;
    background: var(--tn-green-d); color: var(--tn-cream); border: 1px solid var(--tn-line);
    border-radius: 8px; padding: 7px 9px; font-size: 13px;
}
/* "current room" toggle pill */
.tn-pano-toggle {
    width: 100%; display: flex; align-items: center; gap: 8px;
    font-size: 12px; color: var(--tn-muted); cursor: pointer; padding: 0 2px;
    user-select: none;
}
.tn-pano-toggle input { accent-color: var(--tn-gold); width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }
.tn-pano-toggle.active { color: var(--tn-gold); }

.tn-list { flex: 1; overflow-y: auto; padding: 8px; -webkit-overflow-scrolling: touch; }

/* Cards */
.tn-card {
    background: var(--tn-green-d); border-radius: var(--tn-radius); padding: 11px 13px; margin-bottom: 8px;
    cursor: pointer; border-inline-start: 4px solid var(--tn-gold); transition: background .12s;
    touch-action: manipulation;
}
.tn-card:hover, .tn-card:active { background: #1b2d24; }
.tn-card .tn-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; flex-wrap: wrap; }
.tn-card .tn-cat  { font-size: 11px; padding: 2px 9px; border-radius: 10px; background: rgba(208,183,135,.16); color: var(--tn-gold); }
.tn-card .tn-status { font-size: 11px; margin-inline-start: auto; font-weight: 700; }
.tn-card .tn-status.tn-open     { color: var(--tn-gold); }
.tn-card .tn-status.tn-resolved { color: #8fc7a6; }
.tn-card .tn-body { font-size: 13px; color: var(--tn-cream); white-space: pre-wrap; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tn-card .tn-meta { font-size: 11px; color: var(--tn-muted); margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.tn-empty { text-align: center; color: var(--tn-muted); padding: 30px 12px; font-size: 14px; }

/* ---------- Modals ---------- */
.tn-modal-bg {
    position: fixed; inset: 0; z-index: 9300; background: rgba(10,16,13,.65);
    display: flex; align-items: center; justify-content: center; pointer-events: auto;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}
.tn-modal {
    background: var(--tn-green); border: 1px solid var(--tn-line); border-radius: 16px;
    width: 440px; max-width: 100%;
    max-height: calc(100vh - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 32px);
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding: 20px; box-shadow: 0 16px 50px rgba(0,0,0,.6);
}
.tn-modal h3 { margin: 0; font-size: 17px; color: var(--tn-gold); }

.tn-field { margin-bottom: 12px; }
.tn-field label { display: block; font-size: 12px; color: var(--tn-muted); margin-bottom: 5px; }
.tn-field input, .tn-field select, .tn-field textarea {
    width: 100%; background: var(--tn-green-d); color: var(--tn-cream);
    border: 1px solid var(--tn-line); border-radius: 8px; padding: 10px; font-size: 16px;
    font-family: inherit; transition: border-color .15s;
    /* font-size 16px prevents iOS zoom-on-focus */
}
.tn-field input:focus, .tn-field textarea:focus, .tn-field select:focus {
    outline: none; border-color: var(--tn-gold);
}
.tn-field textarea { min-height: 84px; resize: vertical; }
.tn-row { display: flex; gap: 10px; }
.tn-row > * { flex: 1; min-width: 0; }
.tn-colors { display: flex; gap: 8px; flex-wrap: wrap; }
.tn-colors button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; touch-action: manipulation; }
.tn-colors button.tn-sel { border-color: var(--tn-cream); }

/* Buttons */
.tn-btn {
    background: linear-gradient(180deg, #e2cfa6, var(--tn-gold-d));
    color: var(--tn-green); border: none; border-radius: 9px;
    padding: 11px 16px; font-size: 14px; font-weight: 700;
    cursor: pointer; font-family: inherit;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.4);
    touch-action: manipulation; white-space: nowrap;
}
.tn-btn:hover, .tn-btn:active { filter: brightness(1.06); }
.tn-btn.tn-ghost  { background: transparent; border: 1px solid var(--tn-gold); color: var(--tn-gold); box-shadow: none; font-weight: 600; }
.tn-btn.tn-danger { background: var(--tn-danger); color: #fff; box-shadow: none; }
.tn-btn:disabled  { opacity: .5; cursor: default; }

.tn-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; flex-wrap: wrap; }
.tn-close { background: none; border: none; color: var(--tn-muted); font-size: 24px; cursor: pointer; line-height: 1; padding: 0 4px; touch-action: manipulation; }
.tn-close:hover { color: var(--tn-gold); }

/* ---------- Attachments & comments ---------- */
.tn-attach-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.tn-attach {
    position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden;
    background: var(--tn-green-d); display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--tn-gold); cursor: pointer;
}
.tn-attach img { width: 100%; height: 100%; object-fit: cover; }
.tn-attach .tn-x {
    position: absolute; top: 2px; inset-inline-end: 2px;
    background: rgba(0,0,0,.65); color: #fff; border: none; border-radius: 50%;
    width: 20px; height: 20px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.tn-comment { background: var(--tn-green-d); border-radius: 8px; padding: 9px 11px; margin-bottom: 6px; font-size: 13px; }
.tn-comment .tn-c-meta { font-size: 11px; color: var(--tn-gold-d); margin-bottom: 3px; }
.tn-rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--tn-danger); margin-inline-end: 6px; animation: tn-blink 1s infinite; }
@keyframes tn-blink { 50% { opacity: .2; } }

/* ---------- Toast ---------- */
.tn-toast {
    position: fixed; bottom: calc(90px + env(safe-area-inset-bottom,0px)); left: 50%;
    transform: translateX(-50%); z-index: 9700;
    background: var(--tn-green-d); color: var(--tn-cream); border: 1px solid var(--tn-gold);
    padding: 10px 18px; border-radius: 22px; font-size: 13px; white-space: nowrap;
    opacity: 0; transition: opacity .2s; pointer-events: none;
}
.tn-toast.tn-show { opacity: .97; }

/* ================================================================
   RESPONSIVE BREAKPOINTS
   ================================================================ */

/* --- Tablet (≤ 768px) --- */
@media (max-width: 768px) {
    #tnPanel { width: 320px; max-width: 90vw; }
    .tn-modal { padding: 16px; }
    .tn-modal h3 { font-size: 16px; }
    #tnFab { font-size: 14px; height: 44px; padding: 0 16px 0 13px; }
}

/* --- Mobile (≤ 480px) --- */
@media (max-width: 480px) {
    /* Panel goes nearly full-width; the tour still peeks 44px to the right as a hint */
    #tnPanel { width: 100vw; max-width: 100vw; }
    .tn-ltr #tnPanel { right: 0; }
    .tn-rtl #tnPanel { left:  0; }

    /* FAB slightly smaller on mobile */
    #tnFab { height: 42px; font-size: 13.5px; padding: 0 15px 0 12px; gap: 7px; }
    #tnFab svg { width: 16px; height: 16px; }

    /* Pin slightly larger tap target */
    .tn-pin { width: 34px; height: 34px; }

    /* Modal = bottom sheet feel */
    .tn-modal-bg { align-items: flex-end; padding: 0; }
    .tn-modal {
        width: 100vw; max-width: 100vw; border-radius: 18px 18px 0 0;
        max-height: 88vh; padding: 18px 16px;
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }

    /* Stack the row layout vertically on small screens */
    .tn-row { flex-direction: column; gap: 8px; }

    /* Actions: full-width buttons on mobile */
    .tn-actions { justify-content: stretch; }
    .tn-actions .tn-btn { flex: 1; text-align: center; padding: 12px 8px; }

    /* Toolbar: status select takes full row, search below */
    .tn-toolbar { gap: 6px; }
    .tn-toolbar select { flex: 1; }

    /* Card body: allow more lines */
    .tn-card .tn-body { -webkit-line-clamp: 4; }

    /* Attachments: bigger tap targets */
    .tn-attach { width: 72px; height: 72px; }

    /* Bump field font to 16px already set globally — keep zoom prevention */
}

/* --- Small phones (≤ 360px) --- */
@media (max-width: 360px) {
    #tnFab .tn-fab-label { display: none; } /* icon-only pill on very tiny screens */
    #tnFab { padding: 0 14px; width: 48px; border-radius: 50%; }
}

/* --- Landscape mobile --- */
@media (max-height: 500px) and (orientation: landscape) {
    #tnPanel { width: 300px; max-width: 85vw; }
    .tn-panel-head { padding: 8px 12px; }
    .tn-modal { max-height: calc(100vh - 20px); }
    .tn-modal-bg { align-items: center; padding: 10px; }
}
