/* ========================================= */
/* 🏰 CLASH TAVERN - SUPERCELL STYLE */
/* ========================================= */
:root {
    --tavern-bg: #1e1e24;
    --tavern-gold: #FFD700;
    --tavern-green: #97e857;
    --tavern-red: #ff5e5e;
    --glass-dark: rgba(20, 20, 25, 0.85);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
    --msg-bg-other: rgba(0, 0, 0, 0.6);
    --msg-bg-own: linear-gradient(135deg, #2b3a1a 0%, #1a2510 100%);
    /* Subtle Green/Gold tint */
    --font-stack: 'Outfit', 'Segoe UI', sans-serif;
}

/* Reset ALL buttons inside chat-drawer to prevent global 3D effects */
#chat-drawer button,
#chat-drawer .reaction-pill,
.chat-msg button {
    all: unset !important;
    cursor: pointer !important;
}

/* Hide empty messages (no text content) */
.chat-msg:empty,
.chat-msg .msg-text:empty {
    display: none !important;
}

/* 🌑 A) Background Texture (Smoky Gradient + Noise) */
#chat-drawer {
    background:
        radial-gradient(circle at 50% 10%, rgba(50, 60, 80, 0.4) 0%, transparent 60%),
        linear-gradient(180deg, #18191c 0%, #0e0e10 100%);
    box-shadow:
        0 0 0 1px rgba(255, 215, 0, 0.15),
        /* Inner Gold Ring */
        0 12px 40px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    font-family: var(--font-stack);
    overflow: hidden;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Supercell Bounce */
    z-index: 10000;
}

#chat-drawer.open {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: all;
}

/* 🎮 Header */
.chat-header {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.2));
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title-group h3 {
    margin: 0;
    color: var(--tavern-gold);
    font-family: 'Clash', sans-serif;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0, 0, 0, 1);
    letter-spacing: 1px;
    font-size: 1.1rem;
}

.online-status {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #aaa;
    display: flex;
    align-items: center;
    gap: 6px;
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--tavern-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--tavern-green);
}

/* 💬 B) Message Bubbles (Redesign) */
.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-feed::-webkit-scrollbar {
    width: 4px;
}

.chat-feed::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.chat-msg {
    position: relative;
    max-width: 85%;
    width: fit-content;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.95rem;
    line-height: 1.4;
    color: #eee;

    /* Others: Dark Glass */
    background: var(--msg-bg-other);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-bottom-left-radius: 2px;
    transform-origin: bottom left;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-msg.users-own {
    align-self: flex-end;
    /* You: Gold/Green Gradient + Thicker Border */
    background: var(--msg-bg-own);
    border: 1px solid rgba(151, 232, 87, 0.3);
    /* Tavern Green Border */
    border-bottom-right-radius: 2px;
    border-bottom-left-radius: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    color: #fff;
    transform-origin: bottom right;
}

/* Own messages: Subtle glow effect instead of shine animation */
.chat-msg.users-own {
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.3),
        0 0 8px rgba(151, 232, 87, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* C) Username & Rank */
.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

/* Message Text - MUST be visible */
.msg-text {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 2;
    color: #eee !important;
    word-wrap: break-word;
    margin-bottom: 4px;
    min-height: 1em;
}

.msg-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: #ddd;
    cursor: pointer;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.chat-msg.users-own .msg-name {
    color: var(--tavern-gold);
}

.rank-badge {
    font-size: 0.65rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #bbb;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Rank Badge Colors */
.rank-badge.rank-villager {
    color: #a8a29e;
    border-color: rgba(168, 162, 158, 0.3);
}

.rank-badge.rank-raider {
    color: #60a5fa;
    border-color: rgba(96, 165, 250, 0.3);
    background: rgba(96, 165, 250, 0.1);
}

.rank-badge.rank-chief {
    color: var(--tavern-gold);
    border-color: rgba(255, 215, 0, 0.3);
    background: rgba(255, 215, 0, 0.1);
}

.rank-badge.rank-legend {
    color: #c084fc;
    border-color: rgba(192, 132, 252, 0.4);
    background: rgba(192, 132, 252, 0.15);
    box-shadow: 0 0 8px rgba(192, 132, 252, 0.2);
}

/* D) Reactions (Supercell Pills) */
.msg-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 8px;
    min-height: 24px;
}

.msg-actions {
    display: flex;
    gap: 6px;
}

.reaction-pill,
#chat-drawer .reaction-pill,
.chat-msg .reaction-pill,
.msg-actions .reaction-pill {
    all: unset !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    color: rgba(255, 255, 255, 0.4) !important;
    background: transparent !important;
    border: none !important;
    transition: all 0.2s ease !important;
}

.reaction-pill:hover,
#chat-drawer .reaction-pill:hover,
.chat-msg .reaction-pill:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #fff !important;
}

