:root {
    /* Light Theme (Professional Clean) */
    --bg-color: #f0f2f5;
    /* Very light grey for app bg */
    --sidebar-bg: #ffffff;
    /* White sidebar */
    --chat-bg: #efe7dd;
    /* WhatsApp-like beige or clean slate #f0f4f8 */
    --chat-bg-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    /* Subtle pattern */
    --input-bg: #ffffff;
    --border-color: #e5e7eb;

    --primary-color: #4f46e5;
    --primary-color-rgb: 79, 70, 229;
    /* Indigo-600 - Very Modern */
    --primary-gradient: linear-gradient(135deg, #6366f1, #4f46e5);

    --text-primary: #111827;
    --text-secondary: #6b7280;

    --msg-sent-bg: #4f46e5;
    --msg-sent-text: #ffffff;
    --msg-received-bg: #ffffff;
    --msg-received-text: #111827;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    --font-main: "Outfit", "Inter", sans-serif;
    /* Updated to Outfit */
}

body.dark-mode {
    /* Modern Dark Theme (Not just black) */
    --bg-color: #0f172a;
    /* Slate 900 */
    --sidebar-bg: #1e293b;
    /* Slate 800 */
    --chat-bg: #0b1120;
    /* Darker Slate */
    --chat-bg-image: none;
    --input-bg: #334155;
    /* Slate 700 */
    --border-color: #334155;

    --primary-color: #818cf8;
    --primary-color-rgb: 129, 140, 248;
    /* Indigo-400 */
    --primary-gradient: linear-gradient(135deg, #818cf8, #6366f1);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;

    --msg-sent-bg: #4f46e5;
    --msg-sent-text: #ffffff;
    --msg-received-bg: #1e293b;
    --msg-received-text: #f8fafc;
}

/* Pull to Refresh */
.pull-indicator {
    height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: height 0.2s;
    background: var(--sidebar-bg);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.pull-indicator.loading {
    height: 60px;
}

.pull-indicator i {
    animation: ptr-spin 1s linear infinite;
}

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

/* Base Styles */
* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.hidden {
    display: none !important;
}

/* Restoration Overlay */
.restoration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    transition: opacity 0.5s ease;
}

.restoration-content {
    text-align: center;
    max-width: 80%;
}

.restoration-content i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.restoration-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.restoration-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Chat Spinner */
.chat-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    height: 100%;
    color: var(--text-secondary);
}

.chat-loading-container i {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

body.global-wallpaper-active,
body.global-wallpaper-active #app {
    background: transparent !important;
}

/* Auth Layout */
.centered-view {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    /* Use variable! */
}

.auth-box {
    background: var(--sidebar-bg);
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    text-align: center;
}

.auth-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    padding-top: max(20px, env(safe-area-inset-top));
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

.auth-nav-logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #f43f5e, #f59e0b);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
}

.auth-nav-back {
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.auth-nav-back:hover {
    color: var(--primary-color);
}

.auth-box h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.auth-box input {
    background: #0f172a;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 8px;
    color: white;
    width: 100%;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.auth-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

.auth-box button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.auth-box a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    display: block;
    margin-top: 1rem;
}

/* === MAIN CHAT LAYOUT === */
.chat-layout {
    display: flex;
    height: 100vh;
    /* Fallback */
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 400px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 5;
}

.chat-main {
    flex: 1;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--chat-bg);
    background-image: var(--chat-bg-image);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 70px;
    /* Space for bottom nav */
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 68px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 20;
    padding: 0 8px;
}

body.dark-mode .bottom-nav {
    background: rgba(15, 23, 42, 0.92);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    padding: 8px 4px;
    border-radius: 16px;
    position: relative;
    flex: 1;
    min-width: 0;
}

.nav-item i {
    font-size: 1.35rem;
    transition: all 0.3s ease;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.nav-item:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
}

.nav-item.active {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.12);
}

.nav-item.active i {
    transform: translateY(-1px) scale(1.1);
}



.sidebar-header {
    padding: env(safe-area-inset-top) 20px 0 20px;
    height: calc(64px + env(safe-area-inset-top));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
    /* Opaque for scrolling */
}

.sidebar-search {
    padding: 12px 16px;
}

.sidebar-search input {
    width: 100%;
    background: var(--input-bg);
    /* Use var */
    border: 1px solid var(--border-color);
    /* Subtle border */
    padding: 10px 16px;
    border-radius: 8px;
    /* Modern slightly rounded, not pill */
    color: var(--text-primary);
    font-size: 0.95rem;
    padding-left: 40px;
    /* For icon */
    transition: all 0.2s;
}

.sidebar-search input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    /* Primary ring */
    outline: none;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 80px 8px;
    /* Spacing for floating items + bottom nav */
}

