/* FIX: Added position: relative to allow absolute positioning of children like the username and item wrapper */
.avatar-container {
    position: absolute; /* KORRIGERING: Ändra 'relative' till 'absolute' */
    text-align: center;
    width: 85px;
    height: 85px;
    cursor: pointer;
    overflow: visible;
    display: flex;
    justify-content: center;
    align-items: center;
}
    .avatar-container .avatar-image {
        position: relative;
        z-index: 10; /* Image should be under the item wrapper */
        display: block;
    }
    
    .avatar-container.avatar-shape-circle .avatar-image,
    .avatar-container.avatar-shape-square .avatar-image {
        width: 85px;
        height: 85px;
        border: 3px solid white;
        box-shadow: 0 4px 8px rgba(0,0,0,0.15);
        object-fit: cover;
    }
    
    .avatar-container.avatar-shape-circle .avatar-image {
        border-radius: 9999px;
		background-color: #f1eae1;
    }

    .avatar-container.avatar-shape-square .avatar-image {
        border-radius: 8px;
		background-color: #f1eae1;
    }
    
.avatar-container.avatar-shape-free {
    /* Låt containern anpassa sig efter bilden inuti */
    display: inline-flex;
    width: auto;
    height: auto;
    
    /* Behåll dessa från din ursprungliga kod */
    min-width: auto;
    max-width: 250px;
    max-height: 200px;
}

.avatar-container.avatar-shape-free .avatar-image {
    /* **DETTA ÄR DEN VIKTIGA FIXEN:**
    Vi sätter en FAST storlek på bild-elementet. Nu vet webbläsaren 
    alltid hur stor avataren är, även innan bilden har laddats ner.
    */
    width: 150px;
    height: 100px;
    
    /* Dessa regler ser till att bilden fortfarande ser bra ut inuti den fasta rutan */
    object-fit: contain;
    display: inline-flex;
    border: none;
    box-shadow: none;
    border-radius: 0;
    max-width: 150px;  /* Behåll max-värdena för konsistens */
    max-height: 100px;
}

.avatar-container .username {
    position: absolute; /* This positions the name tag relative to the avatar-container */
    bottom: -22px;     /* Standard vertical position below the avatar */
    left: 50%;         /* Horizontal centering */
    transform: translateX(-50%); /* Ensures perfect centering */
    
    font-size: 14px;
    font-weight: 600;
    color: white; /* Text color for normal names */
    background-color: rgba(0, 0, 0, 0.6); /* Solid background for normal names */
    padding: 2px 8px; 
    border-radius: 4px; 
    white-space: nowrap;
    z-index: 25;
    margin-top: 0; 
    
    /* Explicitly reset any inherited background-image or clip for the normal state */
    background-image: none; 
    background-clip: border-box; 
    -webkit-background-clip: border-box; 
    -webkit-text-fill-color: initial; 
}

    /* FIX: Define the wrapper for items to create the 'positioning box' */
    .equipped-items-wrapper {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 85px;  /* Standard avatar width */
        height: 85px; /* Standard avatar height */
        z-index: 11;  /* Position it on top of the avatar image */
        pointer-events: none; /* The wrapper itself should not be clickable */
    }

    /* FIX: Make sure items inside the wrapper are clickable */
    .equipped-item {
        position: absolute;
        filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
        pointer-events: auto; 
        object-fit: contain;
        /* The specific top/left/width/height are now applied inline by JS, relative to the 85x85 wrapper */
    }


   .item-context-menu {
        display: none;
        position: absolute;
        top: -1px;
        left: 100%;
        margin-left: -1px;
        background-color: white;
        border-radius: 0;
        border: 1px solid #ddd;
        box-shadow: 0 2px 10px rgba(0,0,0,0.2);
        z-index: 210; /* KORRIGERING: Ökat från 30 till 210 */
        padding: 2px 0;
        min-width: 100px;
    }
    .item-context-menu div {
        padding: 5px 10px;
        cursor: pointer;
        font-size: 12px;
        white-space: nowrap;
    }
.chat-bubble-container {
    position: absolute;
    /* ÄNDRA TILLBAKA TILL AUTO */
    width: auto;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    pointer-events: none;
    display: flex;
    justify-content: center;
}

