/* Global Styles */
body {
    margin: 0;
    padding: 0;
    background-color: #191F2D;
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

#app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* ============================================
   VIEWER SCREEN (in-world view)
   ============================================ */
#viewer-screen {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#render-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1; /* Behind UI elements */
}

/* UI Overlay Elements */
.ui-bar {
    position: absolute;
    left: 0;
    width: 100%;
    background: rgba(25, 31, 45, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    pointer-events: auto;
}

#top-bar {
    top: 0;
    height: 28px;
    justify-content: flex-start;
    /* Left-aligned like Wolfstorm */
    font-size: 12px;
    z-index: 10001;
}

.top-menu-item {
    padding: 0 12px;
    /* Slightly more padding for better spacing */
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
}

.top-menu-item:hover {
    background: rgba(100, 150, 255, 0.2);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.top-info-panel {
    position: absolute;
    right: 10px;
    top: 0;
    height: 100%;
    display: flex;
    gap: 12px;
    align-items: center;
    white-space: nowrap;
    z-index: 2;
    pointer-events: auto;
}

#currency {
    color: #7fbf7f;
    font-weight: bold;
    font-size: 13px;
    cursor: default;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid rgba(127, 191, 127, 0.3);
}

#buy-currency {
    color: #d35400;
    cursor: pointer;
    font-size: 11px;
}

#bottom-bar {
    bottom: 0;
    height: 48px;
    justify-content: center;
    gap: 5px;
    background: rgba(25, 31, 45, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.bottom-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 100%;
    cursor: pointer;
    color: #ccc;
    font-size: 10px;
}

.bottom-btn:hover {
    background: rgba(100, 150, 255, 0.25);
    backdrop-filter: blur(10px);
    color: white;
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

.bottom-btn .material-icons {
    font-size: 20px;
    margin-bottom: 2px;
}

#status-bar {
    position: absolute;
    top: 30px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    padding: 5px;
    border-radius: 4px;
    font-size: 10px;
    color: #0f0;
    pointer-events: none;
}

#build-version {
    position: fixed;
    right: 12px;
    bottom: 10px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #9bdc8b;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    z-index: 1200;
    pointer-events: none;
}

#location-bar {
    position: absolute;
    top: 32px;
    left: 10px;
    right: 10px;
    height: 38px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    border-radius: 8px;
    background: rgba(20, 20, 30, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    color: #f0f0f0;
    font-size: 13px;
    z-index: 900;
}

.location-bar__left {
    display: flex;
    flex-direction: column;
    min-width: 160px;
}

.location-bar__region {
    font-weight: 600;
    color: #56aaff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-bar__coords {
    font-size: 11px;
    color: #9bdc8b;
}

.location-bar__center {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid #333;
    border-radius: 4px;
    padding: 4px 8px;
}

.location-bar__icons {
    display: none;
    gap: 4px;
    align-items: center;
}

.parcel-icon {
    width: 16px;
    height: 16px;
    background-color: #ffb347;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #111;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.parcel-icon-voice {
    background-color: #4cd3ff;
}

.parcel-icon-no-voice {
    background-color: #1f4854;
    color: #f4f4f4;
}

.parcel-icon-damage {
    background-color: #ff5c5c;
}

.parcel-icon-scripts {
    background-color: #c17dff;
}

.parcel-icon-scripts-group {
    background-color: #8e44ad;
    color: #fff;
}

.parcel-icon-scripts-off {
    background-color: #4a235a;
    color: #fff;
}

.parcel-icon-no-fly {
    background-color: #95a5a6;
}

.parcel-icon-no-push {
    background-color: #ff9ff3;
}

.parcel-icon-sound-local {
    background-color: #b3bec4;
}

.parcel-icon-no-object-entry {
    background-color: #c0392b;
    color: #fff;
}

.parcel-icon-group-entry {
    background-color: #d35400;
    color: #fff;
}

.parcel-icon-restricted {
    background-color: #f5c518;
}

.parcel-icon-pass {
    background-color: #3498db;
    color: #fff;
}

.parcel-icon-for-sale {
    background-color: #2ecc71;
}

.location-bar__input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.location-bar__clear,
.location-bar__history {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #ddd;
    width: 26px;
    height: 26px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 0;
}

.location-bar__clear:hover,
.location-bar__history:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.location-bar__history.has-history {
    color: #ffb347;
}