.chat-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 2px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.chat-item:hover {
    background: rgba(99, 102, 241, 0.06);
    transform: scale(1.005);
}

body.dark-mode .chat-item:hover {
    background: rgba(129, 140, 248, 0.08);
}

.chat-item.active {
    background: rgba(79, 70, 229, 0.12);
}

body.dark-mode .chat-item.active {
    background: rgba(129, 140, 248, 0.18);
}

.chat-item img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    margin-right: 14px;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.15);
}

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

.chat-info h4 {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-info p {
    margin: 3px 0 0 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* MAIN CHAT AREA */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--chat-bg);
    background-image: var(--chat-bg-image);
    background-repeat: repeat;
    background-size: 400px;
    /* Subtle pattern sizing */
    position: relative;
    min-width: 0;
}


.chat-header {
    height: calc(64px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 24px 0 24px;
    background: rgba(255, 255, 255, 0.85);
    /* Glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

body.dark-mode .chat-header {
    background: rgba(30, 41, 59, 0.85);
}

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

.chat-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    /* Space between icons */
}

.chat-header-user img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    object-fit: cover;
}

.messages-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 6%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Modern Bubbles like iMessage/Telegram */
.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 20px;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    word-wrap: break-word;
    animation: msgFadeIn 0.25s ease-out;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

