/* Oben rechts: Login-Button und Sprachauswahl */

[hidden] {
    display: none !important;
}

.topbar {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Blauer Discord Connect Button */

.discord-btn {
    display: none !important;
}

.discord-btn:hover {
    filter: brightness(1.12);
}

.discord-btn:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.discord-btn:focus-visible {
    outline: 2px solid #5865F2;
    outline-offset: 2px;
}

.discord-icon {
    width: 20px;
    height: 15px;
    display: block;
}

/* Discord Profilbild (nach Verifizierung) */

.discord-avatar-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #5865F2;
    background-color: #5865F2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    flex-shrink: 0;
}

.discord-avatar-svg {
    width: 20px;
    height: 16px;
    fill: #ffffff;
    display: block;
}

.discord-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Grüner Login-Button */

.login-btn {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;

    color: #ffffff;
    background-color: #0d7a33;
    border: 1px solid #0a5c27;
    border-radius: 8px;
    padding: 10px 20px;

    cursor: pointer;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.35);
    transition: filter 0.15s ease, transform 0.1s ease;
}

.login-btn:hover {
    filter: brightness(1.12);
}

.login-btn:active {
    transform: translateY(1px);
    filter: brightness(0.95);
}

.login-btn:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 2px;
}

/* Sprachauswahl mit Flagge ganz rechts */

.lang {
    position: relative;
}

.lang-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 36px;
    padding: 0;

    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.lang-btn:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.24);
}

.lang-btn:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 2px;
}

.flag-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.flag {
    display: block;
    width: 24px;
    height: 16px;
    border-radius: 2px;
    clip-path: inset(0 round 2px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.flag-sm {
    width: 20px;
    height: 13px;
}

.lang-btn .flag {
    position: absolute;
}

.lang-btn .flag-de {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.lang-btn .flag-en {
    opacity: 0;
    transform: scale(0.7) translateY(6px);
    pointer-events: none;
}

html[lang="en"] .lang-btn .flag-de {
    opacity: 0;
    transform: scale(0.7) translateY(-6px);
    pointer-events: none;
}

html[lang="en"] .lang-btn .flag-en {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Sanfte Überblendung für übersetzte Texte */
[data-i18n] {
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.i18n-transitioning {
    opacity: 0;
    transform: translateY(-2px);
}

/* Dropdown-Menü */

.lang-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 10;

    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 156px;
    padding: 6px;

    background-color: #252526;
    border: 1px solid #3c3c3c;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.lang-menu[hidden] {
    display: none;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 14px;
    color: #d4d4d4;
    background: none;
    border: 0;
    border-radius: 6px;
    text-align: left;
    cursor: pointer;
}

.lang-option:hover {
    color: #ffffff;
    background-color: #333336;
}

.lang-option[aria-current="true"] {
    color: #ffffff;
    background-color: rgba(74, 222, 128, 0.12);
}

.lang-option:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: -2px;
}

/* ============================================================
   CHAT UNTEN LINKS
   ============================================================ */

.chat-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 320px;
    height: 380px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);

    background-color: #1a1a1a;
    border: 1px solid #2d2d2d;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
    transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.chat-container.minimized {
    height: 44px;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background-color: #222222;
    border-bottom: 1px solid #2d2d2d;
    user-select: none;
}

.chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
}

.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
}

.chat-toggle-btn {
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.chat-toggle-btn:hover {
    color: #ffffff;
    background-color: #333333;
}

.chat-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #333333;
    border-radius: 3px;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 10px;
    background-color: #242424;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.chat-msg.self-msg {
    background-color: #2a352a;
    border-left: 3px solid #22c55e;
}

.chat-msg.system-msg {
    background-color: rgba(88, 101, 242, 0.12);
    border-left: 3px solid #5865F2;
}

.msg-author {
    font-size: 11px;
    font-weight: 700;
    color: #22c55e;
}

.chat-msg.system-msg .msg-author {
    color: #7983f5;
}

.chat-msg.self-msg .msg-author {
    color: #4ade80;
}

.msg-text {
    color: #e0e0e0;
}

.chat-blocked-alert {
    padding: 6px 10px;
    margin: 0 10px 6px 10px;
    background-color: rgba(239, 68, 68, 0.16);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    color: #f87171;
    font-size: 11px;
    line-height: 1.3;
    animation: fadeIn 0.2s ease;
}

.chat-input-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background-color: #1e1e1e;
    border-top: 1px solid #2d2d2d;
}

.chat-input {
    flex: 1;
    background-color: #292929;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    padding: 8px 10px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.chat-input:focus {
    border-color: #22c55e;
    background-color: #303030;
}

.chat-input.input-error {
    border-color: #ef4444;
    animation: shake 0.3s ease;
}

.chat-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background-color: #22c55e;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    flex-shrink: 0;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.chat-send-btn:hover {
    filter: brightness(1.15);
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.send-icon {
    width: 16px;
    height: 16px;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-3px); }
    to { opacity: 1; transform: translateY(0); }
}