.location-bar__right {
    min-width: 140px;
    text-align: right;
    font-size: 12px;
    color: #ddd;
}

.location-bar__status[data-level="warn"] {
    color: #ffcc66;
}

.location-bar__status[data-level="error"] {
    color: #ff6b6b;
}

.location-bar-history {
    position: absolute;
    min-width: 220px;
    max-width: 320px;
    max-height: 220px;
    overflow-y: auto;
    background: rgba(15, 15, 15, 0.95);
    border: 1px solid #555;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    z-index: 1200;
}

.location-bar-history__item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    color: #f0f0f0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.location-bar-history__item:last-child {
    border-bottom: none;
}

.location-bar-history__item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Floaters */
#floater-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floater {
    position: absolute;
    background: rgba(25, 25, 35, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    min-width: 200px;
    min-height: 150px;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
}

.floater-header {
    height: 28px;
    background: rgba(40, 40, 50, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    cursor: move;
    user-select: none;
}

.floater-title {
    font-size: 12px;
    font-weight: bold;
    color: #ddd;
}

.floater-controls {
    display: flex;
    gap: 5px;
}

.floater-btn {
    width: 16px;
    height: 16px;
    background-color: #555;
    border: 1px solid #000;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 10px;
    cursor: pointer;
}

.floater-btn:hover {
    background: rgba(100, 150, 255, 0.3);
    transform: scale(1.1);
    transition: all 0.2s ease;
}

.floater-btn.close:hover {
    background: rgba(255, 60, 60, 0.8);
    box-shadow: 0 0 10px rgba(255, 60, 60, 0.6);
}

.floater-content {
    flex: 1;
    padding: 10px;
    overflow: auto;
    font-size: 12px;
}

/* Resize grip. The markup has existed since the class was written, but the only rule for it
   anywhere was a mobile media query HIDING it — so on desktop it was a 0x0 invisible div and no
   floater using this class could be resized at all. Two diagonal strokes, the conventional
   affordance, matching Firestorm's bottom-right corner grip. */
.floater-resize-handle {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    border-bottom-right-radius: 12px;
    background-image:
        linear-gradient(315deg, transparent 0 4px, rgba(255, 255, 255, 0.45) 4px 5px, transparent 5px 8px,
                        rgba(255, 255, 255, 0.45) 8px 9px, transparent 9px);
    z-index: 2;
}

.floater-resize-handle:hover {
    background-color: rgba(100, 150, 255, 0.25);
}

/* Minimap — the markup had no styles at all, so the canvas sat at its fixed 256x256 attribute
   size and resizing the floater changed nothing visible. Fill the content box instead; the
   canvas backing store follows via a ResizeObserver in minimap.js. */
#minimap-floater .floater-content {
    display: flex;
    padding: 8px;
    overflow: hidden;
}

#minimap-floater .minimap-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    min-height: 0;   /* lets the canvas shrink instead of forcing the floater open */
}

#minimap-floater .minimap-toolbar {
    display: flex;
    gap: 4px;
    flex: 0 0 auto;
}

#minimap-floater .minimap-toolbar button {
    padding: 2px 8px;
    font-size: 11px;
    color: #ddd;
    background: rgba(60, 60, 75, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    cursor: pointer;
}

#minimap-floater .minimap-toolbar button:hover {
    background: rgba(100, 150, 255, 0.3);
}

#minimap-floater .minimap-canvas {
    flex: 1;
    display: block;
    width: 100%;
    min-height: 0;
    background: #00122e;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
}

#minimap-floater .minimap-footer {
    flex: 0 0 auto;
    font-size: 11px;
    color: #aaa;
}

/* Context Menu */
.context-menu {
    position: absolute;
    background-color: #2d2d2d;
    border: 1px solid #555;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
    min-width: 150px;
    z-index: 1000;
    padding: 2px 0;
}

.context-menu-header {
    padding: 5px 10px;
    background-color: #444;
    font-weight: bold;
    font-size: 12px;
    border-bottom: 1px solid #555;
    color: #fff;
}

.context-menu-item {
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    color: #ddd;
}

.context-menu-item:hover {
    background-color: #d35400;
    color: white;
}

/* Keyboard users must see where they are: the menu is arrow-navigable. */
.context-menu-item:focus-visible {
    background-color: #d35400;
    color: #fff;
    outline: 2px solid #5dade2;
    outline-offset: -2px;
}

