/* ========================================
   HUSTLE CASTLE FORUM - CSS ORGANIZZATO
   ======================================== */

/* ========================================
   1. VARIABILI CSS E BASE
   ======================================== */

:root {
    /* Palette principale */
    --primary-dark: #1a1b2e;
    --primary-medium: #16213e;
    --primary-light: #0f3460;
    --accent-1: #533483;
    --accent-2: #7209b7;
    --accent-3: #2d82b5;
    --accent-4: #42e6a4;
    
    /* Colori di supporto */
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --border: rgba(255, 255, 255, 0.1);
    --card-bg: rgba(255, 255, 255, 0.05);
    --hover-bg: rgba(255, 255, 255, 0.1);
    --error: #e74c3c;
    --success: #27ae60;
    --warning: #f39c12;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-2), var(--accent-3));
    --gradient-secondary: linear-gradient(135deg, var(--accent-3), var(--accent-4));
    --gradient-card: linear-gradient(135deg, rgba(83, 52, 131, 0.1), rgba(45, 130, 181, 0.1));
    --gradient-danger: linear-gradient(135deg, #e74c3c, #c0392b);
    --gradient-success: linear-gradient(135deg, #27ae60, #229954);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-medium));
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Background animato */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(83, 52, 131, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(45, 130, 181, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(66, 230, 164, 0.1) 0%, transparent 50%);
    z-index: -1;
    animation: backgroundShift 20s ease-in-out infinite;
}

/* ========================================
   2. LAYOUT PRINCIPALE
   ======================================== */

/* SIDEBAR */
.sidebar {
    width: 280px;
    background: rgba(22, 33, 62, 0.95);
    backdrop-filter: blur(15px);
    border-right: 1px solid var(--border);
    padding: 2rem 1rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.logo {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--gradient-primary);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(83, 52, 131, 0.3);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(45deg, #ffffff, var(--accent-4));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem;
    min-height: 100vh;
}

/* ========================================
   3. USER INFO E AVATAR
   ======================================== */

.user-info {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.user-avatar {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-secondary);
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border: 3px solid var(--border);
    overflow: hidden;
}

.user-avatar img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    z-index: 2;
}

.user-avatar-default {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    z-index: 1;
}

.user-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.user-clan {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.user-role {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.user-role.role-superuser {
    background: var(--gradient-danger);
    color: white;
}

.user-role.role-moderator {
    background: var(--gradient-primary);
    color: white;
}

.user-role.role-user {
    background: var(--gradient-secondary);
    color: white;
}

.user-clan-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    white-space: nowrap;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-clan-badge.no-clan {
    background: rgba(108, 117, 125, 0.3);
    color: var(--text-muted);
    border-color: rgba(108, 117, 125, 0.3);
}

/* ========================================
   4. NAVIGATION
   ======================================== */

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-item {
    padding: 0.8rem 1rem;
    margin: 0.3rem 0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-secondary);
    transition: left 0.3s ease;
    z-index: -1;
}

.nav-item:hover::before {
    left: 0;
}

.nav-item:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}

.nav-item.active {
    background: var(--gradient-primary);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(83, 52, 131, 0.4);
}

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Section Activity Badge */
.section-badge {
    background: var(--accent-4);
    color: var(--primary-dark);
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 15px;
    animation: badgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(66, 230, 164, 0.4);
    z-index: 10;
}

.nav-item:hover .section-badge {
    animation: badgeBounce 0.5s ease;
}

.nav-item.active .section-badge {
    background: white;
    color: var(--accent-2);
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(66, 230, 164, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 2px 12px rgba(66, 230, 164, 0.6);
    }
}

@keyframes badgeBounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.2);
    }
    75% {
        transform: scale(0.9);
    }
}
/* ========================================
   5. STATUS INDICATORS E TOP BAR
   ======================================== */

.connection-status, .message-counter, .notifications-bell {
    position: fixed;
    top: 20px;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.connection-status {
    right: 90px;
    background: rgba(231, 76, 60, 0.9);
}

.connection-status.online {
    background: rgba(39, 174, 96, 0.9);
}

.message-counter {
    right: 250px;
    background: var(--gradient-primary);
}

.notifications-bell {
    right: 20px;
    background: var(--gradient-primary);
}

.online-indicator, .offline-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-left: 5px;
}

.online-indicator {
    background: var(--accent-4);
    animation: pulse 2s infinite;
}

.offline-indicator {
    background: var(--text-muted);
}

/* ========================================
   6. BOTTONI E CONTROLLI
   ======================================== */

.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(83, 52, 131, 0.4);
}

.logout-btn {
    background: var(--gradient-danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
	margin-top: 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.avatar-upload-btn {
    background: var(--gradient-secondary);
    color: white;
    padding: 8px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    display: inline-block;
}

.avatar-upload-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(45, 130, 181, 0.4);
}

.new-thread-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(83, 52, 131, 0.4);
    transition: all 0.3s ease;
    z-index: 100;
}

.new-thread-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(83, 52, 131, 0.6);
}

/* ========================================
   7. FORMS E INPUTS
   ======================================== */

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(83, 52, 131, 0.2);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 0.8;
}

