/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #0f172a;
    --dark-lighter: #1e293b;
    --dark-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border: #475569;
    --header-height: 64px;
}

/* Tema Claro */
[data-theme="light"] {
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --secondary: #8b5cf6;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #ffffff;
    --dark-lighter: #f8fafc;
    --dark-card: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
}

[data-theme="light"] .login-card,
[data-theme="light"] .header,
[data-theme="light"] .sidebar,
[data-theme="light"] .room-card,
[data-theme="light"] .connection-status {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e8f0;
}

[data-theme="light"] .header,
[data-theme="light"] .sidebar {
    backdrop-filter: blur(10px);
}

[data-theme="light"] .room-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .room-card.current {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 4px 6px -1px rgba(14, 165, 233, 0.2);
}

[data-theme="light"] .user-item:hover,
[data-theme="light"] .icon-btn:hover,
[data-theme="light"] .user-btn:hover,
[data-theme="light"] .dropdown-item:hover {
    background: #f1f5f9;
}

[data-theme="light"] .search-input {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--text-primary);
}

[data-theme="light"] .search-input::placeholder {
    color: #94a3b8;
}

[data-theme="light"] .user-dropdown {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .toast {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--text-primary);
}

[data-theme="light"] .dashboard {
    background: transparent;
}

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--dark) 0%, #1e1b4b 100%);
    color: var(--text-primary);
    height: 100%;
    overflow-x: hidden;
}

body.login-page {
    background: url('../assets/login-bg.png') center center / cover no-repeat;
    background-color: #0052cc;
    background-attachment: fixed;
    position: relative;
    min-height: 100vh;
}

body.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 82, 204, 0.2);
    z-index: 0;
}

/* Logo */
.login-header-logo {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    animation: fadeInUp 0.6s ease-out;
}

.login-header-logo img {
    height: 80px;
    width: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.login-header-logo img:hover {
    transform: scale(1.05);
}

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

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

@media (max-width: 768px) {
    .login-header-logo {
        bottom: 1rem;
        right: 1rem;
    }

    .login-header-logo img {
        height: 60px;
    }
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.login-card {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    padding: 3rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: fadeInUp 0.6s ease-out;
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.login-footer p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

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

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.login-logo img {
    max-width: 100%;
    height: auto;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Ajuste do Botão de Login para SVG */
.login-btn-modern {
    width: 100%;
    padding: 1.25rem 2rem;
    background-image: url('../assets/login-btn-modern.svg');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    color: #1e293b;
    border: none;
    /* ALTERADO: Restaurado border-radius para acompanhar o formato do botão */
    border-radius: 12px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    /* ALTERADO: Mudado para hidden para cortar o brilho que sai da área */
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: none;
    /* Remove sombra CSS para usar a do SVG */
    letter-spacing: 0.5px;
}

.login-btn-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    position: relative;
    z-index: 2;
}

.login-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
    z-index: 1;
    pointer-events: none;
}

.login-btn-modern:hover {
    transform: translateY(-2px) scale(1.01);
    filter: brightness(1.1);
}

.login-btn-modern:hover .login-btn-shine {
    left: 100%;
}

.login-btn-modern:active {
    transform: translateY(0) scale(0.98);
    filter: brightness(0.95);
}

.login-btn-modern:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
}

/* Header */
.header {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.menu-btn:hover {
    background: var(--dark-card);
    color: var(--text-primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    height: 32px;
    width: auto;
}

.room-search {
    max-width: 250px;
    width: 100%;
    position: relative;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--dark-card);
    color: var(--text-primary);
}

.icon-btn.active {
    background: var(--primary);
    color: white;
}

.user-menu {
    position: relative;
}

.user-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    transition: all 0.2s;
}

.user-btn:hover {
    background: var(--dark-card);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-name {
    color: var(--text-primary);
    font-weight: 500;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--dark-lighter);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    min-width: 200px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--dark-card);
}

/* Main Content */
.main-content {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, margin-left 0.3s ease;
    position: relative;
    z-index: 100;
    flex-shrink: 0;
    overflow: hidden;
    height: 100%;
}

