/* ========================================
   Roy4d Chat – Premium UI Stylesheet
   Complete Modern Redesign
   ======================================== */

/* ---- Google Fonts ---- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ---- CSS Variables / Theming ---- */
:root {
    --bg-primary: #0a0a10;
    --bg-secondary: #111118;
    --bg-tertiary: #19192a;
    --bg-hover: #1e1e32;
    --bg-active: #262640;
    --bg-card: #131320;
    --surface: #1a1a2c;
    --border: #252540;
    --border-light: #303050;
    --text-primary: #eeeef5;
    --text-secondary: #9898b8;
    --text-muted: #606080;
    --accent: #7c5cfc;
    --accent-hover: #8e70ff;
    --accent-light: rgba(124, 92, 252, 0.12);
    --accent-glow: rgba(124, 92, 252, 0.25);
    --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #b44aff 100%);
    --accent-gradient-h: linear-gradient(90deg, #7c5cfc 0%, #b44aff 100%);
    --green: #00d26a;
    --green-light: rgba(0, 210, 106, 0.12);
    --red: #ff4060;
    --red-hover: #ff6080;
    --red-light: rgba(255, 64, 96, 0.12);
    --orange: #ffa040;
    --yellow: #ffe040;
    --blue: #40a0ff;
    --msg-out: #1e1850;
    --msg-in: #16162a;
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
    --shadow-accent: 0 4px 20px rgba(124, 92, 252, 0.3);
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --sidebar-width: 360px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #f4f4fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #eeeef6;
    --bg-hover: #e4e4f0;
    --bg-active: #d8d8ea;
    --bg-card: #ffffff;
    --surface: #ededf6;
    --border: #d4d4e4;
    --border-light: #e0e0ee;
    --text-primary: #14142b;
    --text-secondary: #626280;
    --text-muted: #9898b0;
    --accent-light: rgba(124, 92, 252, 0.08);
    --accent-glow: rgba(124, 92, 252, 0.15);
    --msg-out: #ede6ff;
    --msg-in: #f0f0f8;
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --shadow-accent: 0 4px 20px rgba(124, 92, 252, 0.15);
}

/* ---- Reset ---- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

img {
    max-width: 100%;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---- Selection ---- */
::selection {
    background: var(--accent-light);
    color: var(--accent);
}

/* ---- Screens ---- */
.screen {
    display: none;
    height: 100vh;
    width: 100vw;
}

.screen.active {
    display: flex;
}

/* ============================================================
   AUTH SCREEN
   ============================================================ */
.auth-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    padding: 24px;
    background: var(--bg-primary);
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-wrapper::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(124, 92, 252, 0.12) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: authGlow 8s ease-in-out infinite alternate;
}

.auth-wrapper::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(180, 74, 255, 0.08) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
    animation: authGlow 8s ease-in-out 4s infinite alternate;
}

@keyframes authGlow {
    from {
        transform: translate(0, 0) scale(1);
    }

    to {
        transform: translate(30px, -20px) scale(1.1);
    }
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.brand-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: var(--accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-accent);
    animation: brandPulse 3s ease-in-out infinite;
}

@keyframes brandPulse {

    0%,
    100% {
        box-shadow: var(--shadow-accent);
    }

    50% {
        box-shadow: 0 4px 30px rgba(124, 92, 252, 0.5);
    }
}

.auth-brand h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand p {
    color: var(--text-secondary);
    margin-top: 6px;
    font-size: 15px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    margin-bottom: auto;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: formIn 0.3s ease;
}

@keyframes formIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

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

.input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: var(--transition);
    z-index: 1;
}

.input-group input {
    width: 100%;
    padding: 13px 14px 13px 44px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 14px;
}

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

.input-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.input-group:focus-within svg {
    color: var(--accent);
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    min-height: 20px;
    text-align: center;
    font-weight: 500;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: var(--transition);
}

.btn:hover::after {
    opacity: 1;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 28px rgba(124, 92, 252, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    box-shadow: 0 2px 10px rgba(255, 64, 96, 0.2);
}

.btn-danger:hover {
    background: var(--red-hover);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-xs);
}