button:focus,
input:focus,
textarea:focus,
.nav-item:focus {
    outline: 2px solid var(--accent-4);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* ========================================
   8. CONTENT AREAS
   ======================================== */

.banner {
    background: var(--gradient-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(66, 230, 164, 0.1),
        transparent,
        rgba(83, 52, 131, 0.1),
        transparent
    );
    animation: rotate 20s linear infinite;
    z-index: -1;
}

.banner-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.banner-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.header {
    margin-bottom: 2rem;
}

.header h2 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.content-area {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    min-height: 600px;
}

/* ========================================
   9. FORUM LAYOUT
   ======================================== */

.forum-layout {
    display: none;
}

.forum-header {
    display: grid;
    grid-template-columns: 1fr 100px 120px 200px;
    gap: 1rem;
    padding: 1rem;
    background: var(--gradient-primary);
    border-radius: 10px;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.thread-item {
    display: grid;
    grid-template-columns: 1fr 100px 120px 200px;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    align-items: center;
    position: relative;
}

.thread-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-secondary);
    border-radius: 15px 15px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thread-item:hover {
    background: var(--hover-bg);
    border-color: var(--accent-2);
    transform: translateY(-2px);
}

.thread-item:hover::before {
    opacity: 1;
}

.thread-item.thread-pending {
    border-color: var(--warning);
    background: rgba(243, 156, 18, 0.1);
}

.thread-item.thread-rejected {
    border-color: var(--error);
    background: rgba(231, 76, 60, 0.1);
}

.thread-main {
    min-width: 0;
}

.thread-title {
    color: var(--accent-4);
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    margin-bottom: 0.5rem;
    word-wrap: break-word;
}

.thread-title:hover {
    color: var(--accent-3);
}

.thread-author {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.thread-author-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.thread-author-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.thread-replies, .thread-stats {
    text-align: center;
    font-weight: 600;
    color: var(--accent-3);
}

.thread-last-post {
    text-align: right;
    font-size: 0.9rem;
}

.thread-last-post div:first-child {
    color: var(--text-secondary);
}

.thread-last-post div:last-child {
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ========================================
   10. CHAT MODE - STILE WHATSAPP
   ======================================== */

.chat-mode {
    display: none;
    flex-direction: column;
    height: 600px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: 
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="castle" patternUnits="userSpaceOnUse" width="40" height="40"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.02)"/></pattern></defs><rect width="100" height="100" fill="url(%23castle)"/></svg>'),
        rgba(22, 33, 62, 0.3);
    border-radius: 15px 15px 0 0;
    position: relative;
}

/* Separatore temporale */
.message-time-separator {
    text-align: center;
    margin: 1rem 0;
    position: relative;
}

.message-time-separator span {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Container messaggi */
.message-bubble-container {
    display: flex;
    margin-bottom: 0.5rem;
    max-width: 100%;
    position: relative;
}

.message-bubble-container.own-message {
    justify-content: flex-end;
    margin-left: 20%;
}

.message-bubble-container.other-message {
    justify-content: flex-start;
    margin-right: 20%;
}

/* Avatar piccolo per chat */
.message-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
    align-self: flex-end;
    margin-bottom: 0.3rem;
}

.message-avatar-small .comment-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
    border: 2px solid var(--border);
    overflow: hidden;
    position: relative;
    background: var(--gradient-secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 50%;
}

.message-avatar-small .comment-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    border-radius: 50%;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 2 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Per chat - ensure avatar containers are visible */
.message-avatar-small .comment-avatar:has(img) {
    font-size: 0; /* Nascondi testo quando c'è immagine */
}

/* Fallback per browser che non supportano :has() */
.message-avatar-small .comment-avatar.has-image {
    font-size: 0;
}

.message-avatar-small .comment-avatar.has-image::before {
    content: '';
}

.message-avatar-spacer {
    width: 42px; /* 32px + 10px margin */
    flex-shrink: 0;
}

/* Nuvolette dei messaggi */
.message-bubble {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 0.8rem 1rem;
    position: relative;
    max-width: 100%;
    word-wrap: break-word;
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

/* Messaggi propri (a destra) */
.own-bubble {
    background: var(--gradient-primary);
    color: white;
    border-top-right-radius: 6px;
    margin-left: 0.5rem;
    border: 1px solid rgba(83, 52, 131, 0.3);
}

.own-bubble::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-left-color: var(--accent-2);
    border-top: none;
    border-right: none;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.1));
}

/* Messaggi altri utenti (a sinistra) */
.other-bubble {
    background: rgba(255, 255, 255, 0.08);
    border-top-left-radius: 6px;
    margin-right: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.other-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-right-color: rgba(255, 255, 255, 0.08);
    border-top: none;
    border-left: none;
    filter: drop-shadow(-1px 1px 1px rgba(0, 0, 0, 0.1));
}

/* Header del messaggio (nome utente) */
.message-author-header {
    margin-bottom: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.message-author-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--accent-4);
}

.own-bubble .message-author-name {
    color: rgba(255, 255, 255, 0.9);
}

/* Testo del messaggio */
.message-text {
    line-height: 1.4;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.own-bubble .message-text {
    color: white;
}

.other-bubble .message-text {
    color: var(--text-primary);
}

/* Meta informazioni (orario, stato) */
.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.2rem;
}