.message-sent {
    align-self: flex-end;
    background: var(--primary-gradient);
    color: var(--msg-sent-text);
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

.message-received {
    align-self: flex-start;
    background: var(--msg-received-bg);
    color: var(--msg-received-text);
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.msg-time {
    font-size: 0.7rem;
    opacity: 0.75;
    float: right;
    margin-left: 10px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

/* Floating Input Area */
.input-area {
    margin: 16px 20px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

body.dark-mode .input-area {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(99, 102, 241, 0.15);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.input-area form {
    display: flex;
    flex: 1;
    gap: 4px;
    align-items: center;
}

.input-area input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.input-area input::placeholder {
    color: var(--text-secondary);
}

/* Icons */
.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.25s ease;
}

.icon-btn:hover {
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.08);
}

body.dark-mode .icon-btn:hover {
    background: rgba(129, 140, 248, 0.12);
}

.back-btn {
    display: none;
    margin-right: 12px;
    font-size: 1.2rem;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-only {
    display: none !important;
}

/* === MOBILE RESPONSIVENESS === */
@media (max-width: 1024px) {
    .sidebar {
        width: 100%;
        position: absolute;
        height: 100%;
        transform: translateX(0);
    }

    .chat-main {
        width: 100%;
        position: absolute;
        height: 100%;
        transform: translateX(100%);
        /* Hidden by default */
        transition: transform 0.3s ease-in-out;
        z-index: 20;
    }

    /* Active States for Mobile Navigation */
    .app-state-chat .sidebar {
        transform: translateX(-100%);
        /* Slide sidebar away (optional, or just cover it) */
    }

    .app-state-chat .chat-main {
        transform: translateX(0);
        /* Slide chat in */
    }

    .back-btn {
        display: block;
    }

    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: flex !important;
    }

    .messages-container {
        padding: 15px 10px;
    }

    .messages-container {
        padding: 15px 10px;
    }

    /* Mobile Settings: Standard Flex Flow */
    .settings-content {
        position: static;
        width: auto;
        height: auto;
        background: transparent;
        overflow-y: visible;
    }
}

/* Search */
.search-wrapper {
    position: relative;
    background: #0f172a;
    border-radius: 20px;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    pointer-events: none;
}

.sidebar-search input {
    padding-left: 36px;
    /* Space for icon */
}

/* User Pill */
.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.user-pill:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Settings Panel */
.settings-content {
    flex: 1;
    overflow-y: auto;
}

/* Settings List Style */
.settings-list {
    display: flex;
    flex-direction: column;
}

.settings-item {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.settings-icon-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.settings-text {
    flex: 1;
}

.settings-text h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.settings-text p {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.settings-arrow {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Settings Section Header */
.settings-section-header {
    padding: 20px 20px 8px 20px;
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

/* Old Settings Content kept for compatibility, updated style */
.settings-inner-content {
    padding: 20px;
    color: var(--text-primary);
}


.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--sidebar-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.input-group {
    width: 100%;
    margin-bottom: 10px;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.input-group input {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 8px;
    color: white;
}

/* Media Content */
.msg-image,
.msg-video {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 4px;
    cursor: pointer;
}

/* Fix Images */
.profile-avatar-large {
    object-fit: cover;
}

.msg-image {
    object-fit: cover;
    max-height: 300px;
    width: 100%;
}

.avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Force Single Column on Mobile */
@media (max-width: 1024px) {
    .chat-layout {
        position: relative;
        width: 100vw;
    }

    .sidebar {
        width: 100vw;
        border-right: none;
    }

    .chat-main {
        width: 100vw;
    }
}

/* Professional Slide-In Animation */
.settings-slide-in {
    animation: settingsSlide 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes settingsSlide {
    from {
        opacity: 0;
        transform: translateX(30px) scale(0.98);
    }

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

/* User Pill Hover Effect */
.user-pill {
    transition: all 0.2s ease-out;
}

.user-pill:active {
    transform: scale(0.96);
}


.user-pill {
    position: relative;
}

.user-pill::after {
    content: '';
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background-color: var(--connection-status, #94a3b8);
    /* Default Grey */
    border-radius: 50%;
    border: 2px solid var(--sidebar-bg);
    transition: background-color 0.3s;
}

/* Back Button Transition */
.icon-btn {
    transition: transform 0.2s ease, background-color 0.2s;
    border-radius: 50%;
}

.icon-btn:active {
    transform: scale(0.9);
}

/* Emoji Picker */
emoji-picker {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    animation: pickerSlideUp 0.25s ease-out;
    --background: var(--sidebar-bg);
    --border-color: var(--border-color);
    --text-color: var(--text-primary);
    --secondary-text-color: var(--text-secondary);
    --input-border-color: var(--border-color);
    --input-font-color: var(--text-primary);
    --outline-color: var(--primary-color);
    --category-font-color: var(--text-secondary);
    --indicator-color: var(--primary-color);
    --button-hover-background: rgba(99, 102, 241, 0.12);
    --button-active-background: rgba(99, 102, 241, 0.2);
    --input-border-radius: 12px;
    --num-columns: 8;
    width: 350px;
    height: 350px;
}

@keyframes pickerSlideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

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

emoji-picker.hidden {
    display: none !important;
}

/* Video Call Modal */
#video-call-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

#video-call-modal:not(.hidden) .video-wrapper {
    animation: fadeInScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.video-wrapper {
    position: relative;
    width: 90%;
    max-width: 900px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#local-video {
    position: absolute;
    bottom: 24px;
    right: 24px;
    width: 180px;
    height: 135px;
    object-fit: cover;
    border-radius: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
    z-index: 10;
}

/* Draggable or Hover effect for local video? */
#local-video:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

#call-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 20px;
    border-radius: 30px;
}

/* Video Placeholder Centering */
.video-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0d1117;
    z-index: 2000000;
    transition: all 0.5s ease;
}

#placeholder-avatar {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    margin-bottom: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
    animation: pulseAvatar 2s infinite;
}

.placeholder-text {
    font-size: 1.25rem;
    color: #f8fafc;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes pulseAvatar {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 15px rgba(244, 63, 94, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
    }
}

.call-controls {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px 24px;
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.call-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.call-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.call-btn.end-call {
    background: #ef4444;
}

.call-btn.end-call:hover {
    background: #dc2626;
}

.call-btn.active-control {
    background: rgba(245, 158, 11, 0.2);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

/* Incoming Call Popup */
#incoming-call-popup {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.95);
    padding: 16px 30px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 24px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
    z-index: 3000000;
    min-width: 320px;
    justify-content: space-between;
}

#incoming-call-popup:not(.hidden) {
    display: flex;
    animation: slideDown 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.caller-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#caller-name {
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.popup-actions {
    display: flex;
    gap: 16px;
}

.popup-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.popup-btn:hover {
    transform: scale(1.1);
}

.btn-accept {
    background: #22c55e;
}

.btn-reject {
    background: #ef4444;
}

/* Responsive Video Modal */
@media (max-width: 768px) {
    .video-wrapper {
        width: 100%;
        height: 100%;
        max-width: none;
        border-radius: 0;
        border: none;
    }

    #local-video {
        width: 120px;
        height: 160px;
        /* Portrait aspect on mobile usually better? Or stick to landscape container? */
        /* Let's keep 4:3ish ratio but smaller */
        width: 100px;
        height: 133px;
        bottom: 100px;
        /* Space for controls */
        right: 16px;
    }

    .call-controls {
        bottom: 40px;
        padding: 10px 20px;
        gap: 20px;
    }

    #incoming-call-popup {
        width: 90%;
        flex-direction: column;
        padding: 20px;
        gap: 15px;
        border-radius: 24px;
        background: rgba(15, 23, 42, 0.95);
        backdrop-filter: blur(16px);
        box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
    }

    #incoming-call-popup:not(.hidden) {
        display: flex;
        animation: slideDown 0.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    }
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Audio Call Mode */
.audio-mode #remote-video,
.audio-mode #local-video,
.audio-mode #call-status {
    display: none !important;
}

.audio-mode #audio-call-ui {
    display: flex !important;
}

#audio-call-ui {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    z-index: 2000000;
    background: radial-gradient(circle at center, #334155 0%, #0f172a 100%);
}

.pulsing-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
}

#audio-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 10;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.2);
}



/* Animation Keyframes */
@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes wave {

    0%,
    100% {
        height: 10px;
        opacity: 0.5;
    }

    50% {
        height: 25px;
        opacity: 1;
    }
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    margin-bottom: 5px;
}

.wave-bar {
    width: 6px;
    background: var(--primary-color);
    border-radius: 10px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) {
    animation-duration: 0.8s;
    height: 15px;
}

.wave-bar:nth-child(2) {
    animation-duration: 1.1s;
    height: 25px;
}

.wave-bar:nth-child(3) {
    animation-duration: 0.9s;
    height: 20px;
}

.wave-bar:nth-child(4) {
    animation-duration: 1.2s;
    height: 18px;
}

.wave-bar:nth-child(5) {
    animation-duration: 0.7s;
    height: 12px;
}

#audio-status-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

#call-timer {
    font-size: 2.2rem;
    /* Slightly larger */
    font-weight: 500;
    color: white;
    margin-top: 14px;
    font-family: "JetBrains Mono", monospace;
    /* Tech/Code look */
    letter-spacing: -0.5px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status Indicators (Mic Off) */
.status-icons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

#status-mic-off {
    color: #ef4444;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 50%;
}

/* Disabled Button State */
.call-btn.disabled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

#local-video {
    width: 120px;
    height: 160px;
    width: 100px;
    height: 133px;
    bottom: 100px;
    right: 16px;
    z-index: 10;
}

