/* ================================================================
   DARK OBSIDIAN LIQUID GLASS — Premium Design System
   Inspired by Apple iOS 26 Liquid Glass
   ================================================================ */

:root {
    /* === Core Palette === */
    --bg-dark: #060810;
    --bg-deep: #0a0d18;
    --card-bg: rgba(12, 15, 28, 0.6);
    --card-border: rgba(255, 255, 255, 0.06);

    --text-primary: #eef0f6;
    --text-secondary: #9199ae;
    --text-muted: #5a6178;

    --neon-blue: #4f8ff7;
    --neon-blue-hover: #3a7ce8;
    --neon-blue-glow: rgba(79, 143, 247, 0.35);

    --neon-green: #22d89a;
    --neon-green-glow: rgba(34, 216, 154, 0.35);

    --neon-red: #f25656;
    --border-color: rgba(255, 255, 255, 0.06);

    /* === Typography === */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Space Grotesk', sans-serif;

    /* === Message Bubbles === */
    --msg-sent-bg: rgba(79, 143, 247, 0.14);
    --msg-sent-border: rgba(79, 143, 247, 0.22);
    --msg-received-bg: rgba(255, 255, 255, 0.04);
    --msg-received-border: rgba(255, 255, 255, 0.06);

    /* === Liquid Glass Tokens === */
    --glass-bg: rgba(14, 17, 32, 0.55);
    --glass-bg-hover: rgba(22, 26, 44, 0.55);
    --glass-surface: rgba(20, 24, 42, 0.45);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-highlight: rgba(255, 255, 255, 0.09);
    --glass-blur: blur(40px) saturate(180%);
    --glass-blur-light: blur(24px) saturate(150%);
    --specular-top: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    --specular-left: inset 1px 0 0 rgba(255, 255, 255, 0.04);
    --depth-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.2),
        0 0 1px rgba(255, 255, 255, 0.05);
    --depth-shadow-heavy:
        0 24px 80px rgba(0, 0, 0, 0.5),
        0 8px 24px rgba(0, 0, 0, 0.3),
        0 0 1px rgba(255, 255, 255, 0.06);
    --refraction-border: linear-gradient(
        135deg,
        rgba(79, 143, 247, 0.2) 0%,
        rgba(139, 92, 246, 0.12) 30%,
        rgba(34, 216, 154, 0.15) 60%,
        rgba(255, 255, 255, 0.06) 100%
    );
}

/* ================================================================
   BASE RESET & GLOBAL STYLES
   ================================================================ */

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Liquid Glass Ambient Background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 15% 25%, rgba(79, 143, 247, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 500px 500px at 85% 75%, rgba(34, 216, 154, 0.05) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 10%, rgba(139, 92, 246, 0.04) 0%, transparent 70%),
        radial-gradient(ellipse 350px 350px at 70% 40%, rgba(79, 143, 247, 0.03) 0%, transparent 70%);
    animation: ambientDrift 25s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

/* Subtle noise texture overlay for glass realism */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    z-index: 0;
    pointer-events: none;
}

#app-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* ================================================================
   GLASS SCROLLBAR
   ================================================================ */

::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: background 0.3s;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ================================================================
   SCREEN SYSTEM
   ================================================================ */

.screen {
    display: none;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: center;
    animation: glassReveal 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
    display: flex;
}

/* ================================================================
   LIQUID GLASS CARDS
   ================================================================ */

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: 28px;
    padding: 40px;
    width: 100%;
    max-width: 460px;
    box-shadow: 
        var(--depth-shadow),
        var(--specular-top),
        var(--specular-left);
    position: relative;
    overflow: hidden;
}

/* Specular highlight — top edge light refraction */
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.15) 70%,
        transparent);
    z-index: 2;
    pointer-events: none;
}

/* Edge refraction glow */
.card::after {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: 28px;
    background: var(--refraction-border);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: xor;
    -webkit-mask-composite: xor;
    padding: 1px;
    opacity: 0.5;
    pointer-events: none;
    z-index: 1;
    animation: edgeShimmer 8s ease-in-out infinite alternate;
}

/* ================================================================
   TYPOGRAPHY
   ================================================================ */