/* #999 on #2d2d2d is 4.8:1 — dimmer than the live #ddd but still readable, so the
   reason a command is unavailable can be read rather than guessed at. */
.context-menu-item[aria-disabled="true"] {
    color: #999;
    cursor: default;
}

.context-menu-item[aria-disabled="true"]:hover {
    background-color: transparent;
    color: #999;
}

/* Tab System */
.tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tabs {
    display: flex;
    border-bottom: 1px solid #555;
    background-color: #333;
}

.tab {
    padding: 5px 10px;
    cursor: pointer;
    background: none;
    border: none;
    color: #aaa;
    border-right: 1px solid #444;
}

.tab:hover {
    background-color: #444;
    color: #fff;
}

.tab.active {
    background-color: #555;
    color: #fff;
    font-weight: bold;
}

.tab-content {
    flex: 1;
    padding: 10px;
    overflow: auto;
    background-color: #222;
}

/* List View */
.list-view {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-view li {
    padding: 5px;
    border-bottom: 1px solid #333;
    cursor: pointer;
}

.list-view li:hover {
    background-color: #333;
}

/* Build Tools */
.build-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-row {
    display: flex;
    gap: 5px;
}

.tool-row button {
    flex: 1;
    padding: 5px;
    background-color: #444;
    border: 1px solid #222;
    color: #ddd;
    cursor: pointer;
}

.tool-row button:hover {
    background-color: #555;
}

.tool-params label {
    display: block;
    margin-bottom: 5px;
    font-size: 11px;
}

.tool-params input {
    width: 100%;
    background-color: #111;
    border: 1px solid #444;
    color: #ddd;
    padding: 2px;
}

/* Search Panel */
.search-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-results {
    flex: 1;
    margin-top: 10px;
    border: 1px solid #444;
    background-color: #111;
    padding: 5px;
    overflow: auto;
}

/* Chat History */
.chat-line {
    margin-bottom: 2px;
    font-size: 11px;
    word-wrap: break-word;
}

.chat-time {
    color: #888;
}

.chat-name {
    font-weight: bold;
    color: #ddd;
    cursor: pointer;
}

.chat-text {
    color: #eee;
}

/* IM Window */
.im-window {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.im-history {
    flex: 1;
    background-color: #111;
    padding: 5px;
    overflow-y: auto;
    font-size: 11px;
}

.im-input-area {
    display: flex;
    gap: 5px;
    padding-top: 5px;
}

.im-message {
    margin-bottom: 2px;
}

/* Inventory Tree */
.inventory-tree-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #1a1a1a;
    padding: 4px 0;
    display: block !important; /* Override Tailwind flex */
}

.ll-tree-view {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important; /* Override Tailwind flex */
    flex-direction: column !important; /* Ensure vertical layout */
}

.ll-tree-item {
    margin: 0 !important;
    /* [FIX 2026-08-09] Reset top/right/bottom only — do NOT override padding-left. The tree's
       per-depth indentation is applied as an inline `padding-left` on each row
       (floater_inventory.js renderFolder/renderItem). The old `padding: 0 !important` beat that
       inline style, so every row rendered flush-left and the whole tree looked top-level. */
    padding-top: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
    display: block !important; /* Override Tailwind flex */
    width: 100% !important; /* Full width */
    box-sizing: border-box !important;
}

.ll-tree-folder-header {
    transition: background-color 0.15s;
}

.ll-tree-folder-header:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.ll-tree-children {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    display: block !important; /* Override Tailwind flex */
    /* Indentation is handled by paddingLeft on .ll-tree-item, not here */
}

.ll-tree-item-row {
    transition: background-color 0.15s;
}

.ll-tree-item-row:hover {
    background-color: rgba(255, 255, 255, 0.08) !important;
}

.inventory-loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Legacy styles for compatibility */
.inventory-tree,
.folder-children {
    list-style: none;
    padding-left: 15px;
    margin: 0;
}

.inventory-folder {
    margin-bottom: 2px;
}

.folder-header {
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 2px 0;
}

.folder-header:hover {
    background-color: #333;
}

.folder-icon {
    font-size: 16px;
    margin-right: 5px;
    color: #e67e22;
}

.folder-children {
    display: none;
}

.inventory-folder.expanded>.folder-children {
    display: block;
}

.inventory-item {
    padding: 2px 0;
    padding-left: 20px;
}

.item-row {
    display: flex;
    align-items: center;
}

.item-row:hover {
    background-color: #333;
}

.item-icon {
    font-size: 14px;
    margin-right: 5px;
    color: #ccc;
}

.item-actions {
    margin-left: auto;
    display: none;
}

.item-row:hover .item-actions {
    display: block;
}

.inv-btn {
    font-size: 9px;
    padding: 1px 3px;
    margin-left: 2px;
    background-color: #444;
    border: 1px solid #222;
    color: #ddd;
    cursor: pointer;
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

/* Tablets and smaller */
@media (max-width: 1024px) {
    #top-bar {
        font-size: 11px;
    }
    
    .top-menu-item {
        padding: 0 8px;
    }
    
    #bottom-bar {
        height: 56px;
        gap: 3px;
    }
    
    .bottom-btn {
        width: 50px;
        font-size: 9px;
    }
    
    .llfloater {
        max-width: 90vw !important;
    }
}