.sidebar.hidden {
    margin-left: -320px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* REMOVIDO DAQUI: .sidebar-backdrop.active { ... } 
   Isso evita que o fundo escuro apareça no Desktop */

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--header-height);
        bottom: 0;
        z-index: 999;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
        margin-left: 0;
    }

    /* APLICADO AQUI: O fundo escuro só ativa em telas menores */
    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar.hidden {
        margin-left: 0;
        transform: translateX(-100%);
    }

    .sidebar:not(.hidden) {
        transform: translateX(0);
    }
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Adicionado para corrigir o posicionamento do ícone na sidebar */
.search-box {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    background: var(--dark-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.user-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.user-item:hover {
    background: var(--dark-card);
}

.user-item-avatar {
    position: relative;
}

.user-item-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.user-item-avatar.in-call img {
    border: 2px solid var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

.user-item-avatar.in-call::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12v4c0 1.1.9 2 2 2h2v-6H4v-2c0-4.4 3.6-8 8-8s8 3.6 8 8v2h-2v6h2c1.1 0 2-.9 2-2v-4c0-5.5-4.5-10-10-10z' fill='%235DADE2' stroke='%235DADE2' stroke-width='1'/%3E%3Crect x='3' y='12' width='3' height='6' rx='1.5' fill='%233498DB' stroke='%232980B9' stroke-width='0.5'/%3E%3Crect x='18' y='12' width='3' height='6' rx='1.5' fill='%233498DB' stroke='%232980B9' stroke-width='0.5'/%3E%3Cline x1='4.5' y1='14' x2='4.5' y2='16' stroke='%235DADE2' stroke-width='0.5' opacity='0.5'/%3E%3Cline x1='19.5' y1='14' x2='19.5' y2='16' stroke='%235DADE2' stroke-width='0.5' opacity='0.5'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    animation: headsetPulse 2s ease-in-out infinite;
    z-index: 1;
}

.user-item-avatar.in-call .call-badge {
    display: none;
}

.call-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: var(--success);
    border-radius: 50%;
    border: 2px solid var(--dark-lighter);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.user-item-info {
    flex: 1;
    min-width: 0;
}

.user-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-item-room {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Room Grid */
.room-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.room-grid {
    display: grid;
    gap: 1.5rem;
}

/* Virtual Scrolling: Quando ativo, mantém espaçamento consistente */
.room-grid[style*="position: relative"] {
    display: block;
}

@media (max-width: 600px) {
    .room-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .room-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 901px) {
    .room-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.room-card {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    border-color: var(--primary);
}

.room-card.current {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.room-card.in-call {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    animation: cardCallPulse 2s ease-in-out infinite;
}

@keyframes cardCallPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.3);
    }
}

.room-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.room-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.room-count {
    background: var(--dark-card);
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 999px;
    margin-left: 6px;
}

.call-indicator {
    display: inline-flex;
    align-items: center;
    color: var(--success);
    animation: phoneRing 1s ease-in-out infinite;
}

@keyframes phoneRing {

    0%,
    50%,
    100% {
        transform: rotate(0deg);
    }

    10%,
    30% {
        transform: rotate(-10deg);
    }

    20%,
    40% {
        transform: rotate(10deg);
    }
}

.room-body {
    padding: 1.25rem;
    flex: 1;
    min-height: 100px;
    display: flex;
    flex-direction: column;
}

.room-users {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    overflow: visible;
    max-height: none;
}

.room-user-avatar {
    position: relative;
    width: 40px;
    height: 40px;
}

.room-user-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid var(--border);
}

.room-user-avatar.in-call img {
    border-color: var(--success);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
}

/* Headset SVG overlay nas salas */
.room-user-avatar.in-call::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 2C6.5 2 2 6.5 2 12v4c0 1.1.9 2 2 2h2v-6H4v-2c0-4.4 3.6-8 8-8s8 3.6 8 8v2h-2v6h2c1.1 0 2-.9 2-2v-4c0-5.5-4.5-10-10-10z' fill='%235DADE2' stroke='%235DADE2' stroke-width='1'/%3E%3Crect x='3' y='12' width='3' height='6' rx='1.5' fill='%233498DB' stroke='%232980B9' stroke-width='0.5'/%3E%3Crect x='18' y='12' width='3' height='6' rx='1.5' fill='%233498DB' stroke='%232980B9' stroke-width='0.5'/%3E%3Cline x1='4.5' y1='14' x2='4.5' y2='16' stroke='%235DADE2' stroke-width='0.5' opacity='0.5'/%3E%3Cline x1='19.5' y1='14' x2='19.5' y2='16' stroke='%235DADE2' stroke-width='0.5' opacity='0.5'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    animation: headsetPulse 2s ease-in-out infinite;
    z-index: 1;
}

