/* =========================================================
   GLOBALES VOLLBILD LAYOUT
   ========================================================= */
.dashboard-container {
    position: relative;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

.dashboard-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    z-index: 1;
    background: transparent !important;
}

/* =========================================================
   SIDEBAR (EINKLAPPBAR)
   ========================================================= */
.dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    margin: 0;
    padding: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    transform: translateX(0);
    background-image: url('../../assets/fantasy/GUI/main.webp');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    background-color: #111;
    border-right: 2px solid var(--primary-dark);
    /* WICHTIG: overflow: visible erlaubt, dass der Button rechts herausragen kann */
    overflow: visible !important; 
}

.dashboard-sidebar.collapsed {
    transform: translateX(-100%);
}

/* Der Container für den scrollbaren Inhalt */
.sidebar-inner {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* DER PFEIL-BUTTON (Perfekt Rund, in der Mitte, ragt rechts raus) */
.dashboard-sidebar .sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -40px; 
    /* Erzwungene Maße, um Überschreibungen durch globale Button-Regeln zu verhindern */
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    background: var(--primary);
    color: #000;
    border: 2px solid #111;
    border-radius: 50% !important; 
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%); 
    box-shadow: 2px 0 5px rgba(0,0,0,0.5);
    z-index: 1001;
    transition: background 0.2s, transform 0.2s;
    box-sizing: border-box;
    flex-shrink: 0;
}

.dashboard-sidebar .sidebar-toggle-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

/* Sidebar Styling */
.dashboard-sidebar .sidebar-header,
.dashboard-sidebar .user-profile-box,
.dashboard-sidebar .resources-box,
.dashboard-sidebar .sidebar-bottom {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding-left: 20px;
    padding-right: 20px;
}

.sidebar-header {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.sidebar-title {
    color: var(--primary);
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 24px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.9);
}

.resources-box {
    margin-bottom: 20px;
}

.resource-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    text-shadow: 1px 1px 3px #000;
}

.res-label { font-weight: bold; }
.res-value { color: #fff; font-weight: bold; }
.res-gold { color: #ffd700; }
.res-holz { color: #95a5a6; }
.res-stein { color: #7f8c8d; }
.res-kristall { color: #3498db; }
.res-premium { color: #e74c3c; }

.sidebar-bottom {
    margin-top: auto;
    padding-bottom: 20px;
}

/* Diese Regel hat vorher den Toggle-Button verformt, wirkt jetzt aber nicht mehr auf ihn */
.dashboard-sidebar button {
    margin: 5px 20px;
    width: calc(100% - 40px);
}

.sidebar-bottom button {
    margin: 0;
    width: 100%;
}

/* =========================================================
   USER UI (OBEN LINKS)
   ========================================================= */
.top-left-ui {
    position: absolute;
    top: 20px;
    left: 270px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid var(--primary);
    border-radius: 10px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 140px;
    box-sizing: border-box;
    z-index: 900;
    transition: left 0.3s ease-in-out;
}

.dashboard-sidebar.collapsed ~ .top-left-ui {
    left: 45px;
}

.top-left-ui .avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    object-fit: cover;
    margin-bottom: 10px;
}

.top-left-ui .info {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
}

.top-left-ui .name-link {
    color: var(--primary);
    font-weight: bold;
    text-decoration: none;
    font-size: 15px;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 1px 1px 3px #000;
    word-break: break-all;
}

.top-left-ui .stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #ccc;
    width: 100%;
}

.top-left-ui .stats span {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 2px;
}

/* =========================================================
   EDIT BUTTON (OBEN RECHTS)
   ========================================================= */
.top-right-ui {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 900;
    display: none; 
}

.btn-edit-mode-round {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    transition: transform 0.2s;
    position: relative;
    color: transparent !important;
    font-size: 0 !important;
    overflow: hidden;
}

.btn-edit-mode-round::before {
    content: "🏰"; 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #000;
}

.btn-edit-mode-round:hover {
    transform: scale(1.1);
}

/* =========================================================
   HAUPTMENÜ (UNTEN RECHTS)
   ========================================================= */
.bottom-right-menu {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 15px;
    z-index: 900;
}

.menu-btn-round {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    position: relative;
}

.menu-btn-round:hover {
    transform: scale(1.1);
    background: var(--primary);
    color: #000;
}

.menu-btn-world {
    width: 70px;
    height: 70px;
    font-size: 32px;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.mail-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #e74c3c;
    border-radius: 50%;
    border: 2px solid #000;
    display: none;
}

.has-mail .mail-badge { display: block; }
.has-mail-wiggle { animation: wiggle 0.6s ease-in-out; }

/* =========================================================
   CHAT & TICKER (UNTEN LINKS)
   ========================================================= */
.floating-chat-container {
    position: absolute;
    bottom: 80px;
    left: 270px;
    width: 650px;
    height: 400px;
    min-width: 400px;
    min-height: 250px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid var(--primary);
    border-radius: 8px;
    z-index: 900;
    display: none;
    flex-direction: column;
    resize: both;
    overflow: hidden;
    transition: left 0.3s ease-in-out;
    box-shadow: 0 5px 20px rgba(0,0,0,0.8);
}

.dashboard-sidebar.collapsed ~ .floating-chat-container {
    left: 45px;
}

.floating-chat-container.active {
    display: flex;
}

.chat-ticker-line {
    position: absolute;
    bottom: 30px;
    left: 270px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    padding: 5px 15px;
    border-radius: 5px;
    pointer-events: none;
    font-size: 14px;
    z-index: 890;
    transition: left 0.3s ease-in-out;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
    text-shadow: 1px 1px 2px #000;
}

.dashboard-sidebar.collapsed ~ .chat-ticker-line {
    left: 45px;
}

/* =========================================================
   ORIGINAL CHAT HINTERGRUND-ÜBERSCHREIBUNGEN
   ========================================================= */
#city-chat-container {
    background-image: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.7)), url('../../assets/fantasy/GUI/main.webp') !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-color: #111 !important;
}

#city-chat-container > div,
#chat-messages,
#chat-header,
#chat-room-list,
#chat-messages > div {
    background: transparent !important;
    background-color: transparent !important;
}

#chat-messages > div > div:nth-child(2) {
    background: rgba(0, 0, 0, 0.6) !important;
    border-color: #555 !important;
}