/* ── Reset ── */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Base ── */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    font-family: 'Segoe UI', sans-serif;
    color: var(--color-text);
    gap: 2rem;
}

h1 {
    color: var(--color-primary);
}

p {
    color: var(--color-muted);
    font-size: 1rem;
}

/* ── Card ── */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    gap: 0;
}

.card h1 {
    text-align: center;
    font-size: 1.6rem;
    margin-bottom: 0.25rem;
}

.subtitle {
    text-align: center;
    font-size: 0.85rem;
    color: var(--color-muted);
    margin-bottom: 2rem;
}

/* ── Form elements ── */
label {
    display: block;
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 0.3rem;
    margin-top: 1rem;
}

input {
    width: 100%;
    padding: 0.65rem 0.9rem;
    border: 1px solid var(--color-secondary);
    border-radius: 6px;
    background: var(--color-secondary);
    color: var(--color-text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--color-primary);
}

/* ── Buttons ── */
button, .btn {
    display: inline-block;
    padding: 0.75rem 2.5rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s;
}

button:hover:not(:disabled), .btn:hover {
    background: #c73652;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button.full-width {
    width: 100%;
    margin-top: 1.75rem;
    padding: 0.75rem;
}

button.secondary {
    background: var(--color-secondary);
    font-weight: normal;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    width: auto;
    margin-top: 0.5rem;
}

button.secondary:hover {
    background: #1a4a8a;
}

/* ── Messages ── */
.message {
    margin-top: 1.25rem;
    padding: 0.65rem 0.9rem;
    border-radius: 6px;
    font-size: 0.85rem;
    display: none;
    word-break: break-all;
}

.message.error {
    background: #3d0f1a;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
}

.message.warning {
    background: #3a2c0a;
    border: 2px solid #f5c518;
    color: #f5c518;
}

.message.success {
    background: #0f3d1a;
    border: 1px solid var(--color-success);
    color: var(--color-success);
}

/* ── App layout ── */
body.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background: var(--color-bg);
    padding: 1.5rem 1.5rem 0;
    gap: 0;
}

.app-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    gap: 1.5rem;
    align-items: stretch;
    padding-bottom: 1.5rem;
    width: 100%;
    max-width: calc(240px + 1.5rem + 93.75rem);
    margin-left: auto;
    margin-right: auto;
}

.main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.content { padding: 2rem 1.5rem; flex: 1; }

/* ── Sidebar ── */
.sidebar-wrapper {
    width: 240px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-self: stretch;
    gap: 0.75rem;
    z-index: 10;
    transition: transform 0.25s ease;
}