.reaction-pill.active,
#chat-drawer .reaction-pill.active,
.chat-msg .reaction-pill.active {
    background: rgba(255, 215, 0, 0.15) !important;
    color: var(--tavern-gold) !important;
    animation: reactionBounce 0.3s ease !important;
}

@keyframes reactionBounce {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

.reaction-count {
    font-weight: bold;
    font-size: 0.75rem;
}

.msg-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.3);
}

/* F) System Messages with Purple Glow */
.system-msg {
    align-self: center;
    background: rgba(192, 132, 252, 0.1);
    border: 1px solid rgba(192, 132, 252, 0.2);
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 0.8rem;
    color: #c084fc;
    margin: 8px 0;
    text-align: center;
    max-width: 90%;
    animation: fadeIn 0.5s;
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.2);
}

/* E) Typing Bar */
.typing-bar {
    height: 20px;
    font-size: 0.75rem;
    color: var(--tavern-green);
    font-style: italic;
    padding-left: 20px;
    opacity: 0;
    transition: opacity 0.3s;
    margin-bottom: 4px;
}

.typing-bar.active {
    opacity: 1;
}

/* 🎮 G) Input Area (Rounded & Glowing) */
.chat-input-area {
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 15px;
}

.chat-input-wrapper {
    background: #151518;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

/* Small icon button inside input area */
.chat-icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2) !important;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-icon-btn:hover {
    background: rgba(255, 215, 0, 0.25);
    transform: scale(1.05);
    border-color: var(--tavern-gold) !important;
}

.chat-input-wrapper:focus-within {
    border-color: var(--tavern-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.1);
}

#chat-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    padding: 10px 16px;
    font-size: 0.95rem;
}

#chat-send-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    background: linear-gradient(145deg, #FFD700, #FFA500) !important;
    border-radius: 50% !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #222 !important;
    font-size: 1.1rem;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(255, 165, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.3);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

#chat-send-btn:hover {
    transform: scale(1.1);
}

#chat-send-btn:active {
    transform: scale(0.9);
}