.btn-row {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---- Icon Buttons ---- */
.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

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

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

/* ============================================================
   INPUT FIELDS
   ============================================================ */
.input-field {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    resize: vertical;
    font-size: 14px;
}

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

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.input-row {
    display: flex;
    align-items: center;
}

.input-prefix {
    padding: 11px 0 11px 14px;
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    color: var(--text-muted);
    font-weight: 600;
}

.input-with-prefix {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Form Group */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ---- Floating Label Fields ---- */
.float-field {
    position: relative;
    margin-bottom: 16px;
}

.float-field>.input-field {
    padding: 22px 14px 8px;
}

.float-field>label,
.float-field .input-row>label {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.18s ease;
    font-weight: 500;
    background: transparent;
    z-index: 1;
}

/* Prefix offset */
.float-field.has-prefix .input-row>label {
    left: 36px;
}

.float-field>textarea.input-field~label {
    top: 16px;
    transform: none;
}

/* Float up on focus or when filled */
.float-field>.input-field:focus~label,
.float-field>.input-field:not(:placeholder-shown)~label {
    top: 6px;
    transform: none;
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

.float-field .input-row>.input-field:focus~label,
.float-field .input-row>.input-field:not(:placeholder-shown)~label {
    top: 6px;
    transform: none;
    font-size: 11px;
    color: var(--accent);
    font-weight: 600;
}

/* Prefixed input in float-field */
.float-field.has-prefix .input-row {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    transition: var(--transition);
}

.float-field.has-prefix .input-row:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.float-field.has-prefix .input-field {
    padding: 22px 14px 8px;
    border: none;
    box-shadow: none;
    background: transparent;
}

.float-field.has-prefix .input-field:focus {
    border: none;
    box-shadow: none;
}

.float-field.has-prefix .input-prefix {
    padding: 0 0 0 14px;
    border: none;
    background: transparent;
    align-self: center;
}

.float-field .hint {
    display: block;
    margin-top: 4px;
}

/* ---- Photo Upload Widget ---- */
.photo-upload-area {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.photo-upload-btn {
    position: relative;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 2px dashed var(--border);
    background: var(--bg-tertiary);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.photo-upload-btn:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.photo-upload-btn:hover .photo-upload-placeholder {
    color: var(--accent);
}

.photo-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    transition: color 0.2s ease;
}

.photo-upload-placeholder span {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.photo-upload-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.photo-upload-edit {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    position: relative;
    z-index: 10;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    min-height: 60px;
}

.sidebar-top-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--bg-hover);
}

.user-meta {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 15px;
}

.user-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-top: 3px;
}

.user-status-dot.online {
    background: var(--green);
    box-shadow: 0 0 8px rgba(0, 210, 106, 0.5);
    animation: onlinePulse 2s ease-in-out infinite;
}

@keyframes onlinePulse {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(0, 210, 106, 0.5);
    }

    50% {
        box-shadow: 0 0 14px rgba(0, 210, 106, 0.7);
    }
}

.user-status-dot.offline {
    background: var(--text-muted);
}

/* ---- Avatars ---- */
.avatar {
    border-radius: 50%;
    background: var(--accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 11px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 13px;
}

.avatar-md {
    width: 44px;
    height: 44px;
    font-size: 16px;
}

.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 20px;
}

.avatar-xl {
    width: 80px;
    height: 80px;
    font-size: 30px;
}

/* ---- Navigation Tabs ---- */
.nav-tabs {
    display: flex;
    padding: 8px 10px;
    gap: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    -ms-overflow-style: none;
    scrollbar-width: none;
    background: var(--bg-secondary);
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
    flex-shrink: 0;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    position: relative;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.nav-tab.active {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
}

/* ---- Bottom Navigation Bar ---- */
.bottom-nav {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 6px 8px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    flex-shrink: 0;
    z-index: 5;
}

.bottom-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    font-size: 10px;
    font-weight: 600;
    flex: 1;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-btn svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.bottom-nav-btn span {
    font-size: 10px;
    line-height: 1.2;
    white-space: nowrap;
}

.bottom-nav-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-hover);
}

.bottom-nav-btn.active {
    color: var(--accent);
}

.bottom-nav-btn.active svg {
    transform: scale(1.08);
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.bottom-nav-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--accent);
    border-radius: 0 0 3px 3px;
}

.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
}