.call-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    gap: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    z-index: 50;
    /* Ensure visibility over placeholder */
}

.call-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.call-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.call-btn.disabled {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.call-btn.end-call {
    background: #ef4444;
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.call-btn.end-call:hover {
    background: #dc2626;
    transform: scale(1.1);
}

#call-timer {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 20;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

#call-timer.hidden {
    display: none;
}

#incoming-call-popup {
    position: fixed;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3000000;
    width: 95%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: slideDown 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#incoming-call-popup:not(.hidden) {
    display: flex;
    animation: fadeIn 0.3s ease-out forwards;
}


/* Utility Classes */
.hidden {
    display: none !important;
}

/* Audio Call Mode */
.audio-mode #remote-video,
.audio-mode #local-video,
.audio-mode #call-status,
.audio-mode .video-placeholder {
    display: none !important;
}

.audio-mode #audio-call-ui {
    display: flex !important;
}

#audio-call-ui {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    z-index: 2000000;
    background: radial-gradient(circle at center, #334155 0%, #0f172a 100%);
}

.pulsing-avatar {
    position: relative;
    width: 120px;
    height: 120px;
    margin-bottom: 20px;
}

#audio-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    z-index: 10;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

/* Video Placeholder */
.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    /* Above remote video (z-index 1) */
}

.video-placeholder img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.placeholder-text {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
}

.video-placeholder.hidden {
    display: none;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}

/* Call Status Overlay */
#call-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1rem;
    z-index: 20;
    pointer-events: none;
    transition: opacity 0.3s;
}

/* Timer Position Fix */
#call-timer {
    position: absolute;
    top: 60px;
    /* Below any potential header or status bar */
    right: 20px;
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    font-family: "JetBrains Mono", monospace;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    background: rgba(0, 0, 0, 0.3);
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 20;
}

/* Audio Mode Override for Timer */
.audio-mode #call-timer {
    position: static;
    /* Center it in audio UI */
    margin-top: 14px;
    font-size: 2.2rem;
}



/* Animation Keyframes */
@keyframes slideDown {
    from {
        transform: translate(-50%, -100%);
        opacity: 0;
    }

    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes wave {

    0%,
    100% {
        height: 10px;
        opacity: 0.5;
    }

    50% {
        height: 25px;
        opacity: 1;
    }
}

.voice-waveform {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    margin-bottom: 5px;
}

.wave-bar {
    width: 6px;
    background: var(--primary-color);
    border-radius: 10px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) {
    animation-duration: 0.8s;
    height: 15px;
}

.wave-bar:nth-child(2) {
    animation-duration: 1.1s;
    height: 25px;
}

.wave-bar:nth-child(3) {
    animation-duration: 0.9s;
    height: 20px;
}

.wave-bar:nth-child(4) {
    animation-duration: 1.2s;
    height: 18px;
}

.wave-bar:nth-child(5) {
    animation-duration: 0.7s;
    height: 12px;
}

#audio-status-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

#call-timer {
    font-size: 2.2rem;
    /* Slightly larger */
    font-weight: 500;
    color: white;
    margin-top: 14px;
    font-family: "JetBrains Mono", monospace;
    /* Tech/Code look */
    letter-spacing: -0.5px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status Indicators (Mic Off) */
.status-icons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

#status-mic-off {
    color: #ef4444;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 50%;
}