/* Animations */
@keyframes popIn {
    0% {
        transform: scale(0.8) translateY(10px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes shine {
    0% {
        left: -100%;
    }

    20% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================================= */
/* ⚡ FLOATING DOCK - Premium Supercell Style */
/* ========================================= */
.floating-dock {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    touch-action: none;
}

/* Dragging state */
.floating-dock.dragging {
    opacity: 0.9;
}

.floating-dock.dragging .fab-main {
    transform: scale(1.1);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.5);
}

/* Grab cursor on main button */
.fab-main {
    cursor: grab;
}

.fab-main:active {
    cursor: grabbing;
}

/* Expandable Menu */
.fab-menu {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.8);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.floating-dock.open .fab-menu {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* FAB Item Wrapper with Label */
.fab-item-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fab-label {
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: labelSlide 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes labelSlide {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Base FAB Button Style */
.fab-main,
.fab-item {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 3px solid var(--tavern-gold);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;

    /* Premium Glow */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 15px rgba(255, 215, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1),
        inset 0 -2px 4px rgba(0, 0, 0, 0.2);
}

/* Main Button (⚡) */
.fab-main {
    width: 64px;
    height: 64px;
    background: linear-gradient(145deg, #2a2a35 0%, #1a1a22 100%);
    font-size: 1.8rem;
    animation: fabPulse 3s ease-in-out infinite;
}

.fab-main:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow:
        0 6px 30px rgba(0, 0, 0, 0.6),
        0 0 25px rgba(255, 215, 0, 0.4);
}

.fab-main:active {
    transform: scale(0.95);
}

/* Menu Buttons */
.fab-item {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
}

/* Chat Button (🍺 Tavern Mug) */
.fab-chat {
    background: linear-gradient(145deg, #4a3728 0%, #2d2118 100%);
    border-color: #cd8544;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(205, 133, 68, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.fab-chat:hover {
    transform: scale(1.15) rotate(-5deg);
    box-shadow:
        0 6px 25px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(205, 133, 68, 0.5);
}

/* Feedback Button (📣) */
.fab-feedback {
    background: linear-gradient(145deg, #3a3545 0%, #252230 100%);
    border-color: #a78bfa;
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 12px rgba(167, 139, 250, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.1);
}

.fab-feedback:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow:
        0 6px 25px rgba(0, 0, 0, 0.6),
        0 0 20px rgba(167, 139, 250, 0.4);
}

/* Unread Badge on FAB */
.fab-item .unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(145deg, #ff5e5e 0%, #cc4444 100%);
    color: white;
    border: 2px solid #fff;
    border-radius: 50%;
    min-width: 22px;
    height: 22px;
    font-weight: bold;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 94, 94, 0.5);
    animation: badgePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animations */
@keyframes fabPulse {

    0%,
    100% {
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.5),
            0 0 15px rgba(255, 215, 0, 0.2),
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    }

    50% {
        box-shadow:
            0 4px 20px rgba(0, 0, 0, 0.5),
            0 0 25px rgba(255, 215, 0, 0.35),
            inset 0 2px 4px rgba(255, 255, 255, 0.1),
            inset 0 -2px 4px rgba(0, 0, 0, 0.2);
    }
}

@keyframes badgePop {
    0% {
        transform: scale(0);
    }

    70% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Rotate icon when open */
.floating-dock.open .fab-main {
    transform: rotate(45deg);
    background: linear-gradient(145deg, #3a3545 0%, #252230 100%);
}

/* ========================================= */
/* 🎯 ICON BUTTONS (Report, etc.) */
/* ========================================= */
.icon-btn {
    background: transparent !important;
    border: none !important;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.7rem;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0;
}

/* Report buttons show on hover */
.chat-msg:hover .icon-btn {
    opacity: 1;
}

.icon-btn:hover {
    color: var(--tavern-red);
    transform: scale(1.2);
}

/* Header buttons ALWAYS visible */
.chat-controls .icon-btn {
    opacity: 1 !important;
    font-size: 1.2rem;
    padding: 4px 8px;
    color: rgba(255, 255, 255, 0.6);
}

.chat-controls .icon-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

/* ========================================= */
/* 👤 TAVERN PROFILE MODAL */
/* ========================================= */
.tavern-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 99999 !important;
    justify-content: center;
    align-items: center;
}

.tavern-modal.active {
    display: flex !important;
}

.tavern-modal-content {
    background: linear-gradient(180deg, #2a2a32 0%, #1a1a20 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    padding: 30px;
    min-width: 300px;
    max-width: 400px;
    position: relative;
    box-shadow:
        0 0 0 1px rgba(255, 215, 0, 0.2),
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 0 80px rgba(255, 215, 0, 0.1);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.close-modal-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #aaa;
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.close-modal-btn:hover {
    background: var(--tavern-red);
    color: white;
}

.profile-header {
    text-align: center;
    margin-bottom: 24px;
}

.profile-avatar {
    font-size: 3rem;
    margin-bottom: 12px;
}

.profile-header h2 {
    margin: 0;
    color: var(--tavern-gold);
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.modal-tag {
    display: block;
    color: #888;
    font-size: 0.85rem;
    margin-top: 4px;
}

.profile-stats {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px 20px;
    text-align: center;
    min-width: 80px;
}

.stat-label {
    display: block;
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    color: var(--tavern-green);
    font-size: 1.1rem;
    font-weight: 700;
}

/* ========================================= */
/* ✏️ NAME EDIT MODAL */
/* ========================================= */
.name-edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.name-edit-modal.open {
    display: flex;
}

.name-edit-content {
    background: linear-gradient(145deg, #1e1e24 0%, #15151a 100%);
    border: 2px solid var(--tavern-gold);
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 215, 0, 0.1);
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes modalPop {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.name-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 215, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1rem;
    font-weight: 700;
    color: var(--tavern-gold);
}

.name-edit-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.name-edit-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.name-edit-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.name-edit-body label {
    color: #aaa;
    font-size: 0.85rem;
}

.name-edit-body input {
    background: #0d0d10;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 12px 16px;
    color: #fff;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.name-edit-body input:focus {
    border-color: var(--tavern-gold);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.15);
}

.name-edit-hint {
    color: #666;
    font-size: 0.75rem;
}

.name-edit-footer {
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
}

.name-edit-footer .gold-btn {
    width: 100%;
}

/* ========================================= */
/* 🍞 TOAST NOTIFICATIONS */
/* ========================================= */
.chat-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, #2a2a35 0%, #1a1a22 100%);
    border: 2px solid var(--tavern-green);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 15px rgba(34, 197, 94, 0.2);
    z-index: 10002;
    animation: toastSlide 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), toastFade 3s ease-in-out forwards;
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastFade {

    0%,
    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* ========================================= */
/* 📱 MOBILE RESPONSIVE STYLES */
/* ========================================= */

/* Tablets and smaller */
@media (max-width: 768px) {

    /* Chat Drawer - Full width on mobile */
    #chat-drawer {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: 70vh;
        max-height: 500px;
        border-radius: 16px;
    }

    /* Floating Dock - Smaller on mobile */
    .floating-dock {
        right: 12px;
        bottom: 12px;
    }

    .fab-main {
        width: 56px;
        height: 56px;
        font-size: 1.5rem;
    }

    .fab-item {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }

    .fab-label {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    /* Messages - Smaller on mobile */
    .chat-msg {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .msg-name {
        font-size: 0.75rem;
    }

    .rank-badge {
        font-size: 0.6rem;
        padding: 2px 6px;
    }

    .reaction-pill {
        font-size: 0.75rem;
        padding: 3px 8px !important;
    }

    /* Input area - More compact */
    .chat-input-area {
        padding: 10px;
    }

    .chat-input-wrapper {
        padding: 3px;
        gap: 3px;
    }

    .chat-icon-btn {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 0.8rem;
    }

    #chat-input {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    #chat-send-btn {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1rem;
    }

    /* Name Edit Modal */
    .name-edit-content {
        width: 95%;
        max-width: 280px;
    }
}

/* Small phones */
@media (max-width: 480px) {

    /* Chat Drawer - Full screen on small phones */
    #chat-drawer {
        width: 100vw;
        right: 0;
        bottom: 0;
        height: 80vh;
        max-height: none;
        border-radius: 20px 20px 0 0;
    }

    .chat-header {
        padding: 12px 14px;
    }

    .chat-header h3 {
        font-size: 1rem;
    }

    /* Floating Dock - Even smaller */
    .fab-main {
        width: 52px;
        height: 52px;
        font-size: 1.4rem;
    }

    .fab-item {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .fab-menu {
        gap: 10px;
        margin-bottom: 10px;
    }

    .fab-label {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    /* Toast - Smaller on mobile */
    .chat-toast {
        bottom: 80px;
        padding: 10px 18px;
        font-size: 0.85rem;
    }

    /* Tavern Profile Modal */
    .tavern-profile-modal .profile-content {
        width: 95%;
        max-width: 300px;
    }
}

/* Landscape mode on phones */
@media (max-height: 500px) {
    #chat-drawer {
        height: 90vh;
        bottom: 5vh;
    }

    .chat-feed {
        max-height: 50vh;
    }
}