.room-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn {
    flex: 1 1 auto;
    padding: 0.75rem 1rem;
    border: none;
    /* Removemos borda padrão e radius para usar a imagem full */
    border-radius: 0;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 120px;
    white-space: nowrap;
    /* Configurações para imagens SVG */
    background-color: transparent;
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    /* Remove sombras e bordas que atrapalham o SVG */
    box-shadow: none;
    overflow: visible;
}

.btn-primary {
    background-image: url('../assets/btn-primary.svg');
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

.btn-success {
    background-image: url('../assets/btn-success.svg');
    color: white;
}

.btn-success:hover {
    filter: brightness(1.1);
}

.btn-danger {
    background-image: url('../assets/btn-danger.svg');
    color: white;
}

.btn-danger:hover {
    filter: brightness(1.1);
}

.btn-secondary {
    background-image: url('../assets/btn-secondary.svg');
    color: var(--text-primary);
}

.btn-secondary:hover {
    filter: brightness(1.1);
}

.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--dark-lighter);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideInRight 0.3s ease-out;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

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

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

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.connection-status {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.25rem;
    background: var(--dark-lighter);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    transition: all 0.3s;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
}

.connection-status.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.connection-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.connection-status.connecting .connection-status-dot {
    background: var(--warning);
    animation: pulse 2s ease-in-out infinite;
}

.connection-status.connected .connection-status-dot {
    background: var(--success);
}

@keyframes pulse {

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

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes headsetPulse {

    0%,
    100% {
        opacity: 0.9;
        filter: drop-shadow(0 0 4px rgba(93, 173, 226, 0.6));
    }

    50% {
        opacity: 1;
        filter: drop-shadow(0 0 8px rgba(93, 173, 226, 0.9));
    }
}

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

::-webkit-scrollbar-track {
    background: var(--dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-card);
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1000;
    }

    .room-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .user-name {
        display: none;
    }
}

.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

/* =========================================
   🎄 TEMA ESPECIAL DE NATAL (FINAL) 🎅
   ========================================= */

body.theme-christmas {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
    position: relative;
    overflow-x: hidden;
    /* Evita barra de rolagem lateral com neve caindo */
}

/* Overrides de Botões para o Tema de Natal */
body.theme-christmas .btn-primary {
    background-image: url('../assets/btn-primary-natal.svg');
}

body.theme-christmas .btn-secondary {
    background-image: url('../assets/btn-secondary-natal.svg');
}

body.theme-christmas .btn-success {
    background-image: url('../assets/btn-success-natal.svg');
}

body.theme-christmas .btn-danger {
    background-image: url('../assets/btn-danger-natal.svg');
}

body.theme-christmas .login-btn-modern {
    background-image: url('../assets/login-btn-modern-natal.svg');
}

/* Remover o pseudo-elemento 'before' de neve dos botões para limpar o visual */
body.theme-christmas .btn::before {
    display: none;
}

/* Ajuste específico para o botão de login no Natal se necessário, 
   mas mantendo o overflow hidden para o shine não vazar */
body.theme-christmas .login-btn-modern {
    overflow: hidden;
}

body.login-page.theme-christmas {
    background: linear-gradient(rgba(11, 17, 33, 0.5), rgba(11, 17, 33, 0.5)), url('../assets/login-bg_nt.png');
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-color: #0b1121;
    background-attachment: fixed;
}

/* Remove overlay antigo */
body.login-page.theme-christmas::before {
    background: none;
}

/* Remove efeito de neve antigo via CSS */
body.theme-christmas::before,
body.theme-christmas::after {
    background-image: none;
    animation: none;
}

/* Garante que os cards fiquem acima da neve JS */
body.theme-christmas .room-card,
body.theme-christmas .login-card {
    position: relative;
    z-index: 10;
}

/* CORREÇÃO CRÍTICA: Força Sidebar e Header acima do backdrop (98) e neve no modo Natal */
body.theme-christmas .sidebar,
body.theme-christmas .header {
    z-index: 1001 !important;
    position: relative;
    /* Garante contexto de empilhamento */
}

/* No mobile, a sidebar já é fixed, mas reforçamos para garantir que a regra acima não quebre o layout */
@media (max-width: 1024px) {
    body.theme-christmas .sidebar {
        position: fixed;
    }
}

body.theme-christmas .room-card,
body.theme-christmas .login-card {
    overflow: visible !important;
    border-top: none;
    margin-top: 25px;
}