/* Disabled Button State */
.call-btn.disabled {
    background: white;
    /* High contrast */
    color: black;
}

.call-btn.disabled:hover {
    background: #e5e5e5;
}

/* File Message Styles */
.msg-file {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 4px;
    overflow: hidden;
}

.file-link {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    color: inherit;
    gap: 12px;
    transition: background 0.2s;
}

.file-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

.download-icon {
    font-size: 1.1rem;
    opacity: 0.5;
}

/* Refined Attachment Menu (WhatsApp Style) */
.attachment-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--sidebar-bg);
    /* White/Dark */
    border-radius: 16px;
    padding: 8px;
    /* Inner padding */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    /* Softer, deeper shadow */
    border: none;
    /* Clean look */
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 100;
    min-width: 200px;
    animation: fadeInUp 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy pop */
}

.attachment-menu div {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
}

.attachment-menu div:hover {
    background: var(--bg-color);
    /* Slight hover bg */
}

.menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.icon-photo {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    /* Blue */
}

.icon-doc {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    /* Purple */
}

/* Dark mode adjust */
body.dark-mode .attachment-menu {
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

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

.wave-bar:nth-child(3) {
    animation-duration: 0.9s;
    height: 20px;
}


.wave-bar:nth-child(4) {
    animation-duration: 1.2s;
    height: 18px;
}

.wave-bar:nth-child(5) {
    animation-duration: 0.7s;
    height: 12px;
}

#audio-status-text {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
}

#call-timer {
    font-size: 2.2rem;
    /* Slightly larger */
    font-weight: 500;
    color: white;
    margin-top: 14px;
    font-family: "JetBrains Mono", monospace;
    /* Tech/Code look */
    letter-spacing: -0.5px;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status Indicators (Mic Off) */
.status-icons {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

#status-mic-off {
    color: #ef4444;
    font-size: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 50%;
}

/* Disabled Button State */
.call-btn.disabled {
    background: white;
    /* High contrast */
    color: black;
}

.call-btn.disabled:hover {
    background: #e5e5e5;
}

/* File Message Styles */
.msg-file {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 4px;
    overflow: hidden;
}

.file-link {
    display: flex;
    align-items: center;
    padding: 10px;
    text-decoration: none;
    color: inherit;
    gap: 12px;
    transition: background 0.2s;
}

.file-link:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .file-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

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

.file-name {
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 0.75rem;
    opacity: 0.7;
}

.download-icon {
    font-size: 1.1rem;
    opacity: 0.5;
}

/* System Messages (Declined, Missed Call, etc.) */
.system-message {
    align-self: center;
    background: rgba(0, 0, 0, 0.06);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    max-width: 80%;
    text-align: center;
    box-shadow: none;
}

body.dark-mode .system-message {
    background: rgba(255, 255, 255, 0.06);
}

/* Call Log Messages (Declined, Answered, Missed) */
.call-log-message {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 4px 0;
    box-shadow: none;
}

body.dark-mode .call-log-message {
    background: rgba(255, 255, 255, 0.06);
}

.call-log-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-left: 4px;
}

/* Chat Header Status Dot */
.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-dot.online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-dot.offline {
    background: #94a3b8;
}

/* Chat header info styling */
.chat-header-info h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.chat-header-info p {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}


