
/* ============================================
   Vyn - Main Stylesheet
   Modern Discord-like Dark Theme
   ============================================ */

/* ===== CSS Variables ===== */

:root {
    /* ===== Pastel Background System ===== */
    --bg-primary: #fffef8;      /* banana cream white */
    --bg-secondary: #fff7d6;    /* light banana yellow */
    --bg-tertiary: #fef1ff;     /* pastel lavender */

    --bg-input: #ffffff;
    --bg-message-own: #d7f8ef;     /* mint message bubble */
    --bg-message-other: #ffe8f7;   /* baby pink chat bubble */

    --bg-chat-input: #ffffff;

    /* ===== Pastel Accent Colors ===== */
    --accent-primary: #8ac6ff;       /* soft baby blue */
    --accent-hover: #73b8ff;

    --accent-success: #a8f5cf;       /* mint green */
    --accent-success-hover: #8beabe;

    --accent-warning: #ffe5aa;       /* pastel peach/yellow */
    --accent-warning-hover: #ffd88b;

    --accent-danger: #ffb0c1;        /* pastel pink */
    --accent-danger-hover: #ff92a8;

    /* ===== Text Colors ===== */
    --text-primary: #353535;
    --text-secondary: #595959;
    --text-muted: #909090;
    --text-placeholder: #bdbdbd;

    /* ===== Borders ===== */
    --border-color: #f2ddff;
    --border-dark: #ead5ff;

    /* ===== Shadows ===== */
    --shadow-sm: 0 2px 4px rgba(200, 150, 255, 0.15);
    --shadow-md: 0 4px 12px rgba(180, 150, 255, 0.2);
    --shadow-lg: 0 6px 18px rgba(180, 150, 255, 0.25);
    --shadow-glow: 0 0 20px rgba(180, 150, 255, 0.4);

    /* ===== Rounding ===== */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 32px;
    --radius-full: 999px;

    /* ===== Transitions ===== */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 350ms ease;
}


/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden; /* keep */
}

#mainContent, #chatPage {
    overflow: hidden; /* keep layout clean */
}

#chatMessages {
    overflow-y: auto !important;
}


body {
    font-family: 'Inter', sans-serif;
    background:
        linear-gradient(135deg, #ffe7f1 0%, #ffe7f1 33%, #e3f3ff 33%, #e3f3ff 66%, #ffece1 66%, #ffece1 100%),
        url("https://i.imgur.com/7W3p9ch.png"); /* pastel grid */
    background-size: cover, 40px 40px;
    background-attachment: fixed;
}


/* ===== Main Container ===== */
#appContainer {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ===== Page Visibility ===== */
.page {
    display: none;
    width: 100%;
    height: 100%;
}

.page.active {
    display: flex;
    flex-direction: column;
}

/* ===== Sidebar Styles ===== */
#dashboardSidebar {
    width: 240px;
    background-color: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all var(--transition-base);
    border-right: 1px solid var(--border-dark);
}

#dashboardSidebar,
.members-panel,
#chatPage,
.modal-content,
.login-box,
.setup-box,
.mock-chat {
    background: rgba(255, 255, 255, 0.55) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 16px rgba(200, 150, 255, 0.2);
    border-radius: 24px;
}



#userProfileBar {
    padding: 16px;
    background-color: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-dark);
}

#userEmail {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

#btnLogout {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

#btnLogout:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

#btnLogout i {
    width: 20px;
    height: 20px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Custom Scrollbar for Sidebar */
.sidebar-content::-webkit-scrollbar {
    width: 8px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--border-color);
}

.sidebar-section-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

#groupList,
#dmList {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-item {
    padding: 8px 12px;
    color: var(--text-muted);
    background-color: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

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

.sidebar-item.active {
    background-color: rgba(88, 101, 242, 0.1);
    color: var(--text-primary);
}

.sidebar-item i {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.sidebar-item .avatar {
    width: 24px;
    height: 24px;
    margin-right: 0;
}

.sidebar-divider {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-actions {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#groupName,
#joinCode,
.sidebar-search-input {
    width: 100%;
    padding: 8px 12px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--transition-fast);
}

#groupName:focus,
#joinCode:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

#groupName::placeholder,
#joinCode::placeholder {
    color: var(--text-placeholder);
}

#btnCreateGroup,
#btnJoinGroup {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#btnCreateGroup {
    background-color: var(--accent-success);
    color: var(--text-primary);
}