h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, rgba(255,255,255,0.75) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ================================================================
   LOADING SCREEN
   ================================================================ */

#screen-loading {
    flex-direction: column;
}

.loader-box {
    text-align: center;
    position: relative;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary) 20%, var(--neon-blue) 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 24px;
    filter: drop-shadow(0 0 20px rgba(79, 143, 247, 0.15));
}

.glow-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid rgba(79, 143, 247, 0.08);
    border-top: 3px solid var(--neon-blue);
    border-right: 3px solid var(--neon-green);
    margin: 0 auto;
    animation: spin 1.2s cubic-bezier(0.5, 0.1, 0.4, 0.9) infinite;
    box-shadow: 
        0 0 25px var(--neon-blue-glow),
        inset 0 0 15px rgba(79, 143, 247, 0.08);
}

.status-message {
    margin-top: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ================================================================
   FORMS & INPUTS
   ================================================================ */

.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.shield-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 4px 12px rgba(79, 143, 247, 0.2));
}

.neon-yellow-text {
    color: #fbbf24;
    text-shadow: 0 0 15px rgba(234, 179, 8, 0.3);
}

.input-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

input, select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 1rem;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    box-shadow: var(--specular-top);
}

input:focus, select:focus {
    outline: none;
    border-color: rgba(79, 143, 247, 0.4);
    box-shadow: 
        0 0 0 3px rgba(79, 143, 247, 0.08),
        0 0 20px rgba(79, 143, 247, 0.1),
        var(--specular-top);
    background: rgba(255, 255, 255, 0.05);
}

option {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

/* ================================================================
   LIQUID GLASS BUTTONS
   ================================================================ */

.btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 14px 24px;
    border-radius: 14px;
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    position: relative;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-primary {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #3a6fdb 100%);
    color: var(--text-primary);
    box-shadow: 
        0 4px 20px var(--neon-blue-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5c9af9 0%, var(--neon-blue) 100%);
    box-shadow: 
        0 8px 30px rgba(79, 143, 247, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 10px var(--neon-blue-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    box-shadow: var(--specular-top);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: var(--specular-top), 0 4px 16px rgba(0,0,0,0.2);
}

/* Liquid shimmer on hover */
.btn-glow {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
    transition: 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:hover .btn-glow {
    left: 100%;
}

.btn-large {
    padding: 18px 24px;
    font-size: 1.05rem;
}

.card-footer {
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 16px;
    text-align: center;
}

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

/* ================================================================
   BIOMETRIC LOGIN
   ================================================================ */

.fingerprint-avatar {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
}

.biometric-svg {
    width: 100%;
    height: 100%;
}

.fingerprint-glow {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    border-radius: 50%;
    box-shadow: 0 0 30px var(--neon-blue-glow);
    animation: pulseGlow 2.5s infinite alternate;
    pointer-events: none;
    z-index: -1;
}

.f-ring-1 { animation: dash 2.5s infinite ease-in-out; }
.f-ring-2 { animation: dash 2.2s infinite ease-in-out; }
.f-ring-3 { animation: dash 1.9s infinite ease-in-out; }
.f-ring-4 { animation: dash 1.6s infinite ease-in-out; }
.f-ring-5 { animation: dash 1.3s infinite ease-in-out; }

.login-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setup-link-container {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 12px;
}

.setup-link-container a {
    color: var(--neon-blue);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.setup-link-container a:hover {
    color: var(--text-primary);
    text-shadow: 0 0 10px var(--neon-blue-glow);
}

/* ================================================================
   DEVICE WHITELIST DISPLAY
   ================================================================ */

.device-details-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 16px;
    margin: 20px 0;
    text-align: left;
    font-size: 0.85rem;
    box-shadow: var(--specular-top);
}

.detail-row {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.detail-row:last-child {
    margin-bottom: 0;
}

.detail-row code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 6px;
    color: var(--neon-blue);
    word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.82em;
}

.approval-action-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(234, 179, 8, 0.04);
    border: 1px solid rgba(234, 179, 8, 0.1);
    border-radius: 14px;
    padding: 12px;
    margin: 16px 0;
    text-align: left;
    box-shadow: var(--specular-top);
}

.approval-action-notice p {
    font-size: 0.82rem;
    color: #fbbf24;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #fbbf24;
    border-radius: 50%;
    box-shadow: 0 0 10px #fbbf24;
    animation: pulseAlert 1.5s infinite alternate;
    flex-shrink: 0;
}

.bootstrap-box {
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 20px;
    margin-top: 20px;
    text-align: left;
}

.bootstrap-header h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.bootstrap-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#bootstrap-approve-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ================================================================
   CHAT LAYOUT — MULTI-LAYER LIQUID GLASS
   ================================================================ */

#screen-chat {
    width: 100%;
    height: 100%;
    padding: 20px;
}

.chat-layout {
    width: 100%;
    max-width: 1200px;
    height: 100%;
    max-height: 800px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--depth-shadow-heavy);
    display: flex;
    overflow: hidden;
    position: relative;
}

/* Top specular edge on chat layout */
.chat-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.1) 20%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.1) 80%,
        transparent);
    z-index: 5;
    pointer-events: none;
}