/* Refined Attachment Menu (WhatsApp Style) */
.attachment-menu {
    position: absolute;
    bottom: 80px;
    left: 20px;
    background: var(--sidebar-bg);
    border-radius: 16px;
    padding: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 1000;
    min-width: 200px;
    border: 1px solid var(--border-color);
    animation: menuSlideUp 0.2s ease-out;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

@keyframes menuSlideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

.attachment-menu.hidden {
    display: none !important;
}

.attachment-menu div {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 1rem;
}

.attachment-menu div:hover {
    background: var(--bg-color);
    /* Slight hover bg */
}

.menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.icon-photo {
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    /* Blue */
}

.icon-doc {
    background: linear-gradient(135deg, #a855f7, #7e22ce);
    /* Purple */
}

/* Dark mode adjust */
body.dark-mode .attachment-menu {
    background: #1e293b;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

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

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

/* Emoji Picker (override for chat context) */
emoji-picker {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    overflow: hidden;
    animation: pickerSlideUp 0.25s ease-out;
    --background: var(--sidebar-bg);
    --border-color: var(--border-color);
    --text-color: var(--text-primary);
    --secondary-text-color: var(--text-secondary);
    --input-border-color: var(--border-color);
    --input-font-color: var(--text-primary);
    --outline-color: var(--primary-color);
    --category-font-color: var(--text-secondary);
    --indicator-color: var(--primary-color);
    --button-hover-background: rgba(99, 102, 241, 0.12);
    --button-active-background: rgba(99, 102, 241, 0.2);
    --input-border-radius: 12px;
    --num-columns: 8;
    width: 350px;
    height: 350px;
}


/* Snappy Message Animation */
.message-bubble.animate__fadeInUp {
    animation-duration: 0.3s !important;
}

/* ensure smooth scroll */
.messages-container {
    scroll-behavior: smooth;
}

/* === STATUS INDICATORS === */
.avatar-wrapper {
    position: relative;
    display: inline-block;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #22c55e;
    /* Green */
    border: 2px solid var(--sidebar-bg);
    /* Cutout effect */
    border-radius: 50%;
    z-index: 10;
}

.status-dot.offline {
    background-color: #94a3b8;
    /* Gray/Invisible usually, but valid for debugging */
    display: none;
    /* Usually hide offline dots */
}

/* === MOBILE REFINEMENTS (Phones) === */

@media (max-width: 768px) {

    /* 1. Input Area - Docked to Bottom */
    .input-area {
        margin: 0 !important;
        width: 100% !important;
        border-radius: 0 !important;
        border-left: none;
        border-right: none;
        border-bottom: none;
        background: var(--sidebar-bg);
        /* Opaque for mobile */
        padding: 10px 16px !important;
        bottom: 0;
        z-index: 50;
    }

    /* 2. Attachment Menu - Bottom Sheet */
    .attachment-menu {
        left: 0 !important;
        right: 0 !important;
        bottom: 60px !important;
        /* Above input */
        width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        /* Top rounded only */
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1) !important;
        padding-bottom: 20px !important;
        animation: slideUpAction 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    /* 3. Emoji Picker - Full Width */
    emoji-picker {
        width: 100% !important;
        height: 350px !important;
        bottom: 60px !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 20px 20px 0 0 !important;
        --border-radius: 0;
    }

    /* 4. Tap Targets */
    .icon-btn {
        width: 48px !important;
        height: 48px !important;
    }

    /* Animations */
    @keyframes slideUpAction {
        from {
            transform: translateY(100%);
        }

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

/* Message Options Modal */
.message-options-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.4);
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.2s;
}

.message-options-modal.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
}

/* Modal Overlay to catch clicks */
.modal-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
}

.modal-content {
    background: var(--sidebar-bg);
    border-radius: 16px;
    width: 80%;
    max-width: 300px;
    z-index: 1001;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    transform: scale(1);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
}

.message-options-modal.hidden .modal-content {
    transform: scale(0.9);
}

.modal-content button {
    background: none;
    border: none;
    width: 100%;
    padding: 16px;
    text-align: left;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.modal-content button:last-child {
    border-bottom: none;
}

.modal-content button:hover {
    background: rgba(0, 0, 0, 0.05);
}

.modal-content button i {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    color: var(--text-secondary);
}

#btn-delete-msg {
    color: #ef4444;
}

#btn-delete-msg i {
    color: #ef4444;
}

body.dark-mode .modal-content button:hover {
    background: rgba(255, 255, 255, 0.05);
}


/* Disable text selection for long press */
.message-bubble {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}


/* --- Reply Preview & Actions --- */
.reply-preview {
    background: var(--bg-color);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    animation: fadeInUp 0.3s ease;
}