#btnCreateGroup:hover {
    background-color: var(--accent-success-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#btnJoinGroup {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

#btnJoinGroup:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

#btnCreateGroup i,
#btnJoinGroup i {
    width: 16px;
    height: 16px;
}

/* ===== Main Content Area ===== */
#mainContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-primary);
    min-width: 0; /* Allow flex shrinking */
}

/* ===== Landing Page ===== */
#landingPage {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
    overflow-y: auto;
}

.landing-hero {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 60px;
}

.landing-content {
    text-align: center;
    z-index: 2;
}

.landing-title {
    font-size: 64px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInDown 0.8s ease;
}

.landing-tagline {
    font-size: 24px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-weight: 400;
    animation: fadeInUp 0.8s ease 0.2s both;
}

.landing-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    animation: fadeInUp 0.8s ease 0.4s both;
}

.btn-primary,
.btn-secondary {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-base);
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent-primary);
}

.btn-secondary:hover {
    background-color: var(--accent-primary);
    transform: translateY(-2px);
}

.landing-preview {
    max-width: 800px;
    width: 100%;
    animation: fadeIn 1s ease 0.6s both;
}

.mock-chat {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-dark);
}

.mock-chat-header {
    padding: 16px 20px;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-dark);
}

.mock-channel {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 16px;
}

.mock-messages {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
}

.mock-message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.mock-message-own {
    flex-direction: row-reverse;
}

.mock-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-hover) 100%);
    flex-shrink: 0;
}

.mock-message-content {
    flex: 1;
}

.mock-message-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 4px;
}

.mock-message-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

.landing-footer {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 1px solid var(--border-dark);
}

/* ===== Login Page ===== */
#loginPage {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
    animation: fadeInScale 0.5s ease;
}

.login-box {
    background-color: var(--bg-tertiary);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-dark);
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
    font-size: 14px;
}

.btn-google {
    width: 100%;
    padding: 14px 24px;
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--shadow-md);
}

.btn-google:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-google i {
    width: 24px;
    height: 24px;
}

.login-links {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.login-link {
    color: var(--accent-hover);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--transition-fast);
}

.login-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}

/* ===== Setup Page ===== */
#setupPage {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.setup-container {
    width: 100%;
    max-width: 400px;
    animation: fadeInScale 0.5s ease;
}

.setup-box {
    background-color: var(--bg-tertiary);
    padding: 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    border: 1px solid var(--border-dark);
}

.setup-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.setup-subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 14px;
}

.setup-input {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 16px;
    transition: all var(--transition-fast);
}

.setup-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.2);
}

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