/* ---- Sidebar Search ---- */
.sidebar-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

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

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

.search-input-wrapper .input-field {
    padding-left: 36px;
    padding-right: 32px;
    height: 38px;
    font-size: 13px;
}

.search-input-wrapper .global-search-clear {
    position: absolute;
    right: 4px;
    width: 28px;
    height: 28px;
    padding: 0;
}

#global-search-results {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

#global-search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

#global-search-results .search-result-item:hover {
    background: var(--bg-hover);
}

#global-search-results .search-result-info {
    flex: 1;
    min-width: 0;
}

#global-search-results .search-result-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#global-search-results .search-result-info small {
    color: var(--text-muted);
    font-size: 12px;
}

#global-search-results .search-result-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
    text-transform: capitalize;
    flex-shrink: 0;
}

#global-search-results .search-no-results {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 13px;
}

/* ---- Chat List ---- */
.chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.chat-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.chat-item:last-child {
    border-bottom: none;
}

.chat-item:hover {
    background: var(--bg-hover);
}

.chat-item.active {
    background: var(--accent-light);
}

.chat-item .avatar {
    width: 50px;
    height: 50px;
    min-width: 50px;
    font-size: 18px;
}

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

.chat-item-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-last {
    color: var(--text-muted);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-item-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.chat-item-time {
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
    font-weight: 500;
}

.chat-item-badge {
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    border-radius: 10px;
    text-align: center;
    padding: 0 6px;
}

/* ---- Empty State ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
    gap: 8px;
}

.empty-state svg {
    opacity: 0.2;
}

.empty-state p {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 15px;
}

.empty-state span {
    font-size: 13px;
}

/* ---- FAB ---- */
.fab {
    position: absolute;
    bottom: 80px;
    right: 16px;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-accent);
    transition: var(--transition-bounce);
    z-index: 5;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 8px 30px rgba(124, 92, 252, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

/* ============================================================
   MAIN CHAT AREA
   ============================================================ */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    position: relative;
    min-width: 0;
}

/* ---- Welcome Screen ---- */
.welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-primary);
}

.welcome-inner {
    text-align: center;
    max-width: 600px;
    animation: welcomeIn 0.5s ease;
}

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

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

