/* ═══════════════════════════════════════════════════════════
   YerimChat — style.css
   Professional dark-mode mobile-first design
   Color palette: #0f0e17 / #16161a / #7f5af0 / #2cb67d / #fffffe
   ═══════════════════════════════════════════════════════════ */

/* ─── CSS CUSTOM PROPERTIES ─── */
:root {
    --bg-deep: #0f0e17;
    --bg-surface: #16161a;
    --bg-surface-2: #1e1e24;
    --bg-surface-3: #242629;
    --bg-input-dark: #242629;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-accent: #2cb67d;

    --text-primary: #fffffe;
    --text-secondary: #94a1b2;
    --text-muted: #72757e;
    --text-heading: #fffffe;

    --accent: #7f5af0;
    --accent-hover: #9b7bf7;
    --accent-glow: rgba(127, 90, 240, 0.25);
    --accent-gradient: linear-gradient(135deg, #7f5af0, #6246d4);

    --green: #2cb67d;
    --green-glow: rgba(44, 182, 125, 0.25);
    --red: #ef4444;
    --orange: #f59e0b;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;
    --radius-pill: 20px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);

    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── RESET ─── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
}

body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: fixed;
    font-family: var(--font);
    background-color: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

/* ─── SCROLLBAR: hidden but functional ─── */
.messages-container::-webkit-scrollbar,
.users-list::-webkit-scrollbar,
.friends-list::-webkit-scrollbar,
.friend-requests-list::-webkit-scrollbar,
.dm-messages::-webkit-scrollbar {
    display: none;
}

.messages-container,
.users-list,
.friends-list,
.friend-requests-list,
.dm-messages {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* ─── UTILITY ─── */
.hidden {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════════════════════════ */
.login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-deep);
    z-index: 1000;
    overflow: hidden;
}

.login-container {
    text-align: center;
    z-index: 2;
    padding: 48px 36px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: fadeInUp 0.6s ease-out;
}

.login-logo .logo-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 16px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    color: #fff;
    box-shadow: 0 0 30px var(--accent-glow);
    animation: pulse-glow 3s ease-in-out infinite;
}

.login-logo h1 {
    font-size: 30px;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.login-tagline {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 32px;
}

.login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.btn-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
}

.btn-anon {
    background: var(--accent-gradient);
    color: #fff;
    border-color: transparent;
}

.btn-anon:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-google {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.btn-google:hover {
    background: var(--bg-surface-3);
    transform: translateY(-2px);
}

.login-footer {
    color: var(--text-muted);
    font-size: 12px;
}

/* BG Orbs */
.login-bg-orbs {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.2;
}

.orb-1 {
    width: 350px;
    height: 350px;
    background: #7f5af0;
    top: -80px;
    left: -80px;
    animation: float 8s ease-in-out infinite;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: #2cb67d;
    bottom: -40px;
    right: -40px;
    animation: float 10s ease-in-out infinite reverse;
}

.orb-3 {
    width: 180px;
    height: 180px;
    background: #7f5af0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 12s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════
   MODALS (shared)
   ═══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 32px;
    max-width: 480px;
    width: 90%;
    position: relative;
    animation: fadeInUp 0.3s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

/* ─── Profile Setup ─── */
.profile-setup-card {
    text-align: center;
}

.profile-setup-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-setup-card h2 i {
    color: var(--accent);
}

.profile-setup-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.avatar-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.avatar-option {
    font-size: 28px;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-surface-2);
    text-align: center;
}

.avatar-option:hover {
    background: var(--bg-surface-3);
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--accent);
    background: var(--accent-glow);
    box-shadow: 0 0 20px var(--accent-glow);
}

.input-field {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 15px;
    outline: none;
    transition: all var(--transition);
    margin-bottom: 16px;
}

.input-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-field::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ═══════════════════════════════════════════════════════════
   APP CONTAINER — 3-part flex layout
   Header (fixed) + Chat body (scrollable) + Input (fixed)
   ═══════════════════════════════════════════════════════════ */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
    /* fallback for older browsers */
    width: 100%;
    background-color: var(--bg-deep);
    overflow: hidden;
    position: relative;
}