.setup-label {
    display: block;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.setup-file {
    width: 100%;
    padding: 8px;
    background-color: var(--bg-input);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 24px;
}

.setup-file::-webkit-file-upload-button {
    padding: 8px 16px;
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-right: 12px;
    transition: background-color var(--transition-fast);
}

.setup-file::-webkit-file-upload-button:hover {
    background-color: var(--accent-hover);
}

.btn-finish-setup {
    width: 100%;
    padding: 14px 24px;
    background-color: var(--accent-success);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

.btn-finish-setup:hover {
    background-color: var(--accent-success-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-finish-setup i {
    width: 20px;
    height: 20px;
}

/* ===== Chat Page ===== */
#chatPage {
    background-color: var(--bg-primary);
    display: flex;
    flex-direction: column !important;
    flex: 1;
    min-height: 0;
    position: relative;
    overflow: visible !important;
}


.chat-header {
    padding: 16px 20px;
    background: transparent !important;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.chat-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, var(--accent-primary) 50%, transparent 100%);
    opacity: 0.5;
}

#chatRoomName {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.voice-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
     display: none !important;
}

.voice-btn {
    padding: 8px;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.voice-btn i {
    width: 20px;
    height: 20px;
}

.voice-btn-start {
    background-color: var(--accent-danger);
    color: var(--text-primary);
}

.voice-btn-start:hover {
    background-color: var(--accent-danger-hover);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(240, 71, 71, 0.4);
}

.voice-btn-share {
    background-color: var(--accent-warning);
    color: var(--text-primary);
}

.voice-btn-share:hover {
    background-color: var(--accent-warning-hover);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(250, 166, 26, 0.4);
}

.voice-btn-stop {
    background-color: var(--accent-primary);
    color: var(--text-primary);
}

.voice-btn-stop:hover {
    background-color: var(--accent-hover);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.4);
}

.voice-area {
    padding: 8px;
    background-color: var(--bg-tertiary);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    flex-shrink: 0;
    min-height: 0;
}

.voice-area:empty {
    display: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0; /* Allow flex shrinking */
}

/* Custom Scrollbar for Chat Messages */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

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

.chat-empty {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Message Styles */
.msg {
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: var(--radius-md);
    max-width: 80%;
    word-wrap: break-word;
    animation: fadeInMessage 0.3s ease;
}

.my-msg {
    background: #D8FFC2;
    color: #3a3a3a;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 10px rgba(150, 200, 150, 0.25);
}

.other-msg {
    background: #FFC2E9;
    color: #3a3a3a;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 4px 10px rgba(200, 150, 180, 0.25);
}



.msg-meta {
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.my-msg .msg-meta {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.my-msg .msg-meta b {
    margin-right: 8px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    margin-right: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.my-msg .avatar {
    margin-right: 0;
    margin-left: 8px;
}

.msg-content img,
.msg-content video {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin-top: 8px;
}

.file-download-link {
    color: var(--accent-hover);
    text-decoration: none;
    display: inline-block;
    margin-top: 8px;
    transition: color var(--transition-fast);
}

.file-download-link:hover {
    color: var(--accent-primary);
    text-decoration: underline;
}


.chat-file-input {
    display: none;
}

.chat-attach-btn {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.chat-attach-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-attach-btn i {
    width: 20px;
    height: 20px;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 14px;
    outline: none;
}

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

.chat-send-btn {
    padding: 8px 12px;
    background-color: var(--accent-primary);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-send-btn:hover {
    background-color: var(--accent-hover);
    transform: scale(1.05);
    box-shadow: 0 0 12px rgba(88, 101, 242, 0.4);
}

.chat-send-btn i {
    width: 20px;
    height: 20px;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

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

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

.fade-in {
    animation: fadeIn var(--transition-base);
}

.slide-in {
    animation: fadeInUp var(--transition-base);
}

/* ===== Modal Styles ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn var(--transition-base);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInScale var(--transition-base);
    border: 1px solid var(--border-dark);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

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

.modal-close i {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
}

/* ===== Members Panel ===== */
.members-panel {
    width: 240px;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.members-panel-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.members-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.member-item {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    position: relative;
}

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

.member-item .avatar {
    width: 32px;
    height: 32px;
}

.member-item .member-info {
    flex: 1;
}

.member-item .member-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.member-item .member-role {
    font-size: 12px;
    color: var(--text-muted);
}

.member-item .member-actions {
    display: flex;
    gap: 4px;
}

.member-action-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition-fast);
}

.member-action-btn:hover {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

/* ===== Enhanced Transitions ===== */
.page {
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.page.active {
    animation: fadeInScale 0.3s ease;
}

.sidebar-item {
    transition: all var(--transition-fast);
    transform: translateX(0);
}

.sidebar-item:hover {
    transform: translateX(4px);
}

.modal-content {
    transition: transform var(--transition-base), opacity var(--transition-base);
}

.modal-content:hover {
    transform: scale(1.01);
}

.btn-primary,
.btn-secondary,
.btn-google,
.btn-finish-setup,
#btnCreateGroup,
#btnJoinGroup {
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before,
.btn-google::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.btn-google:hover::before {
    width: 300px;
    height: 300px;
}

.msg {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.msg:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reaction-btn,
.add-reaction-btn {
    transition: all var(--transition-fast);
}

.reaction-btn:hover,
.add-reaction-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-sm);
}

.voice-user {
    transition: all var(--transition-fast);
}

.voice-user:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ===== Loading States ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===== Smooth Scrolling ===== */
.chat-messages,
.sidebar-content,
.members-list {
    scroll-behavior: smooth;
}

/* ===== Focus States ===== */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ===== Hover Effects ===== */
.avatar {
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.avatar:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(88, 101, 242, 0.5);
}

/* === FIX CHAT LAYOUT === */
#mainContent {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#chatPage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}



/* ==========================
   CLEAN DISCORD-LIKE CHAT STYLE
   ========================== */

/* Fix container layout */
#chatMessages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

/* Message wrapper */
.msg {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 70%;
    word-break: break-word;
    line-height: 1.4;
}

/* My message (right side) */
.my-msg {
    align-self: flex-end;
    background: #5865F2;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Other user message (left side) */
.other-msg {
    align-self: flex-start;
    background: #2f3136;
    color: white;
    border-bottom-left-radius: 4px;
}

/* Remove weird bubble shift from meta */
.msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.msg-meta img.avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

/* For my messages, move avatar to the right */
.my-msg .msg-meta {
    flex-direction: row-reverse;
}

/* Fix text inside bubbles */
.msg-content p {
    margin: 0;
    font-size: 15px;
}

/* Images inside chat */
.msg-content img {
    max-width: 240px;
    border-radius: 10px;
    margin-top: 8px;
}


#chatPage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#chatPage > div {
    flex-shrink: 0;
}

#chatMessages {
    flex-grow: 1;
    min-height: 0;
}

#chatPage {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

#chatPage > div {
    flex-shrink: 0;
}

#chatMessages {
    flex-grow: 1;
    min-height: 0;
}

#chatPage {
    display: flex !important;
    flex-direction: column !important;
}

#chatPage > div:last-child {
    flex-shrink: 0 !important;
}

#chatMessages {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
}

/* ============================
   DISCORD-STYLE INPUT BAR
   ============================ */

/* ============================================
   REFINED DISCORD STYLE
   - Clean, subtle header 
   - Unified, full-width rounded input bar
   ============================================ */

/* Chat Header */
#chatHeader {
    /* Use a slightly darker background than the main chat area (Discord uses a darker shade) */
    background-color: var(--bg-secondary); 
    border-bottom: 1px solid var(--border-color); /* Subtle divider line */
    box-shadow: none; /* Remove any shadows */
}

#chatHeader h2 {
    color: var(--text-primary);
}