.welcome-icon {
    width: 100px;
    height: 100px;
    border-radius: 32px;
    background: var(--accent-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    box-shadow: var(--shadow-accent);
    animation: welcomePulse 4s ease-in-out infinite;
}

@keyframes welcomePulse {

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

    50% {
        transform: scale(1.05);
    }
}

.welcome-inner h2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.welcome-inner>p {
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 16px;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-card:hover::before {
    opacity: 0.05;
}

.feature-card svg {
    color: var(--accent);
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.feature-card h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    position: relative;
    z-index: 1;
}

.feature-card p {
    font-size: 12px;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

/* ---- Chat Container ---- */
#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ---- Chat Header ---- */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    min-height: 60px;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.chat-header-info {
    min-width: 0;
}

.chat-header-info h3 {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-status-text {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
}

.back-btn {
    display: none;
}

/* ---- Messages Area ---- */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    background-image: radial-gradient(circle at 50% 50%, rgba(124, 92, 252, 0.02) 0%, transparent 80%);
}

.message {
    display: flex;
    gap: 8px;
    max-width: 72%;
    animation: msgIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

.message.outgoing {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.55;
    word-break: break-word;
    position: relative;
    transition: background 0.2s ease;
}

.message.incoming .msg-bubble {
    background: var(--msg-in);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.outgoing .msg-bubble {
    background: var(--msg-out);
    border: 1px solid rgba(124, 92, 252, 0.15);
    border-bottom-right-radius: 4px;
}

.msg-sender {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 3px;
}

.msg-text {
    font-size: 14px;
    line-height: 1.55;
}

.msg-text a {
    color: var(--accent-hover);
    text-decoration: underline;
}

.msg-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.msg-edited {
    font-style: italic;
    opacity: 0.7;
}

#edit-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    border-radius: var(--radius-sm);
    margin: 0 8px 4px;
}

#edit-banner button {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
}

.msg-attachment img {
    max-width: 280px;
    max-height: 280px;
    border-radius: var(--radius-sm);
    margin-top: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.msg-attachment img:hover {
    transform: scale(1.02);
}

.msg-attachment a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.msg-attachment a:hover {
    background: var(--bg-hover);
}

.msg-reply {
    padding: 7px 10px;
    margin-bottom: 6px;
    border-left: 3px solid var(--accent);
    background: var(--accent-light);
    border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.msg-reply:hover {
    background: var(--accent-glow);
}

.msg-deleted {
    font-style: italic;
    color: var(--text-muted);
    font-size: 13px;
}

.msg-date-sep {
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    padding: 12px 0;
    align-self: center;
}

.msg-date-sep span {
    padding: 5px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    letter-spacing: 0.3px;
}

.new-msg-indicator {
    position: sticky;
    bottom: 8px;
    align-self: center;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow-accent);
    z-index: 5;
    transition: var(--transition);
}

.new-msg-indicator:hover {
    transform: translateY(-2px);
}

/* ---- Bot Start ---- */
.bot-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.bot-start p {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 13px;
}

/* ---- Typing Indicator ---- */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-secondary);
}

.typing-dots {
    display: inline-flex;
    gap: 3px;
}

.typing-dots span {
    width: 5px;
    height: 5px;
    background: var(--accent);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ---- Message Input Bar ---- */
.msg-input-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 16px 12px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
}

.msg-input-bar textarea {
    flex: 1;
    padding: 10px 16px;
    border: 1.5px solid var(--border);
    border-radius: 22px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    resize: none;
    max-height: 120px;
    line-height: 1.5;
    transition: var(--transition);
    font-size: 14px;
}

.msg-input-bar textarea::placeholder {
    color: var(--text-muted);
}

.msg-input-bar textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.send-btn {
    background: var(--accent-gradient) !important;
    color: #fff !important;
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
    box-shadow: var(--shadow-accent);
    transition: var(--transition-bounce) !important;
}

.send-btn:hover {
    transform: scale(1.1) !important;
    background: var(--accent-hover) !important;
}

/* ============================================================
   SETTINGS
   ============================================================ */
.settings-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    height: 100vh;
    overflow: hidden;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.settings-header h2 {
    font-size: 20px;
    font-weight: 700;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    max-width: 640px;
}

.settings-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--transition);
}

.settings-section:hover {
    border-color: var(--border-light);
}

.settings-section h3 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.2px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 2px 0;
}

.section-head h3 {
    margin-bottom: 0;
}

.section-content.collapsible {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), margin 0.35s ease;
    margin-top: 16px;
}

.section-content.collapsed {
    max-height: 0;
    margin-top: 0;
}

.chevron {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.chevron.rotated {
    transform: rotate(180deg);
}

/* Profile Photo Upload */
.profile-photo-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

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

.profile-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-photo-actions label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Except Tags */
.except-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.except-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

.except-tag button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 0;
    line-height: 1;
}

.except-tag button:hover {
    color: var(--red);
}

.settings-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.settings-form input,
.settings-form textarea {
    width: 100%;
    margin-top: 4px;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    font-size: 14px;
}

.settings-form input:focus,
.settings-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
    background: var(--bg-secondary);
}

.save-msg {
    margin-top: 10px;
    font-size: 13px;
    min-height: 20px;
    font-weight: 600;
}

.save-msg.success {
    color: var(--green);
}

.save-msg.error {
    color: var(--red);
}

/* ---- Toggle Switches ---- */
.toggle-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.toggle-item:last-child {
    border-bottom: none;
}

.toggle-item:hover {
    background: transparent;
}

.toggle-item div strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.toggle-item div small {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 1px;
    display: block;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    inset: 0;
    background: var(--border-light);
    border-radius: 26px;
    cursor: pointer;
    transition: var(--transition);
}

.slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked+.slider {
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

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

/* ---- Theme Switcher ---- */
.theme-switcher {
    display: flex;
    gap: 10px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 14px;
}

.theme-btn:hover {
    border-color: var(--border-light);
    background: var(--bg-hover);
}

.theme-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

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

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

.modal-sm {
    max-width: 380px;
}

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

.modal-head h3 {
    font-size: 17px;
    font-weight: 700;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-foot {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* ---- New Chat Picker Grid ---- */
.nc-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 4px 0;
}

.nc-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 16px;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
}

.nc-option:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nc-option:active {
    transform: translateY(0);
}

.nc-option-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.nc-option-icon-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    color: var(--text-muted);
}