.sidebar {
    flex: 1;
    min-height: 0;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-scroll-area {
    flex: 1;
    overflow-y: auto;
}

.sidebar-logo-area {
    padding: 1rem 1rem 0.5rem;
    flex-shrink: 0;
}

.sidebar-logo-area a { display: block; line-height: 0; }

.sidebar-logo-area img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar-desktop-profile { flex-shrink: 0; padding: 0.25rem 0; }

.sidebar-desktop-profile a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-desktop-profile a:hover {
    background: var(--color-secondary);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.sidebar-desktop-profile .icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.social-sidebar-logo-area {
    padding: 1rem 1rem 0.5rem;
    flex-shrink: 0;
}

.social-sidebar-logo-area img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.sidebar-mobile-only { display: none; }

.sidebar ul { list-style: none; padding: 0.5rem 0; }

.sidebar ul li a,
.sidebar-footer ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar ul li a:hover,
.sidebar ul li a.active,
.sidebar-footer ul li a:hover,
.sidebar-footer ul li a.active {
    background: var(--color-secondary);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.sidebar ul li a .icon,
.sidebar-footer ul li a .icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.sidebar-profile-img {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid var(--color-secondary);
}

/* ── Burger (mobile only) ── */
.burger {
    display: none;
    position: fixed;
    top: 0.75rem; right: 0.75rem;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
    padding: 0.35rem 0.5rem;
    z-index: 110;
    transition: background 0.15s;
}

.burger:hover { background: var(--color-secondary); }

.burger-icon { display: flex; flex-direction: column; gap: 5px; width: 22px; }

.burger-icon span {
    display: block;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.burger.open .burger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.open .burger-icon span:nth-child(2) { opacity: 0; }
.burger.open .burger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sidebar overlay ── */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 90;
}

.sidebar-overlay.visible { display: block; }

/* ── Mobile ── */
@media (max-width: 768px) {
    body.app {
        height: auto;
        min-height: 100vh;
        overflow: visible;
        padding: 0;
    }

    .app-wrapper {
        flex-direction: column;
        gap: 0;
        padding-bottom: 0;
        overflow: visible;
    }

    .sidebar-wrapper {
        position: fixed;
        top: 0; right: 0;
        width: 240px;
        height: 100vh;
        gap: 0;
        background: var(--color-bg);
        border-left: 1px solid var(--color-secondary);
        transform: translateX(100%);
        align-self: auto;
        z-index: 100;
        padding: 0;
        overflow-y: auto;
    }

    .sidebar-wrapper.open { transform: translateX(0); box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5); }

    .sidebar {
        flex: none;
        border-radius: 0;
        border: none;
        box-shadow: none;
        border-bottom: 1px solid var(--color-secondary);
    }

    .sidebar-footer {
        border-radius: 0;
        box-shadow: none;
        border: none;
        border-top: 1px solid var(--color-secondary);
    }

    .sidebar-logo-area { display: none; }
    .sidebar-desktop-profile { display: none; }

    .main {
        border-radius: 0;
        box-shadow: none;
        border: none;
        min-height: 100vh;
        overflow-y: visible;
    }

    .burger { display: flex; }
    .sidebar-mobile-only { display: block; }
}

/* ── Social Sidebar ── */
.social-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    position: sticky;
    top: 1.5rem;
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

.social-sidebar ul { list-style: none; padding: 0.5rem 0; display: flex; flex-direction: column; flex: 1; }

.social-sidebar ul li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1.25rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.social-sidebar ul li a:hover,
.social-sidebar ul li a.active {
    background: var(--color-secondary);
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}

.social-sidebar ul li a .icon { font-size: 1rem; width: 1.2rem; text-align: center; flex-shrink: 0; }

.social-sidebar-title {
    padding: 1rem 1.25rem 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    text-transform: uppercase;
    flex-shrink: 0;
}

.social-badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 9999px;
    padding: 0.1rem 0.4rem;
    line-height: 1.4;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .social-sidebar {
        position: static;
        width: 100%;
        max-height: none;
        border-radius: 0;
        border: none;
        border-top: 1px solid var(--color-secondary);
        box-shadow: none;
        align-self: auto;
    }
}

/* ── Token box ── */
.token-box {
    margin-top: 1.25rem;
    padding: 0.65rem 0.9rem;
    background: #0f1e3d;
    border: 1px solid var(--color-secondary);
    border-radius: 6px;
    font-size: 0.75rem;
    color: #aaa;
    word-break: break-all;
    display: none;
}

.token-box span {
    display: block;
    font-size: 0.7rem;
    color: #666;
    margin-bottom: 0.4rem;
}

/* ── Sidebar groups ── */
.sidebar-footer {
    flex-shrink: 0;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    padding: 0.5rem 0;
}
.sidebar-footer ul {
    list-style: none;
    padding: 0;
}

.sidebar-group-toggle {
    cursor: pointer;
    justify-content: space-between;
}

.sidebar-arrow {
    margin-left: auto;
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.sidebar-group.open > a .sidebar-arrow {
    transform: rotate(90deg);
}

.sidebar-sub {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-group.open > .sidebar-sub {
    max-height: 500px;
}

.sidebar .sidebar-sub li a {
    padding: 0.55rem 1.25rem 0.55rem 2.5rem;
    font-size: 0.9rem;
    color: var(--color-muted);
}

/* ═══════════════════════════════════════════
   TOP BAR
   ═══════════════════════════════════════════ */
.topbar {
    flex-shrink: 0;
    width: 100%;
    max-width: calc(240px + 1.5rem + 93.75rem);
    margin: 0 auto 1rem;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 1rem;
}

/* Linker Bereich – Banner, gleiche Breite wie Sidebar */
.topbar-left {
    width: 240px;
    flex-shrink: 0;
    align-self: stretch;
    margin: -0.55rem 0 -0.55rem -1rem;
    overflow: hidden;
    border-radius: 11px 0 0 11px;
    display: flex;
    align-items: center;
	padding: 5px 0 0 5px; 
    justify-content: center;
}
.topbar-left a {
    display: flex;
    align-items: center;
    height: 100%;
}
.topbar-banner {
    height: 3.5rem;
    width: auto;
    display: block;
}

/* ── Suche ── */
.topbar-search-wrap {
    flex: 1;
    max-width: 520px;
    margin: 0 auto;
    position: relative;
}

.topbar-search-wrap input {
    background: var(--color-secondary);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 0.46rem 0.9rem 0.46rem 2.2rem;
    width: 100%;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.topbar-search-wrap input:focus {
    border-color: var(--color-primary);
}

.topbar-search-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-muted);
    font-size: 0.85rem;
    pointer-events: none;
    line-height: 1;
}

.topbar-search-overlay {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 600;
    max-height: 360px;
    overflow-y: auto;
    display: none;
}

.topbar-search-overlay.open { display: block; }

.topbar-search-hint {
    padding: 0.75rem 1rem;
    color: var(--color-muted);
    font-size: 0.88rem;
}

.topbar-search-result {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    border-bottom: 1px solid var(--color-secondary);
}

.topbar-search-result:last-child { border-bottom: none; }
.topbar-search-result:hover { background: var(--color-secondary); }

.topbar-search-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.topbar-search-avatar--placeholder {
    background: var(--color-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

/* ── Rechter Bereich ── */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
    margin-left: auto;
}

.topbar-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0.4rem 0.55rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s;
    width: auto;
    font-weight: normal;
    line-height: 1;
}

.topbar-btn:hover { background: var(--color-secondary); }

.topbar-badge {
    position: absolute;
    top: 1px;
    right: 1px;
    background: var(--color-primary);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 9999px;
    padding: 0.05rem 0.3rem;
    min-width: 1rem;
    text-align: center;
    line-height: 1.6;
    display: none;
    pointer-events: none;
}

.topbar-avatar {
    width: 1.9rem;
    height: 1.9rem;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--color-secondary);
    display: block;
}

.topbar-avatar-placeholder {
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-username {
    font-size: 0.88rem;
    font-weight: 600;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-profile-btn { gap: 0.5rem; padding: 0.3rem 0.55rem; }

/* ═══════════════════════════════════════════
   TOPBAR PANELS (Overlays)
   ═══════════════════════════════════════════ */
.topbar-panel {
    position: fixed;
    background: var(--color-card);
    border: 1px solid var(--color-secondary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.65);
    z-index: 550;
    width: 360px;
    max-height: 500px;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.topbar-panel.open { display: flex; }

.topbar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    font-weight: 700;
    font-size: 0.92rem;
    border-bottom: 1px solid var(--color-secondary);
    flex-shrink: 0;
    background: var(--color-card);
}

.topbar-panel-close {
    background: none;
    border: none;
    color: var(--color-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    width: auto;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.topbar-panel-close:hover { background: var(--color-secondary); color: var(--color-text); }

.topbar-panel-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.topbar-panel-footer {
    border-top: 1px solid var(--color-secondary);
    padding: 0.55rem 1rem;
    flex-shrink: 0;
    text-align: center;
    background: var(--color-card);
}

.topbar-panel-footer a {
    color: var(--color-primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.topbar-panel-footer a:hover { text-decoration: underline; }

.topbar-panel-hint {
    padding: 0.9rem 1rem;
    color: var(--color-muted);
    font-size: 0.88rem;
}

/* Einzel-Eintrag in Panel */
.topbar-panel-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--color-secondary);
    text-decoration: none;
    color: var(--color-text);
    transition: background 0.15s;
    cursor: pointer;
}

.topbar-panel-item:last-child { border-bottom: none; }
.topbar-panel-item:hover { background: var(--color-secondary); }

.topbar-item-avatar {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.topbar-item-avatar--placeholder {
    background: var(--color-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.topbar-panel-item-body {
    flex: 1;
    min-width: 0;
}

.topbar-panel-item-sub {
    font-size: 0.75rem;
    color: var(--color-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.1rem;
}

.topbar-item-badge {
    background: var(--color-primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9999px;
    padding: 0.1rem 0.4rem;
    flex-shrink: 0;
}

/* Benachrichtigungen */
.topbar-notif-item--unread { background: rgba(var(--color-primary-rgb, 231,57,84), 0.07); border-left: 3px solid var(--color-primary); }
.topbar-notif-item--unread:hover { background: rgba(var(--color-primary-rgb, 231,57,84), 0.12); }
.topbar-notif-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--color-primary);
    flex-shrink: 0;
    margin-top: 0.25rem;
    align-self: flex-start;
}

.topbar-mark-all-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    font-size: 0.8rem;
    cursor: pointer;
    width: auto;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background 0.15s;
}

.topbar-mark-all-btn:hover { background: var(--color-secondary); }

/* Einladungen */
.topbar-inv-card { align-items: center; }

.topbar-inv-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.78rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    width: auto;
    margin: 0;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    line-height: 1.5;
    transition: opacity 0.15s;
}

.topbar-inv-btn:hover { opacity: 0.85; }
.topbar-inv-btn--decline { background: #c0392b; color: #fff; }
.topbar-inv-btn--accept  { background: var(--color-success, #27ae60); color: #fff; }

/* Profil-Panel */
.topbar-profile-body { display: flex; flex-direction: column; }

.topbar-profile-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1rem 0.75rem;
}

.topbar-profile-nav {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0;
}

.topbar-profile-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.topbar-profile-link:hover { background: var(--color-secondary); }
.topbar-profile-link--danger { color: var(--color-primary); }

/* ── Mobile: Topbar ausblenden ── */
@media (max-width: 768px) {
    .topbar { display: none; }
}