/* Message Sender Bar Container */
#chatInputArea {
    /* Use the designated chat input background variable */
    background-color: var(--bg-primary); 
    padding: 16px; /* Generous padding */
    border-top: none; 
}

/* The actual Text Input field (Assuming a class like .message-input) */
#chatInputArea .message-input {
    /* A single, large rounded container for all input elements */
    background-color: var(--bg-chat-input); 
    color: var(--text-primary);
    border: none;
    border-radius: 8px; /* Slightly more rounded than standard, less than a pill */
    padding: 10px 16px;
    flex-grow: 1; 
    min-height: 44px;
    resize: none; 
    /* Ensure placeholder text uses a muted color */
    color: var(--text-placeholder);
}

/* Send Button */
#chatInputArea .send-button {
    /* Icon-only, subtle color, positioned inside or right next to the input */
    background: none;
    color: var(--accent-primary);
    width: 36px;
    height: 36px;
    margin-left: 8px;
    border-radius: 50%;
    /* Add a subtle hover effect */
    transition: background-color 0.2s;
}

#chatInputArea .send-button:hover {
    background-color: rgba(255, 255, 255, 0.1); 
}

/* ======================================
   DISCORD-LIKE CHAT INPUT BAR (FINAL)
   ====================================== */

#chatInputWrapper {
   background: rgba(255, 255, 255, 0.7);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 12px;

    /* Keep it at bottom */
    margin: 12px;
    flex-shrink: 0;

    /* Make it full width inside chat */
    width: calc(100% - 24px);


    border-radius: 16px;
    border: 1px solid #f2dfff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    transition: 0.2s;
}

#chatInputWrapper:focus-within {
    border-color: #5865f2;
    box-shadow: 0 0 0 2px rgba(88, 101, 242, .45);
}

#chatInputWrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary) !important;
    font-size: 15px;
    outline: none;
}


#chatInputWrapper input::placeholder {
    color: #a8a8a8 !important; /* light grey */
}


/* Icon buttons */
.chat-icon {
    background: transparent;
    border: none;
    padding: 6px;
    color: #b9bbbe;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-icon:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

/* Send button */
.sendBtn {
    background: #5865f2 !important;
    color: white !important;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.15s;
}

.sendBtn:hover {
    background: #4752c4 !important;
    transform: scale(1.05);
}



/* Emoji Picker */
.emoji-picker {
    position: absolute;
    bottom: 80px;
    left: 20px;
    width: 260px;
    height: 300px;
    background: #2f3136;
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
    border: 1px solid #202225;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    z-index: 9999;
    overflow: auto;
    inset: auto;
}

.emoji-picker span {
    cursor: pointer;
    font-size: 22px;
    text-align: center;
    transition: 0.1s;
}

.emoji-picker span:hover {
    transform: scale(1.2);
}

/* GIF Picker */
.gif-picker {
    position: absolute;
    bottom: 80px;
    right: 20px;
    width: 320px;
    height: 360px;
    background: #2f3136;
    border-radius: 10px;
    border: 1px solid #202225;
    overflow-y: auto;
    padding: 10px;
    z-index: 9999;
}

.gif-search {
    width: 100%;
    padding: 8px;
    border-radius: 6px;
    background: #40444b;
    color: white;
    border: none;
    margin-bottom: 10px;
}

#gifResults img {
    width: 100%;
    margin-bottom: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.15s;
}