.chat-bubble {
    position: relative;
    width: auto;
    background-color: #ffffff;
    border: 1px solid #c0c0c0;
    border-radius: 15px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 200px;
    min-width: 100px;
	width: max-content;
    font-size: 11px;
    color: #333;
    z-index: 100;
    text-align: left;
    white-space: normal;
    overflow-wrap: break-word;
    box-sizing: border-box;
    pointer-events: auto;
}

.chat-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

.chat-input-bubble-container {
    width: auto;
}

.chat-bubble::before {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 11px 11px 0 11px;
    border-style: solid;
    border-color: #c0c0c0 transparent transparent transparent;
}

/* ---- STILAR FÖR VÄNDA PRATBUBBLOR ---- */

/* Ny klass för bubblans BEHÅLLARE som flyttar den under avataren */
.chat-bubble-container.flipped {
    bottom: auto; /* Stäng av standardpositioneringen från botten */
    top: 90px;    /* Placera den istället 90px från toppen av avataren */
}

/* Anpassar pilen på den vanliga pratbubblan att peka uppåt */
.chat-bubble.flipped::after {
    bottom: auto;
    top: -10px;
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent #ffffff transparent;
}

.chat-bubble.flipped::before {
    bottom: auto;
    top: -11px;
    border-width: 0 11px 11px 11px;
    border-color: transparent transparent #c0c0c0 transparent;
}

/* Anpassar pilen på inbjudningsbubblan att peka uppåt */
.invite-bubble .chat-bubble.flipped::after {
    border-bottom-color: #BA55D3;
    border-top-color: transparent;
}

.invite-bubble .chat-bubble.flipped::before {
    border-bottom-color: #9932CC;
    border-top-color: transparent;
}



/* Anpassar pilen på inmatningsbubblan att peka uppåt */
.chat-input-bubble.flipped::after {
    bottom: auto;
    top: -10px;
    border-width: 0 10px 10px 10px;
    border-color: transparent transparent #ffffff transparent;
}
.chat-input-bubble.flipped::before {
    bottom: auto;
    top: -11px;
    border-width: 0 11px 11px 11px;
    border-color: transparent transparent #c0c0c0 transparent;
}


/* 2. Containern för inmatningsbubblan (positioneras helt av JS) */
.chat-input-bubble-container {
    position: absolute; /* Måste vara absolut för att placeras i chattrummet */
    z-index: 200;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

/* 3. Inmatningsbubblan (ser identisk ut som den vanliga) */
.chat-input-bubble {
    position: relative;
    background-color: #ffffff;
    border: 1px solid #c0c0c0;
    border-radius: 15px;
    padding: 8px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    min-width: 100px; /* Lite bredare för att rymma placeholder-text */
    max-width: 400px;
    pointer-events: auto;
    display: inline-block;
    transition: border-color 0.2s ease-in-out;
}


.chat-input-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 10px 10px 0 10px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    z-index: 1;
}

.chat-input-bubble::before {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 11px 11px 0 11px;
    border-style: solid;
    border-color: #c0c0c0 transparent transparent transparent;
    z-index: 0;
    transition: border-color 0.2s ease-in-out;
}