/* ================================================================
   SIDEBAR — FROSTED OBSIDIAN PANEL
   ================================================================ */

.chat-sidebar {
    width: 320px;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    background: rgba(8, 10, 20, 0.5);
    position: relative;
}

/* Sidebar inner edge light */
.chat-sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.06) 0%, 
        rgba(255,255,255,0.02) 50%, 
        transparent 100%);
    pointer-events: none;
}

.sidebar-header {
    padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
}

/* Specular line under sidebar header */
.sidebar-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    pointer-events: none;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ================================================================
   AVATARS — GLASS FRAMED
   ================================================================ */

.avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-blue) 0%, #2654b8 100%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 
        0 4px 12px rgba(79, 143, 247, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    text-transform: uppercase;
    position: relative;
    flex-shrink: 0;
}

.recipient-avatar {
    background: linear-gradient(135deg, var(--neon-green) 0%, #0f8a63 100%);
    box-shadow: 
        0 4px 12px rgba(34, 216, 154, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.profile-info {
    display: flex;
    flex-direction: column;
}

.profile-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
}

.profile-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

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

.status-dot.online {
    background: var(--neon-green);
    box-shadow: 0 0 8px var(--neon-green-glow);
}

/* ================================================================
   SIDEBAR MENU & USER ITEMS
   ================================================================ */

.sidebar-menu {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.menu-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.users-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
    position: relative;
}

.user-item:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.04);
    box-shadow: var(--specular-top);
}

.user-item.active {
    background: rgba(79, 143, 247, 0.06);
    border-color: rgba(79, 143, 247, 0.12);
    box-shadow: 
        var(--specular-top),
        0 2px 12px rgba(79, 143, 247, 0.06);
}

/* Active item left accent line */
.user-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--neon-blue);
    box-shadow: 0 0 8px var(--neon-blue-glow);
}

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

.user-item-name {
    font-weight: 600;
    font-size: 0.92rem;
}

.user-item-preview {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
}

.e2ee-active-badge {
    background: rgba(34, 216, 154, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(34, 216, 154, 0.2);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-devices {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(79, 143, 247, 0.06);
    border: 1px solid rgba(79, 143, 247, 0.1);
    color: var(--neon-blue);
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--specular-top);
}

.btn-devices:hover {
    background: var(--neon-blue);
    color: var(--text-primary);
    box-shadow: 0 4px 20px var(--neon-blue-glow), var(--specular-top);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(242, 86, 86, 0.06);
    border: 1px solid rgba(242, 86, 86, 0.1);
    color: var(--neon-red);
    width: 100%;
    padding: 10px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-logout:hover {
    background: var(--neon-red);
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(242, 86, 86, 0.3);
}

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

/* ================================================================
   CHAT MAIN AREA — GLASS PANEL
   ================================================================ */

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

/* ================================================================
   CHAT HEADER — GLASS BAR
   ================================================================ */

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(8, 10, 20, 0.4);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    position: relative;
    z-index: 2;
}

/* Specular line under header */
.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

.recipient-header-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.chat-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
}

.e2ee-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.shield-mini-icon {
    font-size: 0.85rem;
}

.status-text {
    font-size: 0.8rem;
    font-weight: 600;
}

.neon-green {
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green-glow);
}