#gifResults img:hover {
    transform: scale(1.03);
}

.members-panel {
    width: 240px;
    background: rgba(255, 255, 255, 0.5) !important;
    border-left: 1px solid var(--border-dark);
    display: flex;
    flex-direction: column;
}

.members-panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-dark);
}

.members-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.member-item {
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.member-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

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

.member-username {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

body.chat-app {
  display: grid;
  grid-template-columns: 260px 1fr 240px; /* sidebar | main chat | members */
  grid-template-rows: 100vh;
  overflow: hidden;
  background: #1e1e2e;
  color: #e0e0e0;
  font-family: 'Helvetica', sans-serif;
}

.sidebar {
  background: #2a2a3f;
  border-right: 1px solid #333;
  /* internal scrolling if list long */
  overflow-y: auto;
}

.chat-main {
  display: flex;
  flex-direction: column;
}

.chat-header {
  height: 60px;
  padding: 0 16px;
  background: #23232f;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #333;
}

.chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #1e1e2e;
}

.chat-input {
  height: 60px;
  border-top: 1px solid #333;
  background: #23232f;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.members-panel {
  background: #2a2a3f;
  border-left: 1px solid #333;
  overflow-y: auto;
}

.msg { margin-bottom: 12px; display: flex; }
.msg .avatar { width: 32px; height: 32px; border-radius: 50%; margin-right: 8px; }
.msg .bubble {
  background: #32324a;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 70%;
  color: #e0e0e0;
}
.my-msg .bubble {
  background: #5865f2; /* accent / brand color */
  color: white;
  margin-left: auto;
}


/* Pastel header action buttons */
.header-action-btn {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 180, 255, 0.5);
    border-radius: 12px;
    color: #444;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    transition: 0.2s;
    backdrop-filter: blur(6px);
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 2px 6px rgba(180, 150, 255, 0.3);
}

/* Leave button in soft red */
.header-leave-btn {
    border: 1px solid rgba(255, 120, 140, 0.5);
    background: rgba(255, 200, 210, 0.6);
    color: #b13040;
}

.header-leave-btn:hover {
    background: rgba(255, 200, 210, 0.8);
}

/* Pastel message colors */
.msg.my-msg {
    background: #bbf3ff !important;  /* mint */
    color: #3a3a3a !important;
    border-radius: 18px 18px 4px 18px !important;
}

.msg.other-msg {
    background: #ffeebd !important;  /* pink */
    color: #3a3a3a !important;
    border-radius: 18px 18px 18px 4px !important;
}



.oauth-button.discord {
  background: #d8c2ff;
  border: 1px solid #c7a4ff;
  color: #4c2e85;
  border-radius: 12px;
  padding: 10px 16px;
  width: 100%;
  margin-top: 10px;
  font-weight: 600;
}

.reply-box {
    background: rgba(255, 255, 255, 0.6);
    border-left: 4px solid #b38cff;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 6px;
    font-size: 12px;
}

.reply-box .reply-author {
    font-weight: 600;
    color: #444;
    margin-bottom: 2px;
}

.reply-box .reply-snippet {
    color: #555;
}

.reply-box {
    background: rgba(255, 255, 255, 0.65);
    border-left: 4px solid #c99bff;
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    font-size: 12px;
}

.reply-box .reply-author {
    font-weight: 700;
    color: #5b3a70;
    margin-bottom: 2px;
}

.reply-box .reply-snippet {
    color: #444;
}

/* Reply preview box */
.reply-preview-box {
    background: rgba(255, 255, 255, 0.7);
    border-left: 4px solid #5865f2;
    padding: 10px 14px;
    margin: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    position: relative;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.reply-title {
    color: #5865f2;
    font-weight: 600;
    margin-bottom: 4px;
}

.reply-snippet {
    color: #444;
}

.cancel-reply-btn {
    position: absolute;
    right: 10px;
    top: 8px;
    border: none;
    background: transparent;
    color: #333;
    cursor: pointer;
    font-size: 16px;
}
.cancel-reply-btn:hover {
    color: #5865f2;
}

/* Highlight target message when jumping to original */
.reply-highlight {
    box-shadow: 0 0 0 3px rgba(138,198,255,0.25) inset, 0 6px 18px rgba(138,198,255,0.12);
    border-radius: 12px;
    transition: box-shadow 300ms ease, background-color 300ms ease;
    background-color: rgba(138,198,255,0.03);
}