.nc-option-label {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.nc-option-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.3;
}

.nc-option-wide {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: center;
    padding: 14px 16px;
    gap: 12px;
}

.nc-option-wide .nc-option-label {
    font-size: 13px;
}

#new-chat-back-btn {
    margin-right: 4px;
}

/* ---- Modal Tabs (legacy) ---- */
.modal-tabs-bar {
    display: flex;
    padding: 0 16px;
    gap: 2px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    -ms-overflow-style: none;
    scrollbar-width: none;
    background: var(--bg-secondary);
}

.modal-tabs-bar::-webkit-scrollbar {
    display: none;
}

.modal-tab {
    padding: 11px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.modal-tab:hover {
    color: var(--text-secondary);
}

.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ---- Results List ---- */
.results-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.result-item:hover {
    background: var(--bg-hover);
}

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

.result-item-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
}

.result-item-info small {
    color: var(--text-muted);
    font-size: 12px;
}

/* ---- Members List ---- */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 250px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.member-item:hover {
    background: var(--bg-hover);
}

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

.member-item .member-info strong {
    font-size: 13px;
    font-weight: 600;
}

.member-item .member-info small {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
}

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

/* ---- Info Card ---- */
.info-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
}

.info-card h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.copy-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.copy-row code {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    font-family: 'Fira Code', 'Cascadia Code', monospace;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Rules Box ---- */
.rules-box {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 220px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 13px;
    line-height: 1.7;
}

/* ---- Checkbox ---- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---- Toggle Switch Row ---- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1.5px solid var(--border-light);
    cursor: pointer;
    transition: border-color 0.15s ease;
    margin-bottom: 0;
}

.form-group label.toggle-row {
    display: flex;
    margin-bottom: 0;
}

.toggle-row:hover {
    border-color: var(--border);
}

.toggle-row-text {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-muted);
}

.toggle-row-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.toggle-row-hint {
    display: block;
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.toggle-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: relative;
    width: 42px;
    min-width: 42px;
    height: 24px;
    background: var(--border);
    border-radius: 12px;
    transition: background 0.2s ease;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle-input:checked~.toggle-track {
    background: var(--accent);
}

.toggle-input:checked~.toggle-track .toggle-thumb {
    transform: translateX(18px);
}

.toggle-input:focus-visible~.toggle-track {
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ---- File label ---- */
.file-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.file-label input[type="file"] {
    margin-top: 4px;
}

.preview-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success {
    background: var(--green-light);
    color: var(--green);
}

.badge-danger {
    background: var(--red-light);
    color: var(--red);
}

.badge-info {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-warn {
    background: #fff3e0;
    color: #e65100;
}

/* ============================================================
   CONTEXT MENU
   ============================================================ */
.context-menu {
    position: fixed;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200;
    min-width: 170px;
    animation: ctxIn 0.15s ease;
}

@keyframes ctxIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

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

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    text-align: left;
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-item.danger {
    color: var(--red);
}

.context-menu-item.danger:hover {
    background: var(--red-light);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.notification-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 280px;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 3px solid var(--accent);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

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

.notification-toast h4 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.notification-toast p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.muted {
    color: var(--text-muted);
    font-size: 13px;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 5px;
    display: block;
}

.hidden {
    display: none !important;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

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

.justify-between {
    justify-content: space-between;
}

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

/* ---- Loading Spinner ---- */
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 24px auto;
}

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

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 780px) {
    :root {
        --sidebar-width: 100%;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        position: absolute;
        inset: 0;
        z-index: 20;
    }

    .sidebar.hidden-mobile {
        transform: translateX(-100%);
        pointer-events: none;
    }

    .back-btn {
        display: flex;
    }

    .main-area {
        width: 100%;
    }

    .feature-cards {
        grid-template-columns: 1fr;
    }

    .welcome {
        padding: 16px;
    }

    .welcome-inner h2 {
        font-size: 22px;
    }

    .welcome-icon {
        width: 80px;
        height: 80px;
        border-radius: 24px;
    }

    .bottom-nav {
        padding: 4px 4px;
        padding-bottom: max(4px, env(safe-area-inset-bottom));
    }

    .bottom-nav-btn {
        padding: 6px 4px 4px;
    }

    .bottom-nav-btn svg {
        width: 22px;
        height: 22px;
    }

    .bottom-nav-btn span {
        font-size: 9px;
    }

    .fab {
        bottom: 76px;
        right: 12px;
        width: 48px;
        height: 48px;
        border-radius: 14px;
    }
}

@media (max-width: 480px) {
    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        align-self: flex-end;
        max-height: 90vh;
    }

    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .msg-input-bar {
        padding: 8px 10px 10px;
    }

    .messages-area {
        padding: 14px;
    }

    .message {
        max-width: 85%;
    }

    .chat-header {
        padding: 8px 12px;
    }

    .settings-body {
        padding: 12px;
    }

    .auth-card {
        padding: 24px;
    }

    .auth-brand h1 {
        font-size: 26px;
    }

    .bottom-nav .nav-tab span {
        font-size: 8.5px;
    }
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Verification Section ── */
.verification-banner {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.verification-banner.verified {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.verification-banner.pending {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.verification-banner.rejected {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.verification-banner.none {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    color: var(--text-secondary);
}

.verification-info {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
    line-height: 1.5;
}

#verification-form label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

#verification-form label input,
#verification-form label select,
#verification-form label textarea {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

#verification-form label select {
    cursor: pointer;
}

.blue-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    font-size: 10px;
    margin-left: 4px;
    vertical-align: middle;
}

.blue-badge::after {
    content: '✓';
}

/* ═══════════════════════════════════════
   INVITE PREVIEW MODAL
   ═══════════════════════════════════════ */
#invite-preview-modal {
    z-index: 500;
}

.invite-preview-modal {
    max-width: 420px;
    width: 92%;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.invite-preview-content {
    padding: 32px 24px;
    text-align: center;
}

.invite-preview-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 0;
}

.invite-preview-center p {
    color: var(--text-muted);
    font-size: 14px;
}

.invite-preview-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    overflow: hidden;
    border: 3px solid var(--border);
}

.invite-preview-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invite-preview-name {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: -0.3px;
    word-break: break-word;
}

.invite-preview-type {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 4px;
}

.invite-preview-members {
    display: block;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 12px;
}

.invite-preview-desc {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    margin: 0 0 16px;
    max-height: 80px;
    overflow-y: auto;
    word-break: break-word;
}

.invite-preview-rules {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    text-align: left;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
}

.invite-preview-rules h4 {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 6px;
}

.invite-preview-rules p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
    white-space: pre-wrap;
}

.invite-preview-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.invite-preview-actions .btn {
    flex: 1;
    padding: 12px 0;
    font-size: 15px;
    font-weight: 600;
}

.invite-preview-login-hint {
    margin-top: 12px;
    padding: 10px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ═══════════════════════════════════════
   STATUS UPDATES STYLES
   ═══════════════════════════════════════ */
#status-screen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-primary);
    display: none;
    flex-direction: column;
}

#status-screen.active {
    display: flex;
}