.sync-actions-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.btn-header-action {
    background: rgba(79, 143, 247, 0.08);
    border: 1px solid rgba(79, 143, 247, 0.12);
    color: var(--neon-blue);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--specular-top);
}

.btn-header-action:hover {
    background: var(--neon-blue);
    color: var(--text-primary);
    box-shadow: 
        0 0 20px var(--neon-blue-glow),
        var(--specular-top);
    transform: scale(1.05);
}

.btn-header-action svg {
    width: 18px;
    height: 18px;
}

.sync-status {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.3s;
}

.sync-status.active {
    display: flex;
    opacity: 1;
}

.sync-spinner {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-top: 2px solid var(--text-muted);
    animation: spin 0.8s linear infinite;
}

/* ================================================================
   CHAT MESSAGES — GLASS CONTAINER
   ================================================================ */

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

.crypto-notice {
    background: rgba(79, 143, 247, 0.04);
    border: 1px solid rgba(79, 143, 247, 0.08);
    border-radius: 16px;
    padding: 16px 20px;
    max-width: 600px;
    margin: 0 auto 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--specular-top);
}

.notice-icon {
    font-size: 1.5rem;
}

.crypto-notice p {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ================================================================
   MESSAGE BUBBLES — LIQUID GLASS
   ================================================================ */

.message-bubble-wrapper {
    display: flex;
    width: 100%;
}

.message-bubble-wrapper.sent {
    justify-content: flex-end;
}

.message-bubble-wrapper.received {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 20px;
    position: relative;
    animation: bubbleIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Sent — Blue Glass Bubble */
.sent .message-bubble {
    background: linear-gradient(135deg, rgba(79, 143, 247, 0.16) 0%, rgba(59, 110, 220, 0.12) 100%);
    border: 1px solid rgba(79, 143, 247, 0.18);
    border-bottom-right-radius: 6px;
    box-shadow: 
        0 4px 16px rgba(79, 143, 247, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Received — Dark Obsidian Glass Bubble */
.received .message-bubble {
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom-left-radius: 6px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.message-text {
    font-size: 0.93rem;
    color: var(--text-primary);
    line-height: 1.55;
    word-break: break-word;
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: 5px;
    display: block;
    opacity: 0.7;
}

/* ================================================================
   VOICE MESSAGE PLAYER — GLASS
   ================================================================ */

.voice-message-player {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
    padding: 4px 0;
}

.btn-play-voice {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #3a6fdb 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 
        0 2px 10px var(--neon-blue-glow),
        inset 0 1px 0 rgba(255,255,255,0.2);
    flex-shrink: 0;
}

.btn-play-voice:hover {
    background: linear-gradient(135deg, #5c9af9 0%, var(--neon-blue) 100%);
    transform: scale(1.05);
}

.btn-play-voice svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.sent .btn-play-voice {
    background: rgba(255,255,255,0.15);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(255,255,255,0.06);
}

.voice-waveform-sim {
    flex: 1;
    height: 24px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.waveform-bar {
    flex: 1;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    height: 6px;
    transition: height 0.15s ease, background 0.3s;
}

.sent .waveform-bar {
    background: rgba(255, 255, 255, 0.25);
}

.waveform-bar.active {
    background: var(--neon-green);
    height: 14px;
}

.sent .waveform-bar.active {
    background: var(--text-primary);
    height: 14px;
}

.voice-duration {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.sent .voice-duration {
    color: rgba(255, 255, 255, 0.75);
}

/* ================================================================
   CHAT FOOTER — FROSTED GLASS INPUT
   ================================================================ */

.chat-footer {
    flex-shrink: 0;
    padding: 12px 24px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(8, 10, 20, 0.5);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    position: relative;
}

/* Specular line above input */
.chat-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    pointer-events: none;
}

#chat-input-form {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

#chat-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 14px 90px 14px 18px;
    font-size: 0.93rem;
    box-shadow: var(--specular-top);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#chat-input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(79, 143, 247, 0.2);
    box-shadow: 
        0 0 0 2px rgba(79, 143, 247, 0.06),
        var(--specular-top);
}

.btn-record {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 50%;
}

.btn-record:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
}

.btn-record.recording {
    color: var(--neon-red);
    background: rgba(242, 86, 86, 0.1);
    box-shadow: 0 0 15px rgba(242, 86, 86, 0.3);
    animation: blinkRecord 1s infinite alternate;
}

.btn-record svg {
    width: 18px;
    height: 18px;
}

.btn-send {
    background: linear-gradient(135deg, var(--neon-blue) 0%, #3a6fdb 100%);
    border: none;
    border-radius: 14px;
    width: 48px;
    height: 48px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 
        0 4px 16px var(--neon-blue-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.btn-send:hover {
    background: linear-gradient(135deg, #5c9af9 0%, var(--neon-blue) 100%);
    box-shadow: 0 6px 24px rgba(79, 143, 247, 0.5);
    transform: scale(1.04);
}

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

.btn-send svg {
    width: 20px;
    height: 20px;
    transform: translateX(1px);
}

/* ================================================================
   MODALS — DEEP FROSTED GLASS OVERLAY
   ================================================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 8, 16, 0.7);
    backdrop-filter: blur(12px) saturate(120%);
    -webkit-backdrop-filter: blur(12px) saturate(120%);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 90%;
    max-width: 580px;
    max-height: 85vh;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    padding: 28px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--depth-shadow-heavy);
    position: relative;
    overflow: hidden;
    animation: glassModalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Modal specular top edge */
.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.12) 30%,
        rgba(255, 255, 255, 0.18) 50%,
        rgba(255, 255, 255, 0.12) 70%,
        transparent);
    z-index: 2;
    pointer-events: none;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding-bottom: 16px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, rgba(255,255,255,0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.btn-close {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: all 0.3s;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.modal-desc {
    font-size: 0.85rem;
    margin-bottom: 20px;
    text-align: left;
}

.devices-list-scroll {
    overflow-y: auto;
    flex: 1;
    max-height: 45vh;
    padding-right: 6px;
}

.devices-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 14px;
    transition: all 0.3s;
    box-shadow: var(--specular-top);
}

.device-item.current {
    border-color: rgba(79, 143, 247, 0.15);
    background: rgba(79, 143, 247, 0.03);
}

.device-info-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.device-ua-display {
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-meta-row {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.device-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 700;
}

.badge-approved {
    background: rgba(34, 216, 154, 0.1);
    color: var(--neon-green);
    border: 1px solid rgba(34, 216, 154, 0.18);
}

.badge-pending {
    background: rgba(234, 179, 8, 0.08);
    color: #fbbf24;
    border: 1px solid rgba(234, 179, 8, 0.15);
}

.device-actions {
    display: flex;
    gap: 8px;
}

.btn-approve-sm {
    background: linear-gradient(135deg, var(--neon-green) 0%, #18b07e 100%);
    color: var(--bg-dark);
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-approve-sm:hover {
    box-shadow: 0 0 14px var(--neon-green-glow);
    transform: translateY(-1px);
}

.btn-delete-sm {
    background: rgba(242, 86, 86, 0.08);
    border: 1px solid rgba(242, 86, 86, 0.15);
    color: var(--neon-red);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-delete-sm:hover {
    background: var(--neon-red);
    color: var(--text-primary);
    box-shadow: 0 0 14px rgba(242, 86, 86, 0.3);
}

/* ================================================================
   WEBRTC VOICE CALL OVERLAY — PREMIUM GLASS
   ================================================================ */

.calling-overlay {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(6, 8, 16, 0.85);
    backdrop-filter: blur(20px) saturate(130%);
    -webkit-backdrop-filter: blur(20px) saturate(130%);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s ease-out;
}

.calling-overlay.active {
    display: flex;
}

.calling-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--depth-shadow-heavy);
    border-radius: 32px;
    padding: 50px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    position: relative;
    overflow: hidden;
    animation: glassModalIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Calling card specular edge */
.calling-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.12) 30%,
        rgba(255, 255, 255, 0.16) 50%,
        rgba(255, 255, 255, 0.12) 70%,
        transparent);
    z-index: 2;
    pointer-events: none;
}

.calling-pulse-box {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 12px;
}

.calling-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--neon-blue) 0%, var(--neon-green) 100%);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow: 
        0 10px 40px var(--neon-blue-glow),
        inset 0 2px 0 rgba(255,255,255,0.2);
    z-index: 10;
    position: relative;
}

.pulse-ring {
    border: 1px solid rgba(79, 143, 247, 0.4);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    animation: callPulse 2s linear infinite;
    opacity: 0;
    z-index: 1;
}

.pulse-ring.r2 { animation-delay: 0.6s; }
.pulse-ring.r3 { animation-delay: 1.2s; }

.calling-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
}

.calling-actions {
    display: flex;
    gap: 24px;
    width: 100%;
    justify-content: center;
}

.btn-call {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-call-accept {
    background: linear-gradient(135deg, var(--neon-green) 0%, #18b07e 100%);
    box-shadow: 
        0 4px 24px var(--neon-green-glow),
        inset 0 2px 0 rgba(255,255,255,0.2);
}

.btn-call-accept:hover {
    box-shadow: 0 8px 32px rgba(34, 216, 154, 0.5);
    transform: scale(1.1);
}

.btn-call-hangup {
    background: linear-gradient(135deg, var(--neon-red) 0%, #d63434 100%);
    box-shadow: 
        0 4px 24px rgba(242, 86, 86, 0.35),
        inset 0 2px 0 rgba(255,255,255,0.15);
}

.btn-call-hangup:hover {
    box-shadow: 0 8px 32px rgba(242, 86, 86, 0.5);
    transform: scale(1.1);
}

.btn-call svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.btn-call-hangup svg {
    fill: none;
}

/* ================================================================
   ANIMATIONS — LIQUID GLASS MOTION
   ================================================================ */

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes glassReveal {
    from { 
        opacity: 0; 
        transform: scale(0.97);
        filter: blur(4px);
    }
    to { 
        opacity: 1; 
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes glassModalIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(12px);
        filter: blur(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        filter: blur(0);
    }
}

@keyframes bubbleIn {
    from { 
        opacity: 0; 
        transform: translateY(8px) scale(0.96); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}

@keyframes pulseGlow {
    from { box-shadow: 0 0 20px var(--neon-blue-glow); }
    to { box-shadow: 0 0 40px var(--neon-blue-glow), 0 0 60px rgba(79, 143, 247, 0.1); }
}

@keyframes pulseAlert {
    from { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px #fbbf24; }
    to { transform: scale(1.15); opacity: 1; box-shadow: 0 0 12px #fbbf24; }
}

@keyframes blinkRecord {
    from { opacity: 0.7; transform: scale(1); }
    to { opacity: 1; transform: scale(1.05); }
}

@keyframes callPulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { opacity: 0.4; }
    100% { transform: scale(2.2); opacity: 0; }
}

@keyframes ambientDrift {
    0% {
        background-position: 0% 0%;
        filter: hue-rotate(0deg);
    }
    50% {
        filter: hue-rotate(8deg);
    }
    100% {
        background-position: 100% 100%;
        filter: hue-rotate(0deg);
    }
}

@keyframes edgeShimmer {
    0% { opacity: 0.3; }
    50% { opacity: 0.6; }
    100% { opacity: 0.3; }
}

@keyframes slideInMobile {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* ================================================================
   RESPONSIVE — MOBILE LIQUID GLASS
   ================================================================ */

@media (max-width: 768px) {
    #screen-chat {
        padding: 0;
    }
    .chat-layout {
        border-radius: 0;
        border: none;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        position: relative;
        overflow: hidden;
    }
    .chat-layout::before {
        display: none;
    }
    .chat-sidebar {
        width: 100% !important;
        height: 100%;
        display: flex !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .chat-main {
        position: absolute;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100%;
        height: 100dvh;
        display: none !important;
        z-index: 10;
        background: var(--bg-dark);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .chat-layout.show-chat .chat-sidebar {
        transform: translateX(-20%);
    }
    .chat-layout.show-chat .chat-main {
        display: flex !important;
        animation: slideInMobile 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    }
    .profile-info, .user-item-info, .badge, .menu-title {
        display: flex !important;
    }
    .avatar {
        margin: 0;
    }
    .sidebar-header {
        padding: 18px 16px;
    }
    .sidebar-menu {
        padding: 14px 16px;
    }
    .user-item {
        padding: 10px 14px;
    }
    .chat-header {
        padding: 12px 16px;
    }
    .chat-footer {
        flex-shrink: 0;
        padding: 10px 16px;
        padding-bottom: calc(34px + env(safe-area-inset-bottom, 0px));
        background: rgba(10, 13, 24, 0.92);
        backdrop-filter: blur(20px) saturate(160%);
        -webkit-backdrop-filter: blur(20px) saturate(160%);
        z-index: 20;
    }
    .chat-messages {
        padding: 14px;
        flex: 1 1 0;
        min-height: 0;
        overflow-y: auto;
    }
    .chat-title {
        font-size: 1.05rem;
    }
    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
    }
    .btn-mobile-back {
        display: flex !important;
    }
    .card {
        margin: 16px;
        padding: 28px;
        border-radius: 24px;
    }
}

/* ================================================================
   SPECIAL BUBBLE STYLES
   ================================================================ */

/* Unanswered Call Bubble */
.unanswered-call-bubble {
    background: rgba(242, 86, 86, 0.06) !important;
    border: 1px solid rgba(242, 86, 86, 0.18) !important;
    color: var(--neon-red) !important;
    font-weight: 500;
}

/* Call Log Bubble */
.call-log-bubble {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
    color: var(--text-muted) !important;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================================================================
   PROFILE & SETTINGS — GLASS
   ================================================================ */

#settings-avatar-preview {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#div-profile-avatar-upload:hover #settings-avatar-preview {
    transform: scale(1.06);
    filter: brightness(0.85);
}

.tab-btn {
    border-bottom: 2px solid transparent !important;
    transition: all 0.3s;
}

.tab-btn.active {
    border-bottom: 2px solid var(--neon-blue) !important;
    color: var(--neon-blue) !important;
}

/* ================================================================
   UNREAD BADGE — GLASS
   ================================================================ */

.unread-badge {
    background: linear-gradient(135deg, var(--neon-red) 0%, #d63434 100%) !important;
    color: #ffffff !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    margin-left: auto;
    box-shadow: 
        0 0 12px rgba(242, 86, 86, 0.35),
        inset 0 1px 0 rgba(255,255,255,0.2);
    animation: unreadScaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes unreadScaleIn {
    from { transform: scale(0); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ================================================================
   IMAGE MESSAGING & LIGHTBOX — GLASS
   ================================================================ */

.btn-image-upload {
    background: transparent;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 50%;
}

.btn-image-upload:hover:not(:disabled) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-image-upload svg {
    width: 18px;
    height: 18px;
}

.chat-input-actions {
    position: absolute;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.image-bubble {
    padding: 4px !important;
    background: rgba(15, 18, 30, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px !important;
    box-shadow: var(--depth-shadow);
    overflow: hidden;
    position: relative;
    max-width: 258px !important;
}

.image-bubble img {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.image-bubble img:hover {
    transform: scale(1.02);
    filter: brightness(0.9);
}

/* Lightbox Modal */
.lightbox-modal {
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInModal 0.25s ease-out;
}

.lightbox-content {
    max-width: 90%;
    max-height: 85%;
    border-radius: 16px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 255, 255, 0.2);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: 300;
    transition: 0.3s;
    cursor: pointer;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-close:hover {
    color: var(--neon-red);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    transform: rotate(90deg);
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ================================================================
   CHAT BACKGROUNDS & CONTRAST MASK
   ================================================================ */

.chat-messages.has-custom-bg {
    background-size: cover;
    background-position: center;
    position: relative;
    z-index: 1;
}

.chat-messages.has-custom-bg::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 13, 22, 0.45);
    z-index: 0;
    pointer-events: none;
}

.chat-messages.has-custom-bg > * {
    position: relative;
    z-index: 1;
}

/* ================================================================
   BACKGROUND SELECTOR THUMBNAILS
   ================================================================ */

.bg-thumb-item {
    position: relative;
    aspect-ratio: 3 / 2;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.bg-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bg-thumb-item:hover {
    border-color: var(--neon-blue);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.bg-thumb-item:hover img {
    transform: scale(1.08);
}

.bg-thumb-item.active {
    border-color: var(--neon-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.bg-thumb-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    padding: 3px 6px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