/* Textfältet inuti bubblan (oförändrat) */
#live-chat-input {
    background: transparent;
    border: none;
    outline: none;
    width: 160px;
    font-size: 11px;
    color: #333;
    resize: none;
    padding: 0;
    margin: 0;
    line-height: 1.4;
    overflow: hidden;
    font-family: inherit;
}
.z-icon { 
    position: absolute; 
    top: 50%; 
    left: 50%;
    /* Flytta upp halva höjden (42.5px) + 30px till. Flytta höger halva bredden (42.5px) - 10px */
    transform: translate(32.5px, -72.5px) rotate(-15deg);
    font-size: 30px; 
    font-weight: bold; 
    color: #888; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2); 
    z-index: 15; 
    display: none; 
}
.emote-display { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    /* Flytta upp halva avatarens höjd (42.5px) + 30px till. Flytta vänster halva bredden (42.5px) + 10px till */
    transform: translate(-52.5px, -72.5px); 
    font-size: 40px; 
    z-index: 17; 
    display: none; 
    pointer-events: none; 
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3); 
}
    .avatar-dropdown { position: absolute; background-color: #fff; border: 1px solid #ddd; border-radius: 0; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 200; top: 80px; left: 50%; transform: translateX(-50%); min-width: 100px; padding: 2px 0; display: none; list-style: none; margin: 0; }
    .avatar-dropdown li { padding: 5px 10px; cursor: pointer; font-size: 12px; color: #333; text-align: left; }
    .avatar-dropdown li:hover { background-color: #f0f0f0; }
    .avatar-dropdown li.has-submenu { position: relative; }
.items-submenu,
#emote-submenu {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: -1px;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    z-index: 21;
    min-width: 120px;
    padding: 2px 0;
    list-style: none;
}
    .items-submenu li { padding: 0; position: relative; }
    .items-submenu li > span { display: block; padding: 5px 10px; }
    .item-legendary { color: #ff8000; font-weight: bold; }
    .items-submenu li.active-item { background-color: #dbeafe; font-weight: bold; }
    .dropped-item-container {
        position: absolute;
        width: 60px;
        height: 60px;
        cursor: pointer;
        z-index: 15;
        filter: drop-shadow(2px 2px 3px rgba(0,0,0,0.3));
        border-radius: 5px;
        transform: none;
        box-shadow: none;
    }

    .dropped-item-container img { width: 100%; height: 100%; object-fit: fill; }
    .dropped-item-container.machine-item img, .dropped-item-container.midsummer-pole-machine-item img, .dropped-item-container.golden-record-player_machine-item img, .dropped-item-container.soda-machine-item img { object-fit: contain; }
    .dropped-item-context-menu, .machine-context-menu { display: none; position: absolute; background-color: #fff; border: 1px solid #ddd; border-radius: 0; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 4000; min-width: 120px; padding: 2px 0; list-style: none; margin: 0; }
    .dropped-item-context-menu li, .machine-context-menu li { padding: 5px 10px; cursor: default; font-size: 11px; color: #333; text-align: left; }
    .dropped-item-context-menu li[data-action], .machine-context-menu li[data-action] { cursor: pointer; }
    .dropped-item-context-menu li[data-action]:hover, .machine-context-menu li[data-action]:hover { background-color: #f0f0f0; }
    .dropped-item-context-menu .menu-title, .machine-context-menu .menu-title { font-weight: bold; padding: 5px 10px; border-bottom: 1px solid #eee; margin-bottom: 5px; color: #555; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
    .other-user-context-menu { display: none; position: absolute; background-color: #fff; border: 1px solid #ddd; border-radius: 0; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 200; min-width: 120px; padding: 2px 0; list-style: none; margin: 0; }
    .other-user-context-menu li { padding: 8px 12px; cursor: pointer; font-size: 12px; color: #333; text-align: left; }
    .other-user-context-menu li:hover { background-color: #f0f0f0; }
    .other-user-context-menu li.has-submenu { position: relative; }
    .other-user-context-menu li.has-submenu > span { display: block; }
    .other-user-context-menu .submenu { display: none; position: absolute; top: 0; left: 100%; margin-left: -1px; background-color: #fff; border: 1px solid #ddd; box-shadow: 0 4px 8px rgba(0,0,0,0.1); z-index: 201; min-width: 120px; padding: 2px 0; list-style: none; }
    .other-user-context-menu .menu-title { font-weight: bold; padding: 8px 12px; border-bottom: 1px solid #eee; margin-bottom: 5px; color: #555; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
    .dropped-item-context-menu { left: 25px; top: 45px; }
    .machine-context-menu { left: 115px; top: 155px; }
    #globalChatInputContainer { width: 1023px; margin-top: 15px; background-color: #f8f8f8; border: 1px solid #ddd; border-radius: 5px; padding: 10px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
    #globalChatInput { width: 100%; min-height: 40px; max-height: 120px; border: 1px solid #ccc; border-radius: 4px; padding: 8px 10px; font-size: 16px; box-sizing: border-box; resize: vertical; overflow-y: auto; }
    
    /* --- ICONS --- */
    #map-hotspot, #home-icon, #chathistory-icon, #prison-icon, #mapping-icon { 
        position: absolute; 
        width: 60px; 
        height: 60px; 
        cursor: pointer; 
        z-index: 20; 
        border-radius: 8px; 
        transition: transform 0.2s ease, opacity 0.2s ease, filter 0.2s ease; 
    }
    #map-hotspot:hover, #home-icon:hover, #chathistory-icon:hover, #prison-icon:hover, #mapping-icon:hover { 
        transform: scale(1.1); 
        opacity: 0.9; 
    }
    #map-hotspot { top: 10px; left: 10px; }
    #mapping-icon { top: 10px; left: 80px; }
    #home-icon { top: 80px; left: 10px; }
    #chathistory-icon { top: 150px; left: 10px; }
    #prison-icon { top: 220px; left: 10px; }

    .map-container, .chathistory-container { font-family: 'Press Start 2P', cursive; position: relative; width: 100%; max-width: 1000px; aspect-ratio: 16 / 9; background-size: cover; background-position: center; border: 4px solid #4a5b74; border-radius: 15px; box-shadow: 0 0 30px rgba(74, 169, 230, 0.4); overflow: hidden; }
    .map-container { background-image: url('shopbilder/karta.png'); }
    .chathistory-container { background-color: #2c3e50; display: flex; flex-direction: column; }
    .location-point { position: absolute; width: 30px; height: 30px; background-color: transparent; border: 3px solid #ff3333; cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; box-shadow: 0 0 10px rgba(255, 51, 51, 0.7); }
    .location-point:hover { transform: scale(1.3); box-shadow: 0 0 25px rgba(255, 100, 100, 1); z-index: 10; }
    .location-point::before { content: attr(data-title); position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, 0.8); color: #fff; padding: 5px 10px; border-radius: 5px; white-space: nowrap; opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0.2s ease; font-size: 12px; pointer-events: none; }
    .location-point:hover::before { opacity: 1; visibility: visible; }
    .modal-close-btn { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.5); color: white; border: 2px solid #fff; width: 35px; height: 35px; border-radius: 50%; font-size: 24px; font-family: sans-serif; line-height: 30px; text-align: center; cursor: pointer; z-index: 10; }
    .modal-close-btn:hover { background: rgba(255,255,255,0.2); }
    #chathistory-log { flex-grow: 1; overflow-y: auto; padding: 20px; color: #ecf0f1; font-family: 'Courier New', Courier, monospace; font-size: 14px; display: flex; flex-direction: column; }
    .history-entry { padding: 4px 8px; border-radius: 4px; margin-bottom: 4px; max-width: 95%; word-wrap: break-word; }
    .history-entry:nth-child(even) { background-color: rgba(255, 255, 255, 0.05); }
    .history-timestamp { color: #95a5a6; margin-right: 10px; }
    .history-username { font-weight: bold; margin-right: 5px; }
    .admin-role { color: #e74c3c; }
    .moderator-role { color: #3498db; }
    .user-role { color: #f1c40f; }
    #global-notice-bubble { position: absolute; top: 65px; left: 25px; background-color: #fff8e1; border: 1px solid #ffc107; border-radius: 15px; padding: 8px 12px; box-shadow: 0 2px 5px rgba(0,0,0,0.15); max-width: 300px; word-wrap: break-word; font-size: 14px; font-style: italic; color: #5d4037; z-index: 100; pointer-events: none; text-align: center; }
    #global-notice-bubble::after { content: ''; position: absolute; top: -10px; left: 20px; border-width: 0 10px 10px 10px; border-style: solid; border-color: transparent transparent #fff8e1 transparent; z-index: 10; }
    #global-notice-bubble::before { content: ''; position: absolute; top: -11px; left: 19px; border-width: 0 11px 11px 11px; border-style: solid; border-color: transparent transparent #ffc107 transparent; z-index: 9; }
    
    
/* --- HOTSPOT AND MAPPING STYLES --- */
#mapping-icon.active {
    filter: brightness(1.2) drop-shadow(0 0 8px #2dd4bf);
    border: 2px solid #2dd4bf;
}

#hotspot-selection-box {
    position: absolute;
    border: 2px dashed #14b8a6;
    background-color: rgba(45, 212, 191, 0.2);
    z-index: 99;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 15px rgba(45, 212, 191, 0.5);
}

.dynamic-hotspot {
    /* For debugging, you can uncomment these lines to see the hotspot areas */
    /* background-color: rgba(255, 255, 0, 0.2); */
    /* border: 1px dashed yellow; */
}

/* --- New Item Positioning Modal Styles --- */
#item-positioning-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    padding: 20px;
    box-sizing: border-box;
}

#item-positioning-modal .bg-white {
    position: relative;
    z-index: 10001;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    max-width: 48rem;
    width: 100%;
    box-sizing: border-box;
}

#avatar-preview-area {
    width: 85px;
    height: 85px;
    background-color: #f0f0f0;
    align-items: center;
    justify-content: center;
    position: relative;
    margin: 0 auto;
    border-radius: 9999px;
    border: 3px solid #4F46E5;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

#avatar-preview-img {
    width: 85px;
    height: 85px;
    object-fit: cover;
    border-radius: 9999px;
}

.equipped-item-preview {
    position: absolute;
    object-fit: fill;
    cursor: grab;
    z-index: 10;
    filter: drop_shadow(2px 2px 3px rgba(0,0,0,0.3));
}

#room-flash-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: white;
    opacity: 0;
    z-index: 3999;
    pointer-events: none; 
}

/* --- STILAR FÖR INBJUDNINGSBUBBLA --- */

/* Detta riktar in sig specifikt på inbjudningsbubblan */
.invite-bubble .chat-bubble {
    background-color: #BA55D3; /* Din önskade lila färg */
    color: #FFFFFF; /* Vit text för bra kontrast */
    border: 1px solid #9932CC; /* En lite mörkare lila kant */
    text-align: center;
}

/* Uppdaterar färgen på den lilla pilen under bubblan */
.invite-bubble .chat-bubble::after {
    border-top-color: #BA55D3;
	
}

/* Uppdaterar färgen på pilens kant */
.invite-bubble .chat-bubble::before {
    border-top-color: #9932CC;
}

/* Behållare för knapparna */
.invite-actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-around; /* Sprider ut knapparna jämnt */
    gap: 10px; /* Lite utrymme mellan knapparna */
}

/* Gemensam stil för båda knapparna */
.invite-button {
    border: none;
    border-radius: 5px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: transform 0.1s ease, filter 0.1s ease;
}

.invite-button:hover {
    transform: scale(1.05); /* Ger en liten förstoringseffekt */
    filter: brightness(1.1); /* Gör knappen lite ljusare */
}

/* Specifik stil för "Accept"-knappen */
.invite-button.accept {
    background-color: #4CAF50; /* Grön färg */
}

/* Specifik stil för "Decline"-knappen */
.invite-button.decline {
    background-color: #f44336; /* Röd färg */
}

.equipped-item-preview:active {
    cursor: grabbing;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    background: #d3d3d3;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 5px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #4F46E5;
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #4F46E5;
    cursor: pointer;
    border-radius: 50%;
}

#item-positioning-modal .bg-white {
    max-width: none !important;
    width: auto !important;
}

#full-room-preview-area {
    width: 1023px !important;
    height: 504px !important;
}

.avatar-image,
.avatar-container,
.equipped-items-wrapper,
.equipped-item,
#preview-area-avatar,
#draggable-item-preview {
    box-sizing: border-box;
}

/* ---- NYA STILAR FÖR MENY OCH LAYOUT ---- */
.starworld-container {
    display: flex;
    gap: 15px; /* Lite utrymme mellan menyn och chatten */
}

#starworld-left-menu {
    width: 200px;
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 544px; /* Justerad för att matcha chatt + input-fältet */
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.menu-profile-section {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #dee2e6;
}
#menu-profile-pic {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#menu-username {
    font-weight: 600;
    color: #343a40;
    font-size: 16px;
    word-break: break-all;
}
.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.menu-item {
    padding: 10px 12px;
    border-radius: 5px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s, color 0.2s;
    cursor: pointer;
}
.menu-item:hover {
    background-color: #e9ecef;
    color: #000;
}
.menu-item i {
    width: 20px;
    text-align: center;
}

/* --- STILAR FÖR TRADE-MODAL --- */

.trade-slot {
    width: 100%;
    height: 100%;
    background-color: #e5e7eb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.trade-slot img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

#trade-inventory-list .inventory-item {
    background-color: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 90px;
}

#trade-inventory-list .inventory-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 8px rgba(0,0,0,0.15);
}

#trade-inventory-list .inventory-item img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

#trade-inventory-list .inventory-item span {
    font-size: 10px;
    text-align: center;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
}

/* Stilar för när en användare har låst sitt bud */
.trade-locked #my-trade-offer,
.trade-locked #trade-inventory-list {
    opacity: 0.6;
    pointer-events: none;
}

.trade-locked #my-trade-status {
    color: #16a34a; /* Grön */
}

.trade-locked #lock-trade-btn {
    background-color: #9ca3af;
    cursor: not-allowed;
}

#their-trade-offer.trade-locked {
    border: 2px solid #16a34a;
    box-shadow: 0 0 10px #16a34a80;
}

#their-trade-status.trade-locked {
    color: #16a34a; /* Grön */
}

#globalChatInputContainer {
    display: none !important; /* Dölj den gamla input-rutan permanent */
}