.message-time-bubble {
    font-size: 0.7rem;
    opacity: 0.8;
    font-weight: 500;
}

.own-bubble .message-time-bubble {
    color: rgba(255, 255, 255, 0.8);
}

.other-bubble .message-time-bubble {
    color: var(--text-muted);
}

.message-status {
    font-size: 0.8rem;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.8);
}

/* Badge clan nei messaggi */
.message-bubble .user-clan-badge {
    font-size: 0.6rem;
    padding: 1px 4px;
    border-radius: 6px;
    opacity: 0.9;
}

.own-bubble .user-clan-badge {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Menzioni nei messaggi */
.message-bubble .mention {
    background: rgba(66, 230, 164, 0.3);
    color: var(--accent-4);
    padding: 1px 4px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(66, 230, 164, 0.4);
}

.own-bubble .mention {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.own-bubble .mention.self {
    background: rgba(66, 230, 164, 0.4);
    color: white;
    border-color: rgba(66, 230, 164, 0.5);
    animation: highlightMentionOwn 2s ease;
}

/* Input chat */
.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
    border-radius: 0 0 15px 15px;
    backdrop-filter: blur(10px);
}

.chat-input > div {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
}

.chat-input > div > div:first-child {
    flex: 1 !important;
    position: relative !important;
}

.chat-input input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 25px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    font-size: 1rem;
    width: 100% !important;
    margin: 0 !important;
    transition: all 0.3s ease;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--accent-3);
    box-shadow: 0 0 0 3px rgba(45, 130, 181, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.chat-input input::placeholder {
    color: var(--text-muted);
}

.chat-input > div > div:last-child {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    flex-shrink: 0 !important;
}

.chat-input .emoticon-picker {
    position: relative;
    flex-shrink: 0 !important;
}

.chat-input .emoticon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    width: 44px !important;
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-secondary);
    flex-shrink: 0 !important;
}

.chat-input .emoticon-btn:hover {
    background: var(--hover-bg);
    color: var(--accent-2);
}

.chat-input button {
    background: var(--gradient-secondary) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 44px !important;
    height: 44px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 600 !important;
    font-size: 0.9rem !important;
    box-shadow: 0 2px 8px rgba(45, 130, 181, 0.3) !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
}

.chat-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(45, 130, 181, 0.4);
}

.chat-input button:active {
    transform: scale(0.95);
}

/* Indicatore di digitazione */
.typing-indicator {
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0.8;
}

/* Scrollbar personalizzata per chat */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--gradient-secondary);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-primary);
}

/* ========================================
   11. THREAD VIEW
   ======================================== */

.thread-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.back-btn {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 1rem;
    align-self: flex-start;
    font-weight: 600;
    transition: all 0.3s ease;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(45, 130, 181, 0.4);
}

.thread-header {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.thread-header h1 {
    color: var(--accent-4);
    margin-bottom: 1rem;
    font-size: 2rem;
}

.thread-meta {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.thread-content {
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 1.1rem;
}

.thread-comments {
    flex: 1;
    overflow-y: auto;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.comment, .comment-with-avatar {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.comment-with-avatar {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author, .comment-author-name {
    font-weight: 600;
    color: var(--accent-4);
}

.comment-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.comment-content {
    color: var(--text-primary);
    line-height: 1.5;
}

/* ========================================
   12. COMMENT INPUT E UPLOAD
   ======================================== */

.comment-input {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1rem;
}

.comment-input-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-input-main {
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.comment-textarea-container {
    flex: 1;
    position: relative;
}

.comment-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: flex-end;
}

.comment-buttons-row {
    display: flex !important;
    gap: 5px;
    align-items: center;
}

.comment-input textarea {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
}

.comment-input textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(83, 52, 131, 0.2);
}

.submit-comment-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, #DAA520, #B8860B);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-comment-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4);
}

.submit-comment-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.comment-input button {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.comment-input button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(83, 52, 131, 0.4);
}

/* ========================================
   13. IMAGE UPLOAD E GESTIONE
   ======================================== */

.image-upload-section {
    margin: 15px 0;
    padding: 15px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
}

.image-upload-section:hover {
    border-color: var(--accent-2);
    background: rgba(83, 52, 131, 0.05);
}

.image-upload-label {
    display: inline-block;
    background: var(--gradient-secondary);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    text-align: center;
    margin-bottom: 10px;
}

.image-upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(45, 130, 181, 0.4);
}

.image-upload-input {
    display: none;
}

.image-preview {
    margin-top: 10px;
    position: relative;
    max-width: 100%;
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    display: block;
    margin: 0 auto;
}

.remove-image {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--gradient-danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.remove-image:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.thread-image, .comment-image {
    margin: 15px 0;
    text-align: center;
}

.thread-image img, .comment-image img {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
}

.thread-image img:hover, .comment-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border-color: var(--accent-2);
}

.comment-image-upload {
    margin-top: 10px;
    padding: 10px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    display: none;
}

.comment-image-upload.show {
    display: block;
}

.comment-image-upload .image-upload-label {
    font-size: 12px;
    padding: 8px 16px;
    margin-bottom: 8px;
}

.comment-image-upload .image-preview img {
    max-height: 150px;
}

.small-upload-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.small-upload-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-2);
    color: var(--accent-2);
}