.status-screen-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.status-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* My Status */
.status-my-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.status-my-row {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.status-avatar-ring {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    padding: 3px;
    background: conic-gradient(var(--accent) 0%, var(--accent) 100%);
    flex-shrink: 0;
}

.status-avatar-ring.no-status {
    background: var(--border);
}

.status-avatar-ring.seen {
    background: var(--text-muted);
}

.status-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.status-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.status-my-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 15px;
}

.status-my-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.status-add-btn {
    color: var(--accent);
}

/* Section label */
.status-section-label {
    padding: 12px 16px 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Feed list */
.status-feed-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 16px;
}

.status-feed-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
}

.status-feed-item:hover {
    background: var(--bg-hover);
}

.status-feed-item .status-avatar-ring {
    width: 48px;
    height: 48px;
}

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

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

.status-feed-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

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

.status-empty p {
    opacity: 0.6;
}

/* ─── Status Viewer ─── */
.status-viewer {
    position: fixed;
    inset: 0;
    z-index: 300;
    background: #000;
    display: flex;
    flex-direction: column;
}

.status-viewer-progress {
    display: flex;
    gap: 3px;
    padding: 8px 8px 0;
    z-index: 3;
}

.status-progress-bar {
    flex: 1;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
}

.status-progress-bar .fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.status-progress-bar.completed .fill {
    width: 100%;
}