/* --- PISCA-PISCA EM "U" INTERCALADO E UNIFORME --- */
body.theme-christmas .room-card::before,
body.theme-christmas .login-card::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='20' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E@keyframes blink1 {0%,100%{opacity:1}50%{opacity:0.3}} @keyframes blink2 {0%,100%{opacity:0.3}50%{opacity:1}} .odd{animation:blink1 1s infinite} .even{animation:blink2 1s infinite}%3C/style%3E%3Cpath d='M0,0 Q15,20 30,0' fill='none' stroke='%23222' stroke-width='1.5'/%3E%3Cpath d='M30,0 Q45,12 60,0' fill='none' stroke='%23222' stroke-width='1.5'/%3E%3Ccircle cx='15' cy='10' r='3' fill='%23ff3333' class='odd'/%3E%3Ccircle cx='45' cy='6' r='3' fill='%2333cc33' class='even'/%3E%3C/svg%3E");
    background-repeat: repeat-x;
    background-size: 60px 20px;
    z-index: 20;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.3));
}

/* --- BOLINHAS DE NATAL (Ornaments) --- */
body.theme-christmas .room-card .room-header::before,
body.theme-christmas .login-card .login-logo::before {
    content: '🔴';
    position: absolute;
    top: -15px;
    right: 15px;
    font-size: 18px;
    border-top: 15px solid #999;
    width: 2px;
    height: 0;
    line-height: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: ornament-swing 3s ease-in-out infinite alternate;
    z-index: 18;
    pointer-events: none;
}

body.theme-christmas .login-card .login-logo::before {
    content: '🟡';
    right: auto;
    left: 20px;
    top: -10px;
    animation-delay: 0.5s;
}

@keyframes ornament-swing {
    0% {
        transform: rotate(-5deg);
        transform-origin: top center;
    }

    100% {
        transform: rotate(5deg);
        transform-origin: top center;
    }
}

/* --- PAPAI NOEL REPOSICIONADO --- */
body.theme-christmas .login-card::after {
    content: '🎅';
    position: absolute;
    top: -35px;
    right: -10px;
    font-size: 50px;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.4));
    animation: santa-peek 4s ease-in-out infinite;
    z-index: 5;
}

@keyframes santa-peek {

    0%,
    100% {
        transform: rotate(0deg) translateY(0);
    }

    50% {
        transform: rotate(10deg) translateY(-5px);
    }
}

/* --- NOVA MOLDURA DE NATAL (TOUCA + BARBA) --- */
body.theme-christmas .user-item-avatar.in-call::before,
body.theme-christmas .room-user-avatar.in-call::before {
    /* Usa o arquivo SVG atualizado */
    background-image: url('../assets/santa-hat.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;

    /* Remover filtros/animações antigas que conflitavam */
    transform: none;
    animation: none;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.4));

    z-index: 10;
    pointer-events: none;
    content: '';
    position: absolute;
}

/* Ajuste para os avatares nas SALAS (Tamanho base ~40px) */
body.theme-christmas .room-user-avatar.in-call::before {
    /* O SVG é vertical (172x300). O buraco do rosto está no meio.
       Para um avatar de 40px, a moldura deve ser aprox 48px de largura por 84px de altura
       para que o rosto encaixe no buraco */
    width: 48px;
    height: 84px;

    /* Posicionamento para alinhar o buraco com o avatar */
    top: -27px;
    /* Sobe para cobrir testa e barba */
    left: -1px;
    /* Centraliza horizontalmente */
}

/* Ajuste para os avatares na SIDEBAR (Tamanho base ~44px) */
body.theme-christmas .user-item-avatar.in-call::before {
    /* Escala ligeiramente maior para avatar de 44px */
    width: 53px;
    height: 92px;

    top: -24px;
    left: -1px;
}

/* Estilos para os flocos de neve JS */
.snowflake {
    position: fixed;
    top: -50px;
    z-index: 1;
    /* Fica atrás dos cards (z-index 10) mas na frente do bg */
    pointer-events: none;
    animation-name: fall;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(110vh);
    }
}

/* --- CORREÇÃO DE ESPAÇAMENTO (EVITAR SOBREPOSIÇÃO DE TOUCAS) --- */
/* Aumenta o espaçamento vertical entre os usuários para que a touca de um não cubra o rosto do outro acima */
body.theme-christmas .room-users {
    row-gap: 32px !important;
    /* Espaço generoso para a touca (aprox 27px de altura extra) */
    padding-top: 12px;
    /* Garante que a primeira linha de toucas não seja cortada pelo header */
}

body.theme-christmas .user-list .user-item {
    margin-bottom: 24px !important;
    /* Mais espaço vertical na lista lateral */
    margin-top: 8px;
    /* Um pouco de respiro no topo */
}