/* ========================================
   14. MODALS
   ======================================== */

.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    backdrop-filter: blur(15px);
}

.login-form h2 {
    text-align: center;
    color: var(--accent-4);
    margin-bottom: 2rem;
}

.login-tabs {
    display: flex;
    margin-bottom: 1.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.25rem;
}

.login-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-secondary);
    padding: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.login-tab.active {
    background: var(--gradient-primary);
    color: white;
}

.thread-creation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.thread-creation-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    backdrop-filter: blur(15px);
}

.thread-creation-form h3 {
    color: var(--accent-4);
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
}

.thread-creation-form input,
.thread-creation-form textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.thread-creation-form input:focus,
.thread-creation-form textarea:focus {
    outline: none;
    border-color: var(--accent-2);
    box-shadow: 0 0 0 3px rgba(83, 52, 131, 0.2);
}

.thread-creation-form textarea {
    min-height: 150px;
    resize: vertical;
}

.thread-creation-buttons {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.btn-create-thread, .btn-cancel-thread {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-create-thread {
    background: var(--gradient-primary);
    color: white;
}

.btn-cancel-thread {
    background: var(--gradient-danger);
    color: white;
}

.btn-create-thread:hover,
.btn-cancel-thread:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    cursor: pointer;
}

.image-modal img {
    max-width: 95%;
    max-height: 95%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    cursor: default;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: var(--accent-4);
    transform: scale(1.1);
}

.avatar-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.avatar-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(15px);
    text-align: center;
}

.avatar-modal-content h3 {
    color: var(--accent-4);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.avatar-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.avatar-preview-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--accent-3);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-secondary);
}

.avatar-preview-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-preview-small {
    text-align: center;
}

.avatar-preview-small img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    object-fit: cover;
    display: block;
    margin: 0 auto 0.5rem;
}

.avatar-preview-small p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

.avatar-modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-save-avatar, .btn-cancel-avatar, .btn-remove-avatar {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.btn-save-avatar {
    background: var(--gradient-success);
    color: white;
}

.btn-cancel-avatar {
    background: var(--gradient-secondary);
    color: white;
}

.btn-remove-avatar {
    background: var(--gradient-danger);
    color: white;
}

.btn-save-avatar:hover, .btn-cancel-avatar:hover, .btn-remove-avatar:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ========================================
   15. NOTIFICATIONS SYSTEM
   ======================================== */

.notifications-bell {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important; 
    background: var(--gradient-secondary) !important;
    color: white !important;
    border: none !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 20px !important;
    cursor: pointer !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
    display: none !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: hidden !important;
    opacity: 0 !important;
}


.notifications-bell.user-logged-in {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.notifications-bell:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(45, 130, 181, 0.4) !important;
}



.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: pulse 2s infinite;
}

.notification-badge.hidden {
    display: none;
}

.notifications-panel {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    backdrop-filter: blur(15px);
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.notifications-panel.show {
    display: block;
    animation: slideInDown 0.3s ease;
}

.notifications-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--gradient-primary);
    color: white;
}

.notifications-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.mark-all-read {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    font-size: 12px;
    transition: color 0.3s ease;
}

.mark-all-read:hover {
    color: white;
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px 0;
}