.status-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    z-index: 3;
}

.status-viewer-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-viewer-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #333;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-viewer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.status-viewer-info {
    display: flex;
    flex-direction: column;
}

.status-viewer-name {
    font-weight: 600;
    color: #fff;
    font-size: 14px;
}

.status-viewer-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
}

.status-viewer-actions {
    display: flex;
    gap: 6px;
}

.status-viewer-actions .icon-btn {
    color: #fff;
}

.status-viewer-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.status-viewer-content img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.status-viewer-content video {
    max-width: 100%;
    max-height: 100%;
}

.status-viewer-content audio {
    width: 80%;
    max-width: 400px;
}

.status-viewer-content .text-status {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    font-size: 24px;
    line-height: 1.4;
    word-break: break-word;
}

.status-viewer-nav {
    position: absolute;
    inset: 0;
    display: flex;
    z-index: 2;
    pointer-events: none;
}

.status-viewer-nav-prev,
.status-viewer-nav-next {
    flex: 1;
    pointer-events: auto;
    cursor: pointer;
}

.status-viewer-footer {
    padding: 10px 16px;
    text-align: center;
    z-index: 3;
}

.status-viewer-footer span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.status-viewer-caption {
    position: absolute;
    bottom: 50px;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    color: #fff;
    font-size: 14px;
    text-align: center;
    z-index: 3;
}

/* ─── Status Creator Modal ─── */
.status-creator-modal {
    max-width: 520px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}

#status-creator {
    z-index: 300;
}

.status-creator-body {
    padding: 0 !important;
}

.status-type-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.status-type-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 2px solid transparent;
}

.status-type-tab:hover {
    color: var(--text-primary);
}

.status-type-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Text Panel */
.status-text-preview {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background 0.3s;
    background: #7c5cfc;
    border-radius: 8px;
    margin: 16px;
}

.status-text-preview textarea {
    width: 100%;
    min-height: 120px;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    text-align: center;
    resize: none;
    font-family: 'Inter', sans-serif;
    outline: none;
}

.status-text-preview textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.status-text-controls {
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.status-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.status-control-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-control-group input[type="color"] {
    width: 36px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    padding: 2px;
}

.status-control-group select {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.status-gradient-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 16px 12px;
}

.status-checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px !important;
    text-transform: none !important;
    color: var(--text-muted);
    cursor: pointer;
    margin-top: 2px;
}

/* Gradient presets */
.status-gradient-presets {
    padding: 0 16px 12px;
}

.status-gradient-presets label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 6px;
    display: block;
}

.status-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.status-preset {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.status-preset:hover {
    transform: scale(1.15);
    border-color: var(--accent);
}

/* Media Panel */
.status-media-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    margin: 16px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.status-media-drop:hover {
    border-color: var(--accent);
    background: rgba(124, 92, 252, 0.05);
}

.status-media-drop p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
}

.status-media-preview {
    margin: 16px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 300px;
}

.status-media-preview img,
.status-media-preview video {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.status-media-preview audio {
    width: 100%;
    padding: 20px;
}

.status-caption-row {
    padding: 0 16px 12px;
}

.status-caption-row input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
}

/* Privacy */
.status-privacy-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

.status-privacy-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-privacy-row select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13px;
}

/* ─── Responsive for status ─── */
@media (max-width: 780px) {
    .status-creator-modal {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
}

/* ═══════════════════════════════════════
   ATTACH BOTTOM SHEET
   ═══════════════════════════════════════ */
.bottom-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 400;
    display: none;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.bottom-sheet-overlay.active {
    display: flex;
}

.bottom-sheet {
    background: var(--bg-secondary);
    border-radius: 18px 18px 0 0;
    width: 100%;
    max-width: 480px;
    padding: 12px 20px 28px;
    animation: sheetUp 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheetUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.bottom-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.bottom-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 8px;
}

.bottom-sheet-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 4px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.bottom-sheet-item:hover {
    background: var(--bg-tertiary);
}

.bottom-sheet-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ═══════════════════════════════════════
   POLL CREATION MODAL
   ═══════════════════════════════════════ */
.poll-create-modal {
    max-width: 480px;
    width: 95%;
}

#poll-create-modal {
    z-index: 450;
}