.reply-content-box {
    display: flex;
    gap: 10px;
    flex: 1;
    background: rgba(128, 128, 128, 0.1);
    padding: 8px;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.reply-text-col {
    display: flex;
    flex-direction: column;
}

.reply-sender {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.reply-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.close-reply {
    margin-left: 10px;
    color: var(--text-secondary);
}

/* Edit & Star Tags */
.edited-tag {
    margin-left: 4px;
    font-style: italic;
}

/* Modal Icons alignment */
.message-options-modal .modal-content button i {
    width: 20px;
    text-align: center;
    margin-right: 10px;
}

/* Ensure bubbles handle transform */
.message-bubble {
    transition: transform 0.1s linear;
    /* Fast response for drag */
    touch-action: pan-y;
    /* Allow vertical scroll but capture horizontal */
}


/* --- Reply Context in Bubble --- */
.reply-context {
    background: rgba(var(--primary-color-rgb), 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    overflow: hidden;
    max-width: 100%;
    border-left: none;
    /* Removed in favor of reply-bar */
}

.message-sent .reply-context {
    background: rgba(255, 255, 255, 0.2);
}

.reply-bar {
    min-width: 4px;
    max-width: 4px;
    background: var(--primary-color);
}

.message-sent .reply-bar {
    background: #fff;
}

.reply-info {
    padding: 6px 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.reply-sender {
    font-weight: 800;
    color: var(--primary-color);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.message-sent .reply-sender {
    color: #fff;
}

.reply-content {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    font-size: 0.8rem;
}

.message-sent .reply-content {
    color: rgba(255, 255, 255, 0.9);
}

/* Highlight Animation */
.highlight-message {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0% {
        background-color: rgba(var(--primary-color-rgb), 0.4);
    }

    100% {
        background-color: transparent;
    }
}

/* PC Hover Reply Button */
.hover-reply-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.message-sent .hover-reply-btn {
    left: -45px;
}

.message-received .hover-reply-btn {
    right: -45px;
}

.message-bubble:hover .hover-reply-btn {
    opacity: 1;
}

.hover-reply-btn:hover {
    color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
}

body.dark-mode .hover-reply-btn {
    background: var(--sidebar-bg);
}

/* Date Separator */
.date-header {
    width: 100%;
    text-align: center;
    margin: 20px 0 15px 0;
    position: relative;
    display: flex;
    justify-content: center;
}

.date-header span {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
    backdrop-filter: blur(5px);
}

.light-mode .date-header span {
    background: rgba(0, 0, 0, 0.05);
    color: #64748b;
}


/* Message Menu Button (PC) */
.msg-menu-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    /* Subtle dark for both */
    backdrop-filter: blur(2px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 20;
    color: inherit;
    font-size: 0.8rem;
}

.message-bubble:hover .msg-menu-btn {
    opacity: 1;
}

.msg-menu-btn:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: scale(1.1);
}

/* Ensure sent messages have contrast if background is dark/colored */
.message-sent .msg-menu-btn {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(0, 0, 0, 0.2);
}

.message-sent .msg-menu-btn:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Modal Overlay (Generic) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    /* JS toggles flex */
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal-content {
    background: var(--sidebar-bg);
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Status Carousel Animation (Lyrics Style) */
.status-text-container {
    height: 1.2em;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

.status-slide {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.5s;
    display: block;
}

.status-slide-up {
    animation: slideUp 0.5s forwards;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

@keyframes slideDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* Typing Bubble (Instagram Style) */
/* Typing Bubble (Instagram Style) */
.typing-bubble {
    background: var(--msg-received-bg);
    padding: 12px 18px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    color: var(--text-secondary);
    will-change: transform;
    animation: fadeInUp 0.3s ease;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingJump 1.4s infinite ease-in-out both;
    opacity: 0.6;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingJump {

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

    40% {
        transform: translateY(-5px);
    }
}

/* Profile Card Fixes */
.profile-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    height: auto;
    overflow-y: visible;
}

.user-profile-view {
    height: 100%;
    overflow-y: auto;
    padding-bottom: 150px;
}

/* Custom Toast Alert */
.custom-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    /* Ensure visibility above all */
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 90%;
    font-size: 0.95rem;
    font-weight: 500;
}

.custom-alert__icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-alert__title {
    flex: 1;
}

.custom-alert__close {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
}

.custom-alert__close:hover {
    opacity: 1;
}

/* Chat Filter Bubbles (WhatsApp Style) */
.filter-bubbles {
    display: flex;
    gap: 8px;
    padding: 10px 16px;
    padding-bottom: 5px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    /* Firefox */
}

.filter-bubbles::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-chip {
    background: var(--search-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip:hover {
    background: var(--hover-bg);
}

.filter-chip.active {
    background: var(--primary-color);
    /* Green */
    color: #fff;
    /* White text */
    border-color: var(--primary-color);
    font-weight: 600;
}

/* ===== VOICE MESSAGES ===== */
.voice-msg {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    padding: 4px 0;
}

.play-voice-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--primary-gradient);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.play-voice-btn:hover {
    transform: scale(1.1);
}

.voice-progress-wrap {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    min-width: 80px;
}

.message-received .voice-progress-wrap {
    background: rgba(0, 0, 0, 0.1);
}

body.dark-mode .voice-progress-wrap {
    background: rgba(255, 255, 255, 0.15);
}

.voice-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary-gradient);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.voice-duration {
    font-size: 0.75rem;
    opacity: 0.7;
    min-width: 30px;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ===== VOICE RECORDING BAR ===== */
.voice-recording-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: var(--bg-card);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .voice-recording-bar {
    border-top-color: rgba(255, 255, 255, 0.06);
}

.recording-pulse {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    animation: recordPulse 1s ease-in-out infinite;
}

@keyframes recordPulse {

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

    50% {
        opacity: 0.4;
        transform: scale(0.8);
    }
}

#recording-timer {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ef4444;
    font-variant-numeric: tabular-nums;
}

/* ===== GIF PICKER ===== */
.gif-picker {
    position: absolute;
    bottom: 60px;
    left: 8px;
    right: 8px;
    max-height: 350px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1000;
    animation: slideUp 0.25s ease;
}

body.dark-mode .gif-picker {
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

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

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

.gif-search-bar {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

body.dark-mode .gif-search-bar {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.gif-search-bar input {
    width: 100%;
    padding: 8px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.gif-search-bar input:focus {
    border-color: var(--primary-color);
}

body.dark-mode .gif-search-bar input {
    border-color: rgba(255, 255, 255, 0.1);
}

.gif-results {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    align-content: start;
}

.gif-item {
    width: 100%;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
    object-fit: cover;
    aspect-ratio: 1;
}

.gif-item:hover {
    transform: scale(1.05);
    opacity: 0.85;
}

.gif-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== GIF MESSAGE BUBBLE ===== */
.msg-gif {
    max-width: 250px;
    border-radius: 12px;
    display: block;
}
/* === UPDATES PAGE === */
.updates-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.updates-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 40px;
}

.hero-section {
    padding: 80px 20px 40px;
    text-align: center;
    position: relative;
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.1), transparent);
    overflow: hidden;
}

.sparkles-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.3;
}

.hero-section h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.updates-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.section-title {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.changelog-card {
    background: var(--sidebar-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.version-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.update-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.changelog-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.2rem;
}

.update-tags {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tag {
    font-size: 0.7rem;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.changelog-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.changelog-card li {
    font-size: 0.95rem;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text-primary);
    opacity: 0.9;
}

.changelog-card li i {
    color: #10b981;
    margin-top: 4px;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.feature-mini-card {
    background: var(--sidebar-bg);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.feature-mini-card:hover {
    transform: translateY(-5px);
}

.f-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    background: rgba(var(--primary-color-rgb), 0.1);
    color: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.feature-mini-card h5 {
    margin: 0 0 6px 0;
    font-size: 0.9rem;
}

.feature-mini-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.privacy-select {
    background: #0f172a;
    color: white;
    border: 1px solid #334155;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.privacy-select:hover {
    border-color: #6366f1;
    background: #1e293b;
}

.privacy-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Admin Dashboard */
.admin-dashboard {
    padding: 15px;
}

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.admin-stat-card {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-stat-card i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #6366f1;
}

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

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.6;
}

.admin-user-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-user-item {
    background: rgba(255, 255, 255, 0.03);
    padding: 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.admin-user-info {
    flex: 1;
    margin-left: 12px;
}

.admin-user-info h4 {
    margin: 0;
    font-size: 0.95rem;
}

.admin-user-info p {
    margin: 0;
    font-size: 0.8rem;
    opacity: 0.6;
}

.admin-badge {
    background: #e11d48;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

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

.admin-action-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.admin-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-action-btn.delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Full-Page Admin Dashboard Glassmorphism */
.admin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.admin-dashboard-full {
    width: 98%;
    max-width: none;
    height: 96vh;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 32px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-header {
    padding: 24px 32px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-close-btn {
    display: flex !important;
}

.admin-header h1 {
    font-size: 1.5rem;
    margin: 0;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.admin-header p {
    margin: 4px 0 0;
    opacity: 0.5;
    font-size: 0.9rem;
}

.admin-header-right {
    display: flex;
    gap: 16px;
    align-items: center;
}

.admin-search-container {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 8px 16px 8px 40px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-search-container i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.5;
}

.admin-search-container input {
    background: none;
    border: none;
    color: white;
    outline: none;
    width: 200px;
}

.admin-scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.admin-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.admin-stat-card.glass {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 28px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: default;
}

.admin-stat-card.glass:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon.users { background: rgba(99, 102, 241, 0.1); color: #818cf8; }
.stat-icon.online { background: rgba(16, 185, 129, 0.1); color: #34d399; }
.stat-icon.msgs { background: rgba(245, 158, 11, 0.1); color: #fbbf24; }
.stat-icon.call { background: rgba(236, 72, 153, 0.1); color: #f472b6; }

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-label {
    font-size: 0.85rem;
    opacity: 0.5;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* User Grid */
.admin-user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.admin-user-tile {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-user-tile:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px -10px rgba(0,0,0,0.3);
}

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

.user-avatar-large {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-details h3 {
    margin: 0;
    font-size: 1.1rem;
}

.user-details p {
    margin: 2px 0 6px;
    opacity: 0.5;
    font-size: 0.85rem;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.admin { background: rgba(239, 68, 68, 0.1); color: #f87171; }
.badge.user { background: rgba(255, 255, 255, 0.1); color: #94a3b8; }

.user-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.user-meta { font-size: 0.75rem; opacity: 0.4; }

.admin-btn {
    padding: 8px 12px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn.delete {
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
}

.admin-btn.delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