.location-point {
    /* Behållna stilar för positionering på kartan */
    position: absolute;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 0 10px rgba(255, 51, 51, 0.7);
    border: 3px solid #ff3333;

    /* Justerad storlek och form */
    width: 32px;
    height: 32px;
    border-radius: 6px;
    box-sizing: border-box;

    /* Flexbox-regler är borttagna för att tillåta absolut positionering av barn-element (prickarna) */
}

.location-point:hover {
    transform: scale(1.3);
    box-shadow: 0 0 25px rgba(255, 100, 100, 1);
    z-index: 10;
}

.location-point::before {
    content: attr(data-title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    font-size: 12px;
    pointer-events: none;
}

.location-point:hover::before {
    opacity: 1;
    visibility: visible;
}

.user-dot {
    /* Huvudförändringen: Pricken positioneras nu absolut inuti sin förälder (.location-point) */
    position: absolute;
    width: 7px;
    height: 7px;
    background-color: #f87171;
    border-radius: 50%;
    border: 1px solid white;
    box-shadow: 0 0 5px rgba(248, 113, 113, 0.7);
    /* Lägger till en mjuk övergång om positionerna skulle uppdateras */
    transition: top 0.3s ease, left 0.3s ease;
}

/* --- NY CSS FÖR KLANSÖKNING NOTIFIKATION --- */
@keyframes shimmering-gold {
    0% {
        color: #b48700;
        text-shadow: 0 0 4px #ffd700, 0 0 10px #ffec8b;
    }
    50% {
        color: #ffeca0;
        text-shadow: 0 0 8px #ffd700, 0 0 15px #ffec8b, 0 0 25px #fff;
    }
    100% {
        color: #b48700;
        text-shadow: 0 0 4px #ffd700, 0 0 10px #ffec8b;
    }
}

.menu-item.has-pending-applications {
    background-color: #fffbe6; /* Ljus gul bakgrund */
    border: 1px solid #fde68a;
    animation: shimmering-gold 2s infinite ease-in-out;
}

.menu-item.has-pending-applications i {
    color: #daa520; /* Mörkare guld för ikonen */
}

.avatar-container .username.golden-name {
    /* The positioning properties are handled by the .username rule above, so remove them here if they exist */
    /* position: relative; */
    /* z-index: 26; */

    /* Text appearance: Set to white */
    /* background-image: linear-gradient(120deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C); */ /* Kommentera ut/ta bort */
    /* background-clip: text; */ /* Kommentera ut/ta bort */
    /* -webkit-background-clip: text; */ /* Kommentera ut/ta bort */
    /* -webkit-text-fill-color: transparent; */ /* Kommentera ut/ta bort */
    color: white; /* Ställ in textfärgen till vit */

    /* Keep golden specific text styling */
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);

    /* Ensure padding is consistent with the normal badge */
    padding: 1px 8px; 

    /* The actual element's background color needs to be transparent so the ::before can show through */
    background-color: transparent !important; 

    /* Remove any border or box-shadow from this element; they go on ::before */
    border: none;
    box-shadow: none;
}

/* The ::before pseudo-element now creates the solid black background and golden border */
.avatar-container .username.golden-name::before {
    content: ''; /* Required for pseudo-elements */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    
    background-color: #000; /* Solid black background for the pseudo-element */
    border: 1px solid #c8a858; /* Golden border */
    border-radius: 4px; /* Matching border-radius */
    box-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Matching box-shadow */
    
    z-index: -1; /* Place it behind the actual text content */
    
    /* This negative margin compensates for the parent's padding, making the ::before element cover the entire badge area */
    margin: -2px -8px; /* Adjust based on the parent's padding */

    /* Apply shine animation to the background */
    animation: golden-shine 15s infinite ease-in-out;
	animation-direction: normal;
    background-image: linear-gradient(120deg, #BF953F, #FCF6BA, #B38728, #FBF5B7, #AA771C); 
    background-size: 600% 100%; 
}

@keyframes golden-shine {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}