/* ──────────────────────────────────────
   TOP BAR — 60px, never shrinks
   ────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 60px;
    min-height: 60px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-accent);
    flex-shrink: 0;
    z-index: 10;
}

.top-bar-logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-bar-logo i {
    color: var(--accent);
    font-size: 22px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-user-display {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
}

.current-avatar {
    font-size: 18px;
}

.btn-icon {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 14px;
}

.btn-icon:hover {
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

/* ──────────────────────────────────────
   MAIN CONTENT — Desktop: 3-col grid
   ────────────────────────────────────── */
.main-content {
    display: grid;
    grid-template-columns: 20% 55% 25%;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ─── PANELS (shared) ─── */
.panel {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    overflow: hidden;
    background-color: var(--bg-deep);
}

.panel:last-child {
    border-right: none;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background-color: var(--bg-surface);
}

.panel-header h2 {
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-heading);
}

.badge {
    background: var(--accent-gradient);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    min-width: 24px;
    text-align: center;
}

.badge-sm {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    margin-left: 6px;
}

/* ═══════════════════════════════════════════════════════════
   LEFT SIDEBAR — USERS
   ═══════════════════════════════════════════════════════════ */
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.user-item:hover {
    background: var(--bg-surface-2);
}

.user-avatar {
    position: relative;
    font-size: 26px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.user-avatar .online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    background: var(--green);
    border: 2px solid var(--bg-deep);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--green-glow);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-info .user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.user-info .user-status-text {
    font-size: 12px;
    color: var(--green);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   CENTER — PUBLIC CHAT (Scrollable message area)
   ═══════════════════════════════════════════════════════════ */
.panel-chat {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-container {
    flex: 1;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    /* Xat-style purple/mauve gradient background */
    background: linear-gradient(160deg, #5c3d6e 0%, #7b5a8e 30%, #9a7a9e 60%, #a08090 100%);
}

.chat-welcome {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.6);
}

.chat-welcome i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
    color: rgba(255, 255, 255, 0.25);
    opacity: 1;
}

.chat-welcome p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

/* ─── XAT-STYLE EMOJI TOOLBAR ─── */
.emoji-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 5px 8px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.emoji-toolbar::-webkit-scrollbar {
    display: none;
}

.emoji-tb-btn {
    font-size: 22px;
    cursor: pointer;
    padding: 3px 4px;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    line-height: 1;
    user-select: none;
}

.emoji-tb-btn:hover {
    background: rgba(127, 90, 240, 0.2);
    transform: scale(1.2);
}

.emoji-tb-btn:active {
    transform: scale(0.95);
}

/* ─── RANK BADGES ─── */
.rank-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    line-height: 1.3;
    vertical-align: middle;
    white-space: nowrap;
}