.notification-item {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.notification-item:hover {
    background: var(--hover-bg);
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item.unread {
    background: rgba(45, 130, 181, 0.1);
    border-left: 3px solid var(--accent-3);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 8px;
    height: 8px;
    background: var(--accent-3);
    border-radius: 50%;
    transform: translateY(-50%);
}

.notification-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.notification-icon {
    font-size: 20px;
    margin-top: 2px;
}

.notification-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.notification-user {
    font-weight: 600;
    color: var(--accent-4);
}

.notification-message {
    color: var(--text-secondary);
    margin: 5px 0;
    font-size: 13px;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 5px;
}

.notification-thread {
    font-size: 12px;
    color: var(--accent-2);
    font-style: italic;
    margin-top: 3px;
}

.notifications-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.notifications-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* ========================================
   16. TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 15px 20px;
    backdrop-filter: blur(15px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    max-width: 350px;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
    position: relative;
    overflow: hidden;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.mention {
    border-left: 4px solid var(--accent-4);
}

.toast-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.toast-icon {
    font-size: 20px;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-user {
    font-weight: 600;
    color: var(--accent-4);
}

.toast-actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
}

.toast-btn {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toast-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(45, 130, 181, 0.4);
}

.toast-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* ========================================
   17. MENTIONS SYSTEM
   ======================================== */

.mention {
    background: rgba(45, 130, 181, 0.2);
    color: var(--accent-3);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid rgba(45, 130, 181, 0.3);
    transition: all 0.3s ease;
}

.mention:hover {
    background: rgba(45, 130, 181, 0.3);
    border-color: var(--accent-3);
}

.mention.self {
    background: rgba(66, 230, 164, 0.2);
    color: var(--accent-4);
    border-color: rgba(66, 230, 164, 0.3);
    animation: highlightMention 2s ease;
}

.mention-autocomplete {
    position: fixed !important;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    backdrop-filter: blur(15px);
    z-index: 10000 !important;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    display: none;
    min-width: 250px;
}

.mention-autocomplete.show {
    display: block;
}

.mention-suggestion {
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mention-suggestion:hover,
.mention-suggestion.selected {
    background: var(--hover-bg);
}

.mention-suggestion-avatar {
    width: 24px;
    height: 24px;
    background: var(--gradient-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    overflow: hidden;
    border: 1px solid var(--border);
}

.mention-suggestion-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.mention-suggestion-info {
    flex: 1;
}

.mention-suggestion-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mention-suggestion-clan {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   18. EMOTICONS E UTILITÀ
   ======================================== */

.emoticon-picker {
    position: relative;
}

.emoticon-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 0.5rem;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.emoticon-btn:hover {
    background: var(--hover-bg);
}

.emoticon-panel {
    position: absolute;
    bottom: 100%;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    display: none;
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.emoticon-panel.show {
    display: block;
}

.emoticon-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
}

.emoticon-item {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.emoticon-item:hover {
    background: var(--hover-bg);
    transform: scale(1.2);
}

/* ========================================
   19. MOBILE MENU
   ======================================== */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.mobile-overlay.show {
    display: block;
}

/* ========================================
   20. ADMIN PANELS
   ======================================== */

.admin-panel, .clan-management {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 2rem;
}

.admin-panel h3, .clan-management h3 {
    color: var(--accent-4);
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.users-grid, .clan-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.user-card, .clan-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
}

.user-card::before,
.clan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-secondary);
    border-radius: 15px 15px 0 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-card:hover, .clan-card:hover {
    border-color: var(--accent-2);
    transform: translateY(-2px);
}

.user-card:hover::before,
.clan-card:hover::before {
    opacity: 1;
}

.user-card-header {
    margin-bottom: 1rem;
}

.user-card-name {
    font-weight: 600;
    color: var(--accent-4);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-card-info {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-card-info div {
    margin-bottom: 0.3rem;
}

.user-card-actions, .clan-card .admin-btn {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-assign-clan, .btn-change-role {
    background: var(--gradient-primary);
    color: white;
}

.btn-remove-clan {
    background: var(--gradient-danger);
    color: white;
}

.admin-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.create-clan-btn {
    background: var(--gradient-secondary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.create-clan-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(45, 130, 181, 0.4);
}

.clan-members {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* ========================================
   21. LOADING E STATI
   ======================================== */

.loading {
    display: none;
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
}

.loading.show {
    display: block;
}

.error, .success {
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.error {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
}

.success {
    background: rgba(39, 174, 96, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.error.show, .success.show {
    opacity: 1;
    transform: translateY(0);
}

.pending-indicator {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.moderation-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.approve-btn, .reject-btn {
    padding: 0.3rem 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.approve-btn {
    background: var(--gradient-success);
    color: white;
}

.reject-btn {
    background: var(--gradient-danger);
    color: white;
}

.approve-btn:hover, .reject-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ========================================
   22. UTILITÀ E SCROLLBAR
   ======================================== */

.google-login-btn {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.google-login-btn:hover {
    background: var(--hover-bg);
    border-color: var(--accent-2);
}

.divider {
    text-align: center;
    margin: 1rem 0;
    position: relative;
    color: var(--text-muted);
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.divider span {
    background: var(--card-bg);
    padding: 0 1rem;
    position: relative;
    z-index: 1;
}

.registration-fields {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.registration-fields.show {
    max-height: 200px;
}

.form-buttons {
    margin-top: 1.5rem;
}

.thread-stats-mobile {
    display: none;
    gap: 1rem;
    margin-top: 0.5rem;
}

.thread-stats-mobile .stat {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.upload-progress {
    margin-top: 10px;
    display: none;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--primary-dark);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gradient-secondary);
}

/* ========================================
   23. ANIMAZIONI
   ======================================== */

@keyframes backgroundShift {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(5deg); }
}

@keyframes rotate {
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

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

@keyframes highlightMention {
    0%, 100% { 
        background: rgba(66, 230, 164, 0.2);
    }
    50% { 
        background: rgba(66, 230, 164, 0.4);
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.quick-action-btn {
    transition: all 0.3s ease;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* ========================================
   24. AVATAR FIX - PREVIENE APERTURA MODAL
   ======================================== */

/* Previeni il cursore pointer sugli avatar */
.avatar-image {
    cursor: default !important;
    pointer-events: auto !important;
}

/* Assicurati che gli avatar non abbiano effetti hover che suggeriscono clickabilità */
.user-avatar img,
.message-avatar img, 
.comment-avatar img,
.avatar-image {
    cursor: default !important;
    transition: none !important;
}

.user-avatar img:hover,
.message-avatar img:hover,
.comment-avatar img:hover,
.avatar-image:hover {
    transform: none !important;
    box-shadow: none !important;
    border-color: var(--border) !important;
}

/* Mantieni il cursore pointer solo per le immagini dei contenuti */
.thread-image img,
.comment-image img,
.comment-main-image {
    cursor: pointer !important;
}

.thread-image img:hover,
.comment-image img:hover,
.comment-main-image:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3) !important;
    border-color: var(--accent-2) !important;
}

/* Specifico per l'avatar dell'utente corrente (che può essere cambiato) */
.user-info .user-avatar {
    position: relative;
}

.user-info .user-avatar img {
    cursor: default !important;
}

/* Solo quando ci sono i controlli avatar visibili, abilita il click */
.avatar-controls:not([style*="display: none"]) + * .user-avatar img,
.avatar-controls[style*="display: block"] + * .user-avatar img {
    cursor: pointer !important;
}

/* Assicurati che gli avatar mantengano la loro forma */
.user-avatar,
.message-avatar,
.comment-avatar {
    border-radius: 50% !important;
    overflow: hidden !important;
    position: relative !important;
}

.user-avatar img,
.message-avatar img,
.comment-avatar img {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    z-index: 2 !important;
}

/* Stile per distinguere le immagini cliccabili dalle non cliccabili */
.comment-main-image,
.thread-image img {
    border: 2px solid transparent !important;
    transition: all 0.3s ease !important;
}

.comment-main-image:hover,
.thread-image img:hover {
    border-color: var(--accent-2) !important;
}

/* Fix per assicurarsi che gli avatar piccoli nella chat non siano cliccabili */
.message-avatar-small .comment-avatar,
.message-avatar-small .comment-avatar img {
    cursor: default !important;
    pointer-events: none !important;
}

/* Reset pointer events per tutto il container dell'avatar */
.message-avatar-small,
.comment-with-avatar > .comment-avatar,
.comment-with-avatar > .user-avatar,
.comment-with-avatar > .message-avatar {
    pointer-events: none !important;
}

/* Ma mantieni pointer events per il contenuto dei commenti */
.comment-content,
.message-text,
.thread-content {
    pointer-events: auto !important;
}

/* Stile specifico per indicare che le immagini dei contenuti sono cliccabili */
.thread-image,
.comment-image {
    position: relative;
}

.thread-image img::after,
.comment-image img::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.thread-image:hover img::after,
.comment-image:hover img::after {
    opacity: 1;
}

/* Assicurati che il modal non si apra per errore */
.image-modal {
    pointer-events: auto !important;
}

/* Avatar generali - OVERRIDE per immagini nei contenuti */
.message-avatar img, .comment-avatar img, .thread-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 2 !important;
    display: block !important;
}

/* ========================================
   25. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1024px) {
    .forum-header,
    .thread-item {
        grid-template-columns: 1fr 80px 100px 150px;
    }
    
    .main-content {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: 80px;
    }
    
    .connection-status {
        top: 80px;
        right: 90px;
    }
    
    .message-counter {
        top: 80px;
        right: 250px;
    }
    
    .notifications-bell.user-logged-in {
        top: 80px !important;
        right: 20px !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 18px !important;
    }
    
    .banner-title {
        font-size: 2rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .forum-header {
        display: none;
    }
    
    .thread-item {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .thread-stats-mobile {
        display: flex;
    }
    
    .thread-replies,
    .thread-stats,
    .thread-last-post {
        display: none;
    }
    
    .new-thread-btn {
        bottom: 1rem;
        right: 1rem;
    }
    
    .thread-creation-form,
    .login-form {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .users-grid,
    .clan-list {
        grid-template-columns: 1fr;
    }
    
    .thread-image img, .comment-image img {
        max-width: 100%;
        max-height: 250px;
        width: auto;
        height: auto;
    }
    
    .image-preview img {
        max-width: 100%;
        max-height: 150px;
    }
    
    .comment-input-main {
        flex-direction: column;
        gap: 10px;
    }
    
    .comment-controls {
        align-items: stretch;
        width: 100%;
    }
    
    .comment-controls > div:first-child {
        justify-content: center;
    }
    
    .image-modal img {
        max-width: 95%;
        max-height: 85%;
        margin-top: 5%;
    }
    
    .close-modal {
        font-size: 30px;
        top: 10px;
        right: 15px;
    }
    
    .thread-creation-form .image-preview img {
        max-height: 120px;
    }
    
    .dashboard-card {
        padding: 15px;
    }
    
    .dashboard-card div[style*="font-size: 32px"] {
        font-size: 24px !important;
    }
    
    .notifications-panel {
        top: 130px;
        right: 10px;
        left: 10px;
        width: auto;
        max-height: 400px;
    }
    
    .toast-container {
        top: 80px;
        right: 10px;
        left: 10px;
    }
    
    .toast {
        max-width: none;
        margin: 0 10px;
    }
    
    .mention-autocomplete {
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
        max-width: none !important;
    }
    
    .avatar-preview-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .avatar-modal-buttons {
        flex-direction: column;
    }
    
    .btn-save-avatar, .btn-cancel-avatar, .btn-remove-avatar {
        width: 100%;
    }
    
    .message-avatar, .comment-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .user-clan-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }
    .section-badge {
    right: 10px;
}

.nav-item {
    padding-right: 40px; /* Spazio per il badge */
}
}

@media (max-width: 480px) {
    .banner {
        padding: 2rem 1rem;
    }
    
    .banner-title {
        font-size: 1.5rem;
    }
    
    .header h2 {
        font-size: 1.5rem;
    }
    
    .thread-header h1 {
        font-size: 1.5rem;
    }
    
    .chat-input {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chat-input button {
        width: 100%;
    }
    
    .thread-image img, .comment-image img {
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
    }
    
    .image-preview img {
        max-width: 100%;
        max-height: 120px;
    }
    
    .comment-input-main {
        flex-direction: column;
        align-items: stretch;
    }
    
    .comment-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .comment-controls > div:first-child {
        justify-content: flex-start;
    }
    
    .image-modal img {
        max-width: 90%;
        max-height: 80%;
        margin-top: 10%;
    }
    
    .close-modal {
        font-size: 24px;
        top: 5px;
        right: 10px;
    }
    
    .small-upload-btn {
        min-width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .emoticon-btn {
        padding: 6px;
        font-size: 14px;
    }
    
    .comment-image-upload .image-upload-label {
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .comment-image-upload .image-preview img {
        max-height: 100px;
    }
    
    .thread-creation-form .image-preview img {
        max-height: 100px;
    }
    
    .remove-image {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .notifications-bell.user-logged-in {
        top: 20px !important;
        right: 20px !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 18px !important;
    }
    
    .notification-badge {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }
    
    .notifications-header {
        padding: 12px 15px;
    }
    
    .notification-item {
        padding: 12px 15px;
    }
    
    .toast {
        padding: 12px 15px;
    }
    
    .toast-header {
        margin-bottom: 6px;
    }
    
    .message-with-avatar, .comment-with-avatar {
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    .message-avatar, .comment-avatar {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }
    
    .user-clan-badge {
        display: block;
        margin: 0.2rem 0 0 0;
        text-align: center;
    }
    
    .message-header, .comment-header {
        flex-wrap: wrap;
    }
	
	.connection-status, .message-counter {
        display: none;
    }
}


/* Fix Modal Login - Scrollabile su Mobile */
.login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Cambiato da center a flex-start */
    z-index: 1000;
    overflow-y: auto; /* Aggiungi scroll */
    padding: 20px 0; /* Padding per sicurezza */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling iOS */
}

.login-form {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    backdrop-filter: blur(15px);
    margin: auto; /* Centro automaticamente */
    min-height: fit-content;
    max-height: none; /* Rimuovi limitazione altezza */
    position: relative; /* Importante per il posizionamento */
    flex-shrink: 0; /* Previeni compressione */
}

/* Fix Username Modal - Stesso trattamento */
.username-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Cambiato da center */
    z-index: 2000;
    backdrop-filter: blur(10px);
    overflow-y: auto; /* Aggiungi scroll */
    padding: 20px 0;
    -webkit-overflow-scrolling: touch;
}

.username-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    position: relative;
    margin: auto;
    max-height: none;
    flex-shrink: 0;
}

/* Specifico per iPhone e dispositivi con viewport piccolo */
@media (max-height: 700px) {
    .login-modal,
    .username-modal {
        align-items: flex-start !important;
        padding: 10px 0;
    }
    
    .login-form,
    .username-modal-content {
        margin: 10px auto;
        padding: 1.5rem;
        border-radius: 15px;
    }
    
    .login-form h2,
    .username-header h2 {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
    }
    
    /* Riduci padding per form groups */
    .login-form .form-group,
    .username-form .form-group {
        margin-bottom: 0.8rem;
    }
    
    /* Riduci dimensioni input */
    .login-form input,
    .username-form input,
    .username-form select,
    .google-login-btn {
        padding: 0.8rem;
        font-size: 0.95rem;
    }
    
    /* Riduci reCAPTCHA su mobile */
    #recaptcha-container {
        transform: scale(0.8);
        transform-origin: center;
        margin: 10px 0;
    }
    
    /* Ottimizza username hints */
    .username-hints {
        padding: 0.8rem;
        margin-top: 0.6rem;
    }
    
    .hint-item {
        font-size: 0.75rem;
        margin-bottom: 0.2rem;
    }
}

/* Fix specifico per iPhone piccoli (iPhone SE, 11 Pro, etc.) */
@media (max-width: 480px) and (max-height: 900px) {
    .login-modal,
    .username-modal {
        padding: 5px;
        align-items: flex-start;
    }
    
    .login-form,
    .username-modal-content {
        width: 95%;
        margin: 5px auto;
        padding: 1.2rem;
        border-radius: 15px;
    }
    
    .login-tabs {
        margin-bottom: 1rem;
        padding: 0.2rem;
    }
    
    .login-tab {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    /* Nascondi elementi non essenziali su schermi molto piccoli */
    .divider {
        margin: 0.8rem 0;
    }
    
    .divider span {
        font-size: 0.85rem;
    }
    
    /* Ottimizza pulsanti per mobile */
    .btn-primary,
    .btn-save-username {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
    }
    
    /* Ridimensiona reCAPTCHA per schermi piccoli */
    #recaptcha-container {
        transform: scale(0.75);
        margin: 5px 0;
    }
    
    /* Username modal specifico */
    .username-header p {
        font-size: 0.9rem;
        line-height: 1.4;
    }
    
    .username-validation {
        font-size: 0.75rem;
        min-height: 18px;
    }
    
    .form-help {
        font-size: 0.75rem;
    }
    
    .action-note {
        font-size: 0.7rem;
    }
}

/* Fix per dispositivi con notch (iPhone X e successivi) */
@media (max-width: 480px) and (min-height: 800px) {
    .login-modal,
    .username-modal {
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* Assicurati che i modal non abbiano problemi di z-index */
.login-modal {
    z-index: 1000;
}

.username-modal {
    z-index: 2000;
}

/* Fix per browser che non supportano backdrop-filter */
@supports not (backdrop-filter: blur(15px)) {
    .login-form,
    .username-modal-content {
        background: rgba(26, 27, 46, 0.95);
    }
}

/* Fix per Safari mobile con problemi di overflow */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .login-modal,
    .username-modal {
        -webkit-overflow-scrolling: touch;
        overflow-y: auto;
    }
    
    /* Forza rendering corretto su Safari */
    .login-form,
    .username-modal-content {
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
}

/* Loading spinner per username modal */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.username-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top: 3px solid var(--accent-3);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Fix input focus su iOS */
.login-form input:focus,
.username-form input:focus,
.username-form select:focus {
    /* Previeni zoom automatico su iOS */
    font-size: 16px;
    transform: none;
}

/* Ridimensiona input se la font-size causa problemi */
@media (max-width: 480px) {
    .login-form input,
    .username-form input,
    .username-form select {
        font-size: 16px !important; /* Previeni zoom iOS */
    }
}

/* =============================================== */
/* STILI CSS PER SISTEMA BENVENUTO NUOVI UTENTI */
/* Da aggiungere a style.css */
/* =============================================== */

/* Messaggi di sistema nella chat */
.message-bubble-container.system-message {
    justify-content: center;
    margin: 20px 0;
    padding: 0 20px;
}

.message-bubble.system-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 15px 25px;
    border-radius: 25px;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    max-width: 85%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
    line-height: 1.4;
}

.message-bubble.system-bubble::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 3s infinite;
}

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

.system-message .message-avatar-small,
.system-message .message-avatar-spacer {
    display: none !important;
}

.system-bubble .message-text {
    font-size: 1rem;
    margin-bottom: 8px;
}

.system-bubble .message-meta {
    margin-top: 5px;
}

.system-bubble .message-time-bubble {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Menzioni nei messaggi di sistema */
.system-bubble .mention {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.system-bubble .mention.self {
    background: rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
    color: #ffd700;
}

/* Notifiche nuovo utente */
.notification-item.new-user {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    transition: all 0.3s ease;
}

.notification-item.new-user:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    transform: translateX(3px);
}

.notification-item.new-user .notification-icon {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.notification-item.new-user .notification-user {
    color: #667eea;
    font-weight: 700;
}

.notification-item.new-user .notification-message {
    color: #4a5568;
    font-weight: 500;
}

/* Badge per primi utenti/superuser nelle notifiche */
.notification-item.new-user.first-user {
    border-left-color: #ffd700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1) 0%, rgba(255, 193, 7, 0.1) 100%);
}

.notification-item.new-user.first-user .notification-icon {
    background: linear-gradient(135deg, #ffd700 0%, #ffc107 100%);
    color: #000;
}

.notification-item.new-user.first-user .notification-icon::after {
    content: '👑';
    position: absolute;
    top: -2px;
    right: -2px;
    font-size: 10px;
}

/* Animazione per notifiche nuovi utenti */
.notification-item.new-user.unread {
    animation: newUserGlow 2s infinite alternate;
}

@keyframes newUserGlow {
    0% { box-shadow: 0 0 0 rgba(102, 126, 234, 0.4); }
    100% { box-shadow: 0 0 10px rgba(102, 126, 234, 0.6); }
}

/* Toast per nuovi utenti */
.toast.new-user {
    border-left: 4px solid #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    color: white;
    backdrop-filter: blur(10px);
}

.toast.new-user .toast-icon {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast.new-user .toast-title {
    color: white;
    font-weight: 700;
}

.toast.new-user .toast-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.toast.new-user .toast-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.toast.new-user .toast-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Responsive design per messaggi di sistema */
@media (max-width: 768px) {
    .message-bubble-container.system-message {
        margin: 15px 0;
        padding: 0 10px;
    }
    
    .message-bubble.system-bubble {
        padding: 12px 20px;
        max-width: 95%;
        font-size: 0.9rem;
    }
    
    .system-bubble .message-text {
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .message-bubble.system-bubble {
        padding: 10px 15px;
        border-radius: 20px;
    }
    
    .system-bubble .message-text {
        font-size: 0.85rem;
    }
    
    .notification-item.new-user .notification-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Dark mode support per messaggi di sistema */
@media (prefers-color-scheme: dark) {
    .message-bubble.system-bubble {
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    }
    
    .notification-item.new-user {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    }
    
    .notification-item.new-user:hover {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    }
}

/* Animazione di entrata per messaggi di sistema */
.message-bubble.system-bubble {
    animation: systemMessageEntry 0.6s ease-out;
}

@keyframes systemMessageEntry {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(20px);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05) translateY(-5px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Effetto hover per messaggi di sistema */
.message-bubble.system-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    transition: all 0.3s ease;
}

/* Icone speciali per diversi tipi di benvenuto */
.system-bubble.welcome-first-user::before {
    content: '👑';
    position: absolute;
    top: -5px;
    right: 10px;
    font-size: 1.2em;
    animation: crownBounce 2s infinite;
}

@keyframes crownBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}