.poll-create-body {
    max-height: 65vh;
    overflow-y: auto;
}

.poll-type-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.poll-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
}

.poll-type-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.poll-option-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.poll-option-row .poll-option-input {
    flex: 1;
}

.poll-option-row .poll-remove-btn {
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    line-height: 1;
}

.poll-option-row .poll-remove-btn:hover {
    color: var(--danger);
}

.poll-correct-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border) !important;
    background: none !important;
    font-size: 16px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-muted);
}

.poll-correct-btn.selected {
    border-color: #4CAF50 !important;
    background: #4CAF50 !important;
    color: #fff;
}

.btn-ghost {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-weight: 600;
    padding: 8px 0;
}

.btn-ghost:hover {
    text-decoration: underline;
}

.btn-sm {
    font-size: 13px;
    padding: 6px 12px;
}

.poll-settings {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 8px;
}

.poll-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    font-size: 14px;
    cursor: pointer;
}

.poll-setting-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

/* ═══════════════════════════════════════
   POLL DISPLAY IN MESSAGES
   ═══════════════════════════════════════ */
.poll-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 6px;
    max-width: 360px;
}

.poll-card-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.poll-card-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 10px;
    background: var(--accent-light);
    color: var(--accent);
}

.poll-card-badge.quiz {
    background: #FFF3E0;
    color: #E65100;
}

.poll-card-badge.closed {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.poll-card-question {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    line-height: 1.4;
    word-break: break-word;
}

.poll-option {
    position: relative;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.poll-option:hover:not(.voted):not(.closed) {
    border-color: var(--accent);
}

.poll-option.selected {
    border-color: var(--accent);
}

.poll-option.correct {
    border-color: #4CAF50;
}

.poll-option.wrong {
    border-color: #f44336;
}

.poll-option.closed {
    cursor: default;
}

.poll-option-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.poll-option.correct .poll-option-fill {
    background: rgba(76, 175, 80, 0.15);
}

.poll-option.wrong .poll-option-fill {
    background: rgba(244, 67, 54, 0.1);
}

.poll-option-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.poll-option-text {
    font-size: 14px;
    font-weight: 500;
}

.poll-option-check {
    font-size: 14px;
    margin-right: 6px;
}

.poll-option-pct {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 38px;
    text-align: right;
}

.poll-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.poll-card-footer button {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    padding: 0;
}

.poll-card-footer button:hover {
    text-decoration: underline;
}

.poll-explanation {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.poll-explanation strong {
    color: var(--text-primary);
}

/* ─── Responsive ─── */
@media (max-width: 780px) {
    .bottom-sheet {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
    }

    .bottom-sheet-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .poll-card {
        max-width: 100%;
    }
}

/* ═══════════════════════════════════════
   FORWARD MESSAGE MODAL
   ═══════════════════════════════════════ */
#forward-modal {
    z-index: 500;
}

.forward-modal {
    max-width: 440px;
    width: 95%;
}

.forward-body {
    max-height: 55vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.forward-body .input-field {
    flex-shrink: 0;
}

.forward-selected-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 0;
}

.forward-selected-chips:empty {
    display: none;
}

.forward-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-light);
    color: var(--accent);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.forward-chip-remove {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0 2px;
}

.forward-chat-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 120px;
}

.forward-chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
}

.forward-chat-item:hover {
    background: var(--bg-tertiary);
}

.forward-chat-item.selected {
    background: var(--accent-light);
}

.forward-chat-item .avatar {
    flex-shrink: 0;
}

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

.forward-chat-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.forward-chat-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.forward-chat-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    transition: var(--transition);
}

.forward-chat-item.selected .forward-chat-check {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

/* ─── Forwarded message indicator ─── */
.msg-forwarded {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-style: italic;
}

.msg-forwarded svg {
    flex-shrink: 0;
}

@media (max-width: 780px) {
    .forward-modal {
        max-width: 100%;
        width: 100%;
        height: 80%;
        border-radius: 16px 16px 0 0;
    }
}