:root {
    --bg-darker: #050505;
    --bg-main: #0a0b0d;
    --bg-panel: #111214;
    --bg-hover: #1b1c1f;
    --accent: #1fbbaa;
    --accent-light: #48d1cc;
    --accent-glow: rgba(31, 186, 170, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #8e9297;
    --border-color: #1f2124;
    --red: #ff4b4b;
    --radius-lg: 24px;
    --radius-md: 16px;
    --shadow-pro: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    outline: none;
}

body {
    background: var(--bg-darker);
    color: var(--text-primary);
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Premium Layout */
.pro-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: var(--bg-darker);
}

/* 1. Sidebar Narow */
.side-nav {
    width: 76px;
    background: var(--bg-main);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    margin-bottom: 40px;
    cursor: pointer;
}

.nav-links {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.nav-item {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item:hover,
.nav-item.active {
    background: var(--accent-glow);
    color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.profile-avatar {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.3s;
}

.profile-avatar:hover {
    border-color: var(--accent);
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 2. Side Panel (Lists) */
.side-panel {
    width: 320px;
    background: var(--bg-main);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 32px;
}

.panel-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.btn-add-demo {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 14px;
    color: var(--text-secondary);
}

.search-box input {
    width: 100%;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 10px 10px 10px 40px;
    color: white;
    font-size: 14px;
}

.list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    max-height: 40vh;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: 0.2s;
}

.list-item:hover,
.list-item.active {
    background: var(--bg-hover);
}

.item-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-panel);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.item-avatar.orange {
    color: #ff9f43;
}

.item-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.item-info {
    flex: 1;
    overflow: hidden;
}

.item-info h4 {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-info p {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 3. Main View Area */
.main-view {
    flex: 1;
    background: var(--bg-darker);
    display: flex;
    flex-direction: column;
}

.view-header {
    height: 80px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    background: var(--bg-main);
}

.selected-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    overflow: hidden;
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-label {
    font-size: 11px;
}

.status-label.online::before {
    content: '•';
    color: var(--accent);
    margin-right: 4px;
}

.header-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.3s;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn.call {
    color: #1fbbaa;
}

.action-btn.video {
    color: #1fbbaa;
}

.action-btn.map-toggle {
    color: #6c5ce7;
}

/* View Body (Chat or Map) */
.view-body {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 24px 32px;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-right: 16px;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 16px;
}

.empty-state i {
    font-size: 48px;
    opacity: 0.2;
}

/* Chat Bubbles */
.message {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 20px;
    font-size: 14px;
    line-height: 1.6;
    position: relative;
}

.message.received {
    align-self: flex-start;
    background: var(--bg-panel);
    border-bottom-left-radius: 4px;
    color: #e0e0e0;
}

.message.sent {
    align-self: flex-end;
    background: #0d3b38;
    /* Dark teal background */
    border: 1px solid var(--accent);
    border-bottom-right-radius: 4px;
}

.message img {
    max-width: 100%;
    border-radius: 12px;
    display: block;
    margin: 8px 0;
}

/* Chat Footer Controls */
.chat-controls {
    padding-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.quick-actions {
    display: flex;
    gap: 12px;
}

.btn-pill {
    padding: 8px 20px;
    border-radius: 30px;
    background: transparent;
    border: 1px dashed var(--accent);
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-pill:hover {
    background: var(--accent-glow);
}

.input-area {
    display: flex;
    align-items: center;
    background: var(--bg-panel);
    border-radius: 16px;
    padding: 12px 16px;
    gap: 12px;
}

.attach-btn {
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
}

.input-area input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    font-size: 15px;
}

.send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Map Viewport */
.map-viewport {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
}

#map {
    width: 100%;
    height: 100%;
}

.map-overlay-info {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 12px;
}

/* Auth / Modal Glassmorphism */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
}

.login-box {
    width: 100%;
    max-width: 420px;
    background: rgba(17, 18, 20, 0.8);
    padding: 48px;
    border-radius: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-pro);
}

.brand {
    text-align: center;
    margin-bottom: 40px;
}

.brand-text {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff !important;
    letter-spacing: -1px;
    display: inline-block;
}

.brand-text.sidebar-logo {
    font-size: 24px !important;
}

.dot {
    color: #3b82f6;
    /* Bright blue for the dot */
    font-weight: 900;
}

/* .nav-brand removido de aqui para evitar doble definicion */

.input-group {
    position: relative;
    margin-bottom: 20px;
}

.input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    background: #111;
    border: 1px solid var(--border-color);
    padding: 16px 16px 16px 48px;
    border-radius: 16px;
    color: white;
}

.btn-primary {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--accent-light);
    transform: translateY(-2px);
}

/* Call UI */
/* Call UI - Premium Modern */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(31, 186, 170, 0.2) 0%, rgba(0, 0, 0, 0.95) 100%);
    backdrop-filter: blur(25px);
}

.call-card {
    text-align: center;
    padding: 60px 40px;
    width: 100%;
    max-width: 450px;
}

.call-avatar-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 32px;
}

.call-avatar-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--accent);
    position: relative;
    z-index: 2;
    object-fit: cover;
}

.pulse-aura {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent);
    border-radius: 50%;
    animation: pulse-ring 2s infinite;
    z-index: 1;
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.call-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -1px;
    color: white;
}

.call-header p {
    font-size: 14px;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 2px;
}

.call-actions {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-top: 48px;
}

.call-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-btn:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

.call-btn.hangup {
    background: #ff3b30;
    box-shadow: 0 0 20px rgba(255, 59, 48, 0.4);
}

.call-btn.answer {
    background: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

/* Generic Flex Helpers */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .side-nav {
        display: none;
    }

    .side-panel {
        width: 100%;
        border-right: none;
    }

    .main-view {
        display: none;
    }

    /* On mobile, we switch views */
}