.rank-caylak {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.rank-mudavim {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.rank-fenomen {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 0 8px rgba(234, 179, 8, 0.15);
}

/* Hide rank badge inside self messages for cleaner look */
.message-item.self .rank-badge {
    display: none;
}

/* ─── MESSAGE BUBBLES ─── */
.message-item {
    display: flex;
    gap: 10px;
    padding: 0;
    max-width: 85%;
    animation: fadeInUp 0.25s ease-out;
}

.message-item.blocked {
    opacity: 0.12;
    filter: blur(2px);
    pointer-events: none;
}

/* Other people's messages: left-aligned */
.message-item {
    align-self: flex-start;
}

.message-item .msg-bubble {
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
    padding: 8px 12px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Own messages: right-aligned, purple */
.message-item.self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-item.self .msg-bubble {
    background: rgba(127, 90, 240, 0.5);
    backdrop-filter: blur(4px);
    border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg);
    border: 1px solid rgba(127, 90, 240, 0.3);
}

.message-item.self .msg-username {
    display: inline;
    color: rgba(255, 255, 255, 0.75);
}

.message-item.self .msg-text {
    color: #fff;
}

.message-item.self .msg-time {
    color: rgba(255, 255, 255, 0.45);
}

.msg-avatar {
    font-size: 24px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 50%;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--transition);
    align-self: flex-end;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.msg-avatar:hover {
    transform: scale(1.1);
}

.msg-body {
    min-width: 0;
}

.msg-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.msg-username {
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: color var(--transition);
    color: var(--accent);
}

.msg-username:hover {
    color: var(--accent-hover);
}

.msg-time {
    font-size: 10px;
    color: var(--text-muted);
}

.msg-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
    word-wrap: break-word;
    line-height: 1.45;
}

/* ──────────────────────────────────────
   CHAT INPUT AREA — Xat-style bottom input
   ────────────────────────────────────── */
.chat-input-area {
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(135deg, #4a3558 0%, #6b4a6e 100%);
    border-top: 2px solid rgba(127, 90, 240, 0.3);
    flex-shrink: 0;
    position: relative;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    padding: 4px 6px 4px 14px;
    transition: all var(--transition);
}

.chat-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.input-message {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    padding: 10px 0;
    outline: none;
}

.input-message::placeholder {
    color: var(--text-muted);
}

.btn-emoji {
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 18px;
    width: 32px;
    height: 32px;
}

.btn-emoji:hover {
    color: var(--orange);
    background: none;
    border: none;
}

.btn-send {
    color: #fff;
    background: var(--accent-gradient);
    border: none;
    font-size: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.btn-send:hover {
    box-shadow: 0 0 16px var(--accent-glow);
    background: var(--accent-gradient);
    border: none;
}

/* ─── Emoji Picker ─── */
.emoji-picker {
    position: absolute;
    bottom: 65px;
    left: 12px;
    right: 12px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.2s ease-out;
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-btn {
    font-size: 22px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    text-align: center;
}

.emoji-btn:hover {
    background: var(--bg-surface-3);
    transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════════════
   RIGHT SIDEBAR — DMs
   ═══════════════════════════════════════════════════════════ */
.panel-dms {
    overflow-y: auto;
}

.dm-section {
    padding: 12px;
}

.dm-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.empty-state {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 16px 8px;
}

/* Friend Request Items */
.fr-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
    margin-bottom: 6px;
    animation: fadeInUp 0.3s ease-out;
}

.fr-item .fr-avatar {
    font-size: 22px;
}

.fr-item .fr-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.fr-item .fr-actions {
    display: flex;
    gap: 4px;
}

.fr-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    transition: all var(--transition);
}

.fr-btn-accept {
    background: var(--green);
    color: #fff;
}

.fr-btn-accept:hover {
    box-shadow: 0 0 10px var(--green-glow);
}

.fr-btn-decline {
    background: var(--red);
    color: #fff;
}

.fr-btn-decline:hover {
    opacity: 0.8;
}

/* Friend List Items */
.friend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
}

.friend-item:hover {
    background: var(--bg-surface-2);
}

.friend-item .friend-avatar {
    font-size: 24px;
}

.friend-item .friend-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.friend-item .friend-unread {
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.friends-list {
    overflow-y: auto;
    flex: 1;
}

.friend-requests-list {
    max-height: 200px;
    overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════
   PROFILE CARD MODAL
   ═══════════════════════════════════════════════════════════ */
.profile-card {
    text-align: center;
    max-width: 360px;
}

.profile-card-avatar {
    font-size: 64px;
    margin-bottom: 12px;
}

.profile-card-username {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-card-status {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.profile-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    width: 100%;
}

.btn-action:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-friend {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
}

.btn-friend:hover:not(:disabled) {
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-block {
    background: rgba(239, 68, 68, 0.1);
    color: var(--red);
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-block:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
}

.btn-dm {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.btn-dm:hover:not(:disabled) {
    background: var(--bg-surface-3);
}

/* ═══════════════════════════════════════════════════════════
   DM CHAT MODAL
   ═══════════════════════════════════════════════════════════ */
.dm-chat-card {
    max-width: 560px;
    height: 75vh;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.dm-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-surface);
}

.dm-chat-header .modal-close {
    position: static;
    flex-shrink: 0;
}

.dm-chat-avatar {
    font-size: 28px;
}

.dm-chat-header h3 {
    flex: 1;
    font-size: 16px;
    font-weight: 700;
}

.dm-messages {
    padding: 15px;
}

.dm-chat-card .chat-input-area {
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

/* DM message bubbles */
.dm-msg {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    border-radius: var(--radius-lg);
    max-width: 85%;
    animation: fadeInUp 0.2s ease-out;
    margin-bottom: 6px;
}

.dm-msg.sent {
    align-self: flex-end;
    background: var(--accent-gradient);
    color: #fff;
    border-radius: var(--radius-lg) 4px var(--radius-lg) var(--radius-lg);
}

.dm-msg.received {
    align-self: flex-start;
    background: var(--bg-surface-2);
    border-radius: 4px var(--radius-lg) var(--radius-lg) var(--radius-lg);
}

.dm-msg .dm-msg-text {
    font-size: 14px;
    word-wrap: break-word;
}

.dm-msg .dm-msg-time {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 4px;
    align-self: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   SETTINGS MODAL
   ═══════════════════════════════════════════════════════════ */
.settings-card {
    max-width: 440px;
}

.settings-card h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

.settings-card h2 i {
    color: var(--accent);
    margin-right: 4px;
}

.settings-section h3 {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.blocked-users-list {
    max-height: 300px;
    overflow-y: auto;
}

.blocked-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-surface-2);
    margin-bottom: 6px;
}

.blocked-item .blocked-avatar {
    font-size: 22px;
}

.blocked-item .blocked-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
}

.blocked-item .btn-unblock {
    padding: 5px 14px;
    background: var(--bg-surface-3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.blocked-item .btn-unblock:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease-out;
    min-width: 260px;
    max-width: 380px;
}

.toast.toast-info {
    border-left: 3px solid var(--accent);
}

.toast.toast-success {
    border-left: 3px solid var(--green);
}

.toast.toast-error {
    border-left: 3px solid var(--red);
}

.toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-info i {
    color: var(--accent);
}

.toast-success i {
    color: var(--green);
}

.toast-error i {
    color: var(--red);
}

.toast-text {
    font-size: 13px;
    font-weight: 500;
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: color var(--transition);
}

.toast-close:hover {
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════════════
   BOTTOM NAV (mobile only)
   ═══════════════════════════════════════════════════════════ */
.bottom-nav {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(15px, -15px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 40px var(--accent-glow);
    }
}

@keyframes badge-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
   Full-screen, no-scroll shell with tabbed panels
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .app-container {
        height: 100dvh;
    }

    .main-content {
        grid-template-columns: 1fr;
        position: relative;
    }

    .panel {
        position: absolute;
        inset: 0;
        display: none;
        border-right: none;
    }

    .panel.active {
        display: flex;
    }

    /* Panel header hides on mobile chat since top-bar covers it */
    .panel-chat .panel-header {
        display: none;
    }

    .bottom-nav {
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding: 6px 0;
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
        background-color: var(--bg-surface);
        border-top: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    .bottom-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: none;
        border: none;
        color: var(--text-muted);
        font-family: var(--font);
        font-size: 10px;
        font-weight: 600;
        padding: 6px 16px;
        cursor: pointer;
        transition: all var(--transition);
        position: relative;
        border-radius: var(--radius-sm);
    }

    .bottom-nav-btn i {
        font-size: 20px;
        margin-bottom: 1px;
    }

    .bottom-nav-btn.active {
        color: var(--accent);
    }

    .badge-dot {
        position: absolute;
        top: 4px;
        right: 10px;
        width: 8px;
        height: 8px;
        background: var(--red);
        border-radius: 50%;
        animation: badge-pulse 1.5s ease-in-out infinite;
    }

    /* Modal adjustments */
    .modal-card {
        margin: 12px;
        width: calc(100% - 24px);
        max-height: calc(100dvh - 24px);
    }

    .dm-chat-card {
        height: calc(100dvh - 24px);
        max-width: 100%;
    }

    .avatar-picker {
        grid-template-columns: repeat(4, 1fr);
    }

    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .top-bar {
        padding: 0 12px;
    }

    .current-user-display {
        display: none;
    }

    /* Toast on mobile */
    .toast-container {
        top: auto;
        bottom: 70px;
        right: 12px;
        left: 12px;
    }

    .toast {
        min-width: unset;
        max-width: 100%;
    }
}

/* Medium screens */
@media (max-width: 1024px) and (min-width: 769px) {
    .main-content {
        grid-template-columns: 18% 52% 30%;
    }
}

/* ═══════════════════════════════════════════════════════════
   TYPING INDICATOR
   ═══════════════════════════════════════════════════════════ */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(127, 90, 240, 0.08);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    animation: fadeIn 0.2s ease-out;
}

.typing-indicator i {
    color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════
   MESSAGE REACTIONS & ACTIONS
   ═══════════════════════════════════════════════════════════ */
.msg-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    gap: 6px;
}

.msg-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.reaction-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.reaction-chip:hover {
    background: rgba(127, 90, 240, 0.15);
    border-color: rgba(127, 90, 240, 0.3);
}

.reaction-chip.my-reaction {
    background: rgba(127, 90, 240, 0.2);
    border-color: rgba(127, 90, 240, 0.4);
}

.msg-quick-actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.message-item:hover .msg-quick-actions {
    opacity: 1;
}

.msg-action-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 5px;
    border-radius: 4px;
    transition: all 0.15s ease;
    opacity: 0.6;
    color: var(--text-secondary);
}

.msg-action-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

.msg-delete-btn:hover {
    color: var(--red) !important;
}

/* ═══════════════════════════════════════════════════════════
   ENHANCED PROFILE CARD INFO
   ═══════════════════════════════════════════════════════════ */
.profile-card-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.profile-info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.profile-info-item i {
    width: 18px;
    text-align: center;
    color: var(--accent);
    font-size: 13px;
    flex-shrink: 0;
}

.profile-info-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ═══════════════════════════════════════════════════════════
   BIO INPUT (Profile Setup)
   ═══════════════════════════════════════════════════════════ */
.input-bio {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-input-dark);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 14px;
    outline: none;
    transition: all var(--transition);
    margin-bottom: 12px;
    margin-top: 6px;
}

.input-bio:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-bio::placeholder {
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════
   STATUS DROPDOWN
   ═══════════════════════════════════════════════════════════ */
.status-dropdown {
    position: relative;
}

.btn-status {
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 0;
    min-width: 160px;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.15s ease-out;
}

.status-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.12s ease;
}

.status-option:hover {
    background: rgba(127, 90, 240, 0.1);
    color: var(--text-primary);
}

.status-option.active {
    color: var(--accent);
    font-weight: 600;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dot.status-online,
.online-dot.status-online {
    background-color: var(--green);
    box-shadow: 0 0 6px var(--green);
}

.status-dot.status-busy,
.online-dot.status-busy {
    background-color: var(--red);
    box-shadow: 0 0 6px var(--red);
}

.status-dot.status-away,
.online-dot.status-away {
    background-color: #f59e0b;
    box-shadow: 0 0 6px #f59e0b;
}

.status-dot.status-invisible,
.online-dot.status-invisible {
    background-color: #666;
    box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════
   DM READ RECEIPTS
   ═══════════════════════════════════════════════════════════ */
.dm-read {
    color: #60a5fa;
    font-size: 10px;
    margin-left: 3px;
}

.dm-unread {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 3px;
}

/* ═══════════════════════════════════════════════════════════
   BADGE COUNT (online count in header)
   ═══════════════════════════════════════════════════════════ */
.badge-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border-radius: var(--radius-full);
    margin-left: 6px;
}