/* Mobile phones */
@media (max-width: 768px) {
    body {
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    #top-bar {
        height: 40px;
        font-size: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    #top-bar::-webkit-scrollbar {
        display: none;
    }
    
    .top-menu-item {
        padding: 0 10px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    #bottom-bar {
        height: 65px;
        flex-wrap: wrap;
        padding: 5px;
        gap: 2px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .bottom-btn {
        width: 45px;
        height: 45px;
        font-size: 8px;
        flex-shrink: 0;
    }
    
    .bottom-btn .icon {
        font-size: 18px;
    }
    
    /* Floaters take full screen on mobile */
    .llfloater {
        position: fixed !important;
        top: 40px !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 65px !important;
        width: 100% !important;
        height: auto !important;
        max-width: 100% !important;
        max-height: none !important;
        border-radius: 0;
        margin: 0;
    }
    
    .llfloater-maximized {
        top: 40px !important;
        bottom: 65px !important;
    }
    
    /* Hide resize handle on mobile */
    .floater-resize-handle {
        display: none !important;
    }
    
    /* Touch-friendly buttons */
    .toolbar-btn,
    .btn,
    button {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    /* Prevent accidental pinch zoom */
    #render-canvas {
        touch-action: pan-x pan-y;
    }
}

/* Small phones */
@media (max-width: 480px) {
    #top-bar {
        height: 36px;
        font-size: 9px;
    }
    
    .top-menu-item {
        padding: 0 8px;
    }
    
    #bottom-bar {
        height: 70px;
        justify-content: flex-start;
    }
    
    .bottom-btn {
        width: 40px;
        height: 40px;
        font-size: 7px;
    }
    
    .bottom-btn .icon {
        font-size: 16px;
    }
    
    .llfloater {
        top: 36px !important;
        bottom: 70px !important;
    }
    
    .floater-header {
        height: 36px;
        font-size: 12px;
    }
    
    .floater-title {
        font-size: 12px;
    }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
    #bottom-bar {
        height: 50px;
    }
    
    .bottom-btn {
        width: 40px;
        height: 40px;
    }
    
    .llfloater {
        top: 36px !important;
        bottom: 50px !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .icon,
    .bottom-btn .icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}
/* ── Landmark star in the location bar ──────────────────────────────────────────
   Firestorm: mAddLandmarkBtn lives inside the location input
   (lllocationinputctrl.cpp:292). It is ALWAYS clickable — enableAddLandmarkButton
   only swaps the image between "landmark exists" and "no landmark"
   (lllocationinputctrl.cpp:1160-1169), so this must never be styled as disabled.
   ★ = a landmark for this parcel exists (click edits it)
   ☆ = none yet (click creates one) */
.landmark-star {
    background: none;
    border: none;
    padding: 0 2px;
    margin: 0;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    /* Contrast: #9aa8bd on the bar's rgba(15,25,40,0.98) is ~7.2:1, and the lit
       #ffcc55 is ~10.5:1 — both clear of the 4.5:1 minimum in either theme. */
    color: #9aa8bd;
    transition: color 0.12s ease, transform 0.12s ease;
}
.landmark-star:hover { color: #ffdd77; transform: scale(1.15); }
.landmark-star:focus-visible {
    outline: 2px solid #6af;
    outline-offset: 2px;
    border-radius: 3px;
}
/* Landmark already exists for this parcel — Firestorm's mLandmarkImageOn state. */
.landmark-star.has-landmark { color: #ffcc55; }
