/* Theme Variables - Default: Original (neutral gray/blue) */
:root {
    --bg-body: #f5f5f5;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: #f5f5f5;
    --bg-active: #e8f4f8;
    --chat-bg: url('../images/chat-wallpaper-light.svg');

    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;

    --border-main: #e0e0e0;
    --border-light: #f0f0f0;
    --border-dark: #333;

    --message-bubble: #9dd0e1;
    --accent-blue: #007bff;
    --accent-blue-hover: #0056b3;
    --accent-green: #4CAF50;
    --accent-red: #dc3545;

    --shadow: rgba(0, 0, 0, 0.1);
    --overlay: rgba(0, 0, 0, 0.5);

    --gift-popup-background: white;
}

[data-theme="dark"] {
    --bg-body: #1a1a1a;
    --bg-container: #2a2a2a;
    --bg-container-solid: #2a2a2a;
    --bg-input: #333;
    --bg-hover: #3a3a3a;
    --bg-active: #3a4a50;
    --chat-bg: url('../images/chat-wallpaper-dark.svg');

    --text-primary: #f0f0f0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;

    --border-main: #444;
    --border-light: #3a3a3a;
    --border-dark: #666;

    --message-bubble: #63b4cf;
    --accent-blue: #4a9eff;
    --accent-blue-hover: #6ab0ff;
    --accent-green: #5dbb63;
    --accent-red: #ff6b7a;

    --shadow: rgba(0, 0, 0, 0.3);
    --overlay: rgba(0, 0, 0, 0.7);

    --gift-popup-background: #2a2a2a;
}

/* ===========================================
   COLOR PALETTE SWITCHER
   Palette 0: Original (default above)
   Palette 1: Steel Blue & Purple
   Palette 2: Sunset Warmth
   Palette 3: Natural Green & Violet
   Palette 4: Barbie Pink
   Palette 5: Soft Greens & Lavender
   Palette 6: Jewel Tones
   Palette 7: Sunset Gradient
   =========================================== */

/* Palette 0: Original - uses default :root values */

/* Palette 1: Steel Blue & Purple */
[data-palette="1"] {
    --bg-body: #f0f4f7;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(124, 158, 178, 0.1);
    --bg-active: rgba(82, 82, 140, 0.12);
    --text-primary: #231123;
    --text-secondary: #372554;
    --text-muted: #52528c;
    --border-main: rgba(124, 158, 178, 0.3);
    --border-light: rgba(124, 158, 178, 0.15);
    --border-dark: #52528c;
    --message-bubble: #7c9eb2;
    --accent-blue: #52528c;
    --accent-blue-hover: #372554;
    --accent-green: #4CAF50;
    --accent-red: #dc3545;
    --shadow: rgba(35, 17, 35, 0.12);
    --overlay: rgba(35, 17, 35, 0.6);
    --gift-popup-background: white;
}

[data-palette="1"][data-theme="dark"] {
    --bg-body: #231123;
    --bg-container: rgba(55, 37, 84, 0.5);
    --bg-container-solid: rgb(55, 37, 84);
    --bg-input: rgba(82, 82, 140, 0.3);
    --bg-hover: rgba(82, 82, 140, 0.4);
    --bg-active: rgba(124, 158, 178, 0.2);
    --text-primary: #f0f4f7;
    --text-secondary: #7c9eb2;
    --text-muted: #52528c;
    --border-main: rgba(82, 82, 140, 0.5);
    --border-light: rgba(55, 37, 84, 0.5);
    --border-dark: #7c9eb2;
    --message-bubble: #52528c;
    --accent-blue: #7c9eb2;
    --accent-blue-hover: #52528c;
    --accent-green: #5dbb63;
    --accent-red: #ff6b7a;
    --shadow: rgba(0, 0, 0, 0.4);
    --overlay: rgba(35, 17, 35, 0.85);
    --gift-popup-background: rgba(55, 37, 84, 0.95);
}

/* Palette 2: Sunset Warmth */
[data-palette="2"] {
    --bg-body: #fefdf5;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(237, 211, 130, 0.2);
    --bg-active: rgba(252, 158, 79, 0.15);
    --text-primary: #020122;
    --text-secondary: #f4442e;
    --text-muted: #fc9e4f;
    --border-main: rgba(237, 211, 130, 0.4);
    --border-light: rgba(242, 243, 174, 0.5);
    --border-dark: #f4442e;
    --message-bubble: #fc9e4f;
    --accent-blue: #f4442e;
    --accent-blue-hover: #d63a27;
    --accent-green: #4CAF50;
    --accent-red: #f4442e;
    --shadow: rgba(2, 1, 34, 0.12);
    --overlay: rgba(2, 1, 34, 0.6);
    --gift-popup-background: white;
}

[data-palette="2"][data-theme="dark"] {
    --bg-body: #020122;
    --bg-container: rgba(244, 68, 46, 0.15);
    --bg-container-solid: rgb(244, 68, 46);
    --bg-input: rgba(252, 158, 79, 0.15);
    --bg-hover: rgba(252, 158, 79, 0.25);
    --bg-active: rgba(244, 68, 46, 0.2);
    --text-primary: #f2f3ae;
    --text-secondary: #fc9e4f;
    --text-muted: #edd382;
    --border-main: rgba(252, 158, 79, 0.4);
    --border-light: rgba(244, 68, 46, 0.3);
    --border-dark: #fc9e4f;
    --message-bubble: #f4442e;
    --accent-blue: #fc9e4f;
    --accent-blue-hover: #f4442e;
    --accent-green: #5dbb63;
    --accent-red: #f4442e;
    --shadow: rgba(0, 0, 0, 0.5);
    --overlay: rgba(2, 1, 34, 0.85);
    --gift-popup-background: rgba(244, 68, 46, 0.9);
}

/* Palette 3: Natural Green & Violet */
[data-palette="3"] {
    --bg-body: #f5fcf4;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(182, 204, 161, 0.2);
    --bg-active: rgba(182, 143, 64, 0.15);
    --text-primary: #30011e;
    --text-secondary: #545454;
    --text-muted: #b68f40;
    --border-main: rgba(182, 204, 161, 0.4);
    --border-light: rgba(215, 252, 212, 0.5);
    --border-dark: #545454;
    --message-bubble: #b6cca1;
    --accent-blue: #b68f40;
    --accent-blue-hover: #9a7a36;
    --accent-green: #4CAF50;
    --accent-red: #dc3545;
    --shadow: rgba(48, 1, 30, 0.12);
    --overlay: rgba(48, 1, 30, 0.6);
    --gift-popup-background: white;
}

[data-palette="3"][data-theme="dark"] {
    --bg-body: #30011e;
    --bg-container: rgba(84, 84, 84, 0.3);
    --bg-container-solid: rgb(84, 84, 84);
    --bg-input: rgba(182, 143, 64, 0.2);
    --bg-hover: rgba(182, 204, 161, 0.15);
    --bg-active: rgba(182, 143, 64, 0.25);
    --text-primary: #d7fcd4;
    --text-secondary: #b6cca1;
    --text-muted: #b68f40;
    --border-main: rgba(182, 204, 161, 0.3);
    --border-light: rgba(84, 84, 84, 0.4);
    --border-dark: #b6cca1;
    --message-bubble: #b68f40;
    --accent-blue: #b6cca1;
    --accent-blue-hover: #b68f40;
    --accent-green: #5dbb63;
    --accent-red: #ff6b7a;
    --shadow: rgba(0, 0, 0, 0.5);
    --overlay: rgba(48, 1, 30, 0.85);
    --gift-popup-background: rgba(84, 84, 84, 0.95);
}

/* Palette 4: Barbie Pink */
[data-palette="4"] {
    --bg-body: #fff5fa;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(250, 25, 139, 0.08);
    --bg-active: rgba(185, 19, 114, 0.12);
    --text-primary: #0e0004;
    --text-secondary: #b91372;
    --text-muted: #6b0f1a;
    --border-main: rgba(250, 25, 139, 0.25);
    --border-light: rgba(250, 25, 139, 0.1);
    --border-dark: #b91372;
    --message-bubble: #fa198b;
    --accent-blue: #b91372;
    --accent-blue-hover: #31081f;
    --accent-green: #4CAF50;
    --accent-red: #6b0f1a;
    --shadow: rgba(14, 0, 4, 0.12);
    --overlay: rgba(14, 0, 4, 0.6);
    --gift-popup-background: white;
}

[data-palette="4"][data-theme="dark"] {
    --bg-body: #0e0004;
    --bg-container: rgba(49, 8, 31, 0.8);
    --bg-container-solid: rgb(49, 8, 31);
    --bg-input: rgba(107, 15, 26, 0.4);
    --bg-hover: rgba(185, 19, 114, 0.3);
    --bg-active: rgba(250, 25, 139, 0.2);
    --text-primary: #ffcce6;
    --text-secondary: #fa198b;
    --text-muted: #b91372;
    --border-main: rgba(185, 19, 114, 0.5);
    --border-light: rgba(107, 15, 26, 0.5);
    --border-dark: #fa198b;
    --message-bubble: #b91372;
    --accent-blue: #fa198b;
    --accent-blue-hover: #b91372;
    --accent-green: #5dbb63;
    --accent-red: #fa198b;
    --shadow: rgba(0, 0, 0, 0.6);
    --overlay: rgba(14, 0, 4, 0.85);
    --gift-popup-background: rgba(49, 8, 31, 0.95);
}

/* Palette 5: Soft Greens & Lavender */
[data-palette="5"] {
    --bg-body: #f5faf0;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(186, 210, 159, 0.2);
    --bg-active: rgba(128, 138, 159, 0.15);
    --text-primary: #3d2b56;
    --text-secondary: #2c497f;
    --text-muted: #808a9f;
    --border-main: rgba(186, 210, 159, 0.4);
    --border-light: rgba(204, 245, 172, 0.4);
    --border-dark: #2c497f;
    --message-bubble: #bad29f;
    --accent-blue: #2c497f;
    --accent-blue-hover: #3d2b56;
    --accent-green: #4CAF50;
    --accent-red: #dc3545;
    --shadow: rgba(61, 43, 86, 0.12);
    --overlay: rgba(61, 43, 86, 0.6);
    --gift-popup-background: white;
}

[data-palette="5"][data-theme="dark"] {
    --bg-body: #3d2b56;
    --bg-container: rgba(44, 73, 127, 0.4);
    --bg-container-solid: rgb(44, 73, 127);
    --bg-input: rgba(128, 138, 159, 0.3);
    --bg-hover: rgba(186, 210, 159, 0.2);
    --bg-active: rgba(204, 245, 172, 0.15);
    --text-primary: #ccf5ac;
    --text-secondary: #bad29f;
    --text-muted: #808a9f;
    --border-main: rgba(128, 138, 159, 0.5);
    --border-light: rgba(44, 73, 127, 0.5);
    --border-dark: #bad29f;
    --message-bubble: #2c497f;
    --accent-blue: #bad29f;
    --accent-blue-hover: #2c497f;
    --accent-green: #5dbb63;
    --accent-red: #ff6b7a;
    --shadow: rgba(0, 0, 0, 0.5);
    --overlay: rgba(61, 43, 86, 0.85);
    --gift-popup-background: rgba(44, 73, 127, 0.95);
}

/* Palette 6: Jewel Tones */
[data-palette="6"] {
    --bg-body: #f8f9f5;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(95, 173, 65, 0.1);
    --bg-active: rgba(45, 147, 108, 0.12);
    --text-primary: #3a0842;
    --text-secondary: #391463;
    --text-muted: #2d936c;
    --border-main: rgba(95, 173, 65, 0.3);
    --border-light: rgba(191, 174, 72, 0.25);
    --border-dark: #391463;
    --message-bubble: #5fad41;
    --accent-blue: #2d936c;
    --accent-blue-hover: #391463;
    --accent-green: #5fad41;
    --accent-red: #dc3545;
    --shadow: rgba(58, 8, 66, 0.12);
    --overlay: rgba(58, 8, 66, 0.6);
    --gift-popup-background: white;
}

[data-palette="6"][data-theme="dark"] {
    --bg-body: #3a0842;
    --bg-container: rgba(57, 20, 99, 0.6);
    --bg-container-solid: rgb(57, 20, 99);
    --bg-input: rgba(45, 147, 108, 0.25);
    --bg-hover: rgba(95, 173, 65, 0.2);
    --bg-active: rgba(191, 174, 72, 0.2);
    --text-primary: #e8f5e0;
    --text-secondary: #bfae48;
    --text-muted: #5fad41;
    --border-main: rgba(45, 147, 108, 0.5);
    --border-light: rgba(57, 20, 99, 0.5);
    --border-dark: #bfae48;
    --message-bubble: #2d936c;
    --accent-blue: #5fad41;
    --accent-blue-hover: #2d936c;
    --accent-green: #5fad41;
    --accent-red: #ff6b7a;
    --shadow: rgba(0, 0, 0, 0.5);
    --overlay: rgba(58, 8, 66, 0.85);
    --gift-popup-background: rgba(57, 20, 99, 0.95);
}

/* Palette 7: Sunset Gradient */
[data-palette="7"] {
    --bg-body: #fef9f4;
    --bg-container: white;
    --bg-container-solid: white;
    --bg-input: white;
    --bg-hover: rgba(249, 86, 79, 0.08);
    --bg-active: rgba(179, 63, 98, 0.12);
    --text-primary: #0c0a3e;
    --text-secondary: #7b1e7a;
    --text-muted: #b33f62;
    --border-main: rgba(249, 86, 79, 0.2);
    --border-light: rgba(243, 198, 119, 0.3);
    --border-dark: #7b1e7a;
    --message-bubble: #f9564f;
    --accent-blue: #b33f62;
    --accent-blue-hover: #7b1e7a;
    --accent-green: #4CAF50;
    --accent-red: #f9564f;
    --shadow: rgba(12, 10, 62, 0.12);
    --overlay: rgba(12, 10, 62, 0.6);
    --gift-popup-background: white;
}

[data-palette="7"][data-theme="dark"] {
    --bg-body: #0c0a3e;
    --bg-container: rgba(123, 30, 122, 0.3);
    --bg-container-solid: rgb(123, 30, 122);
    --bg-input: rgba(179, 63, 98, 0.2);
    --bg-hover: rgba(179, 63, 98, 0.25);
    --bg-active: rgba(249, 86, 79, 0.15);
    --text-primary: #f3c677;
    --text-secondary: #f9564f;
    --text-muted: #b33f62;
    --border-main: rgba(179, 63, 98, 0.4);
    --border-light: rgba(123, 30, 122, 0.4);
    --border-dark: #f9564f;
    --message-bubble: #f9564f;
    --accent-blue: #f9564f;
    --accent-blue-hover: #b33f62;
    --accent-green: #5dbb63;
    --accent-red: #f9564f;
    --shadow: rgba(0, 0, 0, 0.6);
    --overlay: rgba(12, 10, 62, 0.85);
    --gift-popup-background: rgba(123, 30, 122, 0.95);
}

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

button {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: 65px;
    --navbar-h: 65px;
}

.top-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-container-solid);
    padding: 15px 40px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    max-width: 100%;
    justify-content: space-between;
}

.navbar-logo {
    font-weight: 600;
    font-size: 18px;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-logo:hover {
    text-decoration: none;
}

.navbar-match {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.navbar-avatar-icon {
    font-size: 14px;
    color: var(--text-muted);
}

.container {
    max-width: 400px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.menu-icon {
    width: 24px;
    height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    cursor: pointer;
}

.menu-icon span {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    line-height: 1;
}

.theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* Navbar Message Icon */
.navbar-message-icon {
    position: relative;
    text-decoration: none;
    font-size: 20px;
    padding: 5px;
}

.navbar-unread-badge {
    position: absolute;
    top: -2px;
    right: -5px;
    background: var(--accent-red);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Sidebar Menu */
.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100dvh;
    background: var(--bg-container);
    box-shadow: 2px 0 10px var(--shadow);
    transition: left 0.3s ease-out;
    z-index: 2000;
    overflow-y: auto;
}

.sidebar.open {
    left: 0;
}

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

.sidebar-header h2 {
    font-size: 24px;
    color: var(--text-primary);
}

.wallet-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 215, 0, 0.25);
    border-radius: 20px;
    border: 2px solid rgba(255, 180, 0, 0.5);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

.wallet-badge::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 40%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 60%
    );
    animation: walletShine 2.5s ease-in-out infinite;
}

@keyframes walletShine {
    0% {
        transform: translateX(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) rotate(45deg);
    }
}

.wallet-coin-img {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
}

.wallet-balance {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
    position: relative;
    z-index: 1;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.sidebar-nav {
    padding: 5px 0;
}

.sidebar-nav a {
    display: block;
    padding: 15px 20px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
}

.sidebar-nav a:hover {
    background: var(--bg-hover);
}

.sidebar-icon {
    display: inline-block;
    width: 24px;
    text-align: center;
    margin-right: 12px;
}

.sidebar-theme-toggle {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.sidebar-theme-toggle:hover {
    background: var(--bg-hover);
}

.sidebar-theme-toggle .theme-label {
    flex: 1;
}

.theme-switch {
    width: 44px;
    height: 24px;
    background: var(--border-main);
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
}

.theme-switch-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.sidebar-theme-toggle.active .theme-switch {
    background: var(--accent-green);
}

.sidebar-theme-toggle.active .theme-switch-slider {
    transform: translateX(20px);
}

/* Palette Switcher */
.sidebar-palette-switcher {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.sidebar-palette-switcher:hover {
    background: var(--bg-hover);
}

.sidebar-palette-switcher .palette-label {
    flex: 1;
}

.palette-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-input);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.palette-indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--message-bubble);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1500;
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-main);
    margin: 10px 0;
}

/* Sidebar Match Item */
.sidebar-match-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s;
}

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

.sidebar-match-item.active {
    background: var(--bg-active);
}

.sidebar-match-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

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

.sidebar-match-avatar-icon {
    font-size: 18px;
    color: var(--text-muted);
}

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

.sidebar-match-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.sidebar-match-preview {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-preview-blurred {
    filter: blur(4px);
    user-select: none;
}

.typing-preview {
    font-style: italic;
    color: var(--text-muted);
}

.sidebar-unmatch-form {
    padding: 10px 20px;
}

.sidebar-unmatch-btn {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--accent-red);
    border-radius: 8px;
    background: var(--bg-container);
    color: var(--accent-red);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-unmatch-btn:hover {
    background: var(--accent-red);
    color: white;
}

.sidebar-unmatch-btn--active {
    background: var(--accent-red);
    color: white;
}

.sidebar-unmatch-btn--active:hover {
    background: #c82333;
}

/* Messages */
.messages {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1100;
    max-width: 400px;
}

.message {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    animation: slideIn 0.3s ease-out;
    cursor: pointer;
}

.message.hiding {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.message.error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.message.success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

.message.info {
    background: #eef;
    color: #33c;
    border: 1px solid #ccf;
}

[data-theme="dark"] .message.error {
    background: #4a2020;
    color: #ff8888;
    border: 1px solid #663333;
}

[data-theme="dark"] .message.success {
    background: #204a20;
    color: #88ff88;
    border: 1px solid #336633;
}

[data-theme="dark"] .message.info {
    background: #20204a;
    color: #8888ff;
    border: 1px solid #333366;
}

@media (max-width: 576px) {
    .top-navbar {
        padding: 10px 14px;
        gap: 8px;
    }
    body {
        padding-top: 53px;
        --navbar-h: 53px;
    }
    .navbar-logo {
        font-size: 15px;
    }
    .navbar-right {
        gap: 8px;
    }
}

/* ===== Slim top bar: search + icon buttons (Phase 01) ===== */
.navbar-logo {
    flex-shrink: 0;
    white-space: nowrap;
}

.navbar-search {
    flex: 1 1 auto;
    max-width: 520px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    padding: 8px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    border-radius: 999px;
}

.navbar-search:focus-within {
    border-color: var(--message-bubble);
}

.navbar-search-icon {
    font-size: 14px;
    line-height: 1;
    opacity: 0.6;
    flex-shrink: 0;
}

.navbar-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

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

.navbar-search input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

.navbar-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    padding: 5px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    text-decoration: none;
}

.navbar-icon-btn:hover {
    opacity: 0.8;
}

@media (max-width: 400px) {
    .navbar-search {
        padding: 7px 10px;
    }
    .navbar-search-icon {
        display: none;
    }
}

/* Signup Modal (global auth gate — moved from messenger.css in Phase 01) */
.signup-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 20px 0;
}

.signup-modal.show {
    display: flex;
}

.signup-modal-content {
    background: var(--bg-container-solid);
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 380px;
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    position: relative;
    margin: auto;
    animation: modalSlideIn 0.3s ease;
}

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

.signup-modal .modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.signup-modal .modal-close:hover {
    color: var(--text-primary);
}

.signup-modal h3 {
    margin: 0 0 8px 0;
    color: var(--text-primary);
    font-size: 22px;
    text-align: center;
}

.signup-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    margin: 0 0 20px 0;
}

.signup-modal .form-group {
    margin-bottom: 16px;
}

.signup-modal .form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.signup-modal .form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-main);
    border-radius: 8px;
    font-size: 15px;
    background: var(--bg-input);
    color: var(--text-primary);
    box-sizing: border-box;
}

.signup-modal .form-group input:focus {
    outline: none;
    border-color: var(--message-bubble);
}

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

.signup-modal .field-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 4px;
    min-height: 16px;
}

.signup-errors {
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    color: #e74c3c;
    font-size: 13px;
}

.signup-submit-btn {
    width: 100%;
    padding: 14px;
    background: var(--message-bubble);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 8px;
}

.signup-submit-btn:hover {
    opacity: 0.9;
}

.signup-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.signup-modal .social-login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-secondary);
}

.signup-modal .social-login-divider::before,
.signup-modal .social-login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-main);
}

.signup-modal .social-login-divider span {
    padding: 0 12px;
    font-size: 13px;
}

.signup-modal .social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.signup-modal .btn-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.signup-modal .btn-google {
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    color: var(--text-primary);
}

.signup-modal .btn-google:hover {
    background: var(--bg-container);
    border-color: var(--border-dark);
}

.signup-modal .btn-apple {
    background: #000;
    border: 1px solid #000;
    color: #fff;
}

.signup-modal .btn-apple:hover {
    background: #333;
}

[data-theme="dark"] .signup-modal .btn-apple {
    background: #fff;
    color: #000;
    border-color: #fff;
}

[data-theme="dark"] .signup-modal .btn-apple:hover {
    background: #e0e0e0;
}

.signup-modal .social-icon {
    flex-shrink: 0;
}

.signup-login-link {
    text-align: center;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.signup-login-link a {
    color: var(--message-bubble);
    text-decoration: none;
    font-weight: 500;
}

.signup-login-link a:hover {
    text-decoration: underline;
}

/* ===== Top bar v3 — editorial masthead, fused with the gallery (Phase 02) ===== */
.top-navbar {
    padding: 12px clamp(16px, 4vw, 40px);
    gap: clamp(10px, 2vw, 22px);
    background: var(--bg-body);          /* same surface as the gallery -> one piece */
    border-bottom: none;
    transition: box-shadow 0.3s ease;
}
.top-navbar.scrolled { box-shadow: 0 8px 26px -18px rgba(0, 0, 0, 0.55); }

/* Masthead wordmark: accent italic 'y' + a sweeping underline on hover */
.navbar-logo {
    position: relative;
    flex-shrink: 0;
    white-space: nowrap;
    font-family: 'Bodoni Moda', Georgia, 'Times New Roman', serif;
    font-size: clamp(23px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--text-primary);
    text-decoration: none;
}
.navbar-logo-accent { color: var(--message-bubble); font-style: italic; }
.navbar-logo::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -5px;
    width: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--message-bubble);
    transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.navbar-logo:hover::after { width: 100%; }

/* Search pill */
.navbar-search {
    flex: 1 1 auto;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto;
    padding: 9px 18px;
    background: var(--bg-container-solid);
    border: 1px solid var(--border-main);
    border-radius: 999px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.navbar-search:focus-within {
    border-color: var(--message-bubble);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--message-bubble) 16%, transparent);
}
.navbar-search-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.navbar-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}
.navbar-search input::placeholder { color: var(--text-muted); }
.navbar-search input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

.navbar-right {
    display: flex;
    align-items: center;
    gap: clamp(2px, 0.8vw, 8px);
    flex-shrink: 0;
}
.navbar-right .navbar-search-toggle { display: none; }   /* desktop: inline search is always shown */

.navbar-icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}
.navbar-icon-btn:hover { background: var(--bg-input); color: var(--text-primary); }
.navbar-icon-btn svg { width: 22px; height: 22px; }

/* tactile micro-interactions */
.navbar-bell svg { transform-origin: 50% 5px; }
.navbar-bell:hover svg { animation: bellSwing 0.6s ease; }
.navbar-fap svg { transition: transform 0.2s ease; }
.navbar-fap:hover svg { transform: translateY(-2px); }

.navbar-unread-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-red);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    border-radius: 999px;
    border: 2px solid var(--bg-body);
}

/* avatar — decorative only for now (no pointer, no action) */
.navbar-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin: 0 2px;
    padding: 0;
    border: 1px solid var(--border-main);
    border-radius: 50%;
    background: var(--bg-input);
    color: var(--text-muted);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}
.navbar-avatar-btn:hover { transform: translateY(-1px); opacity: 0.92; }
.navbar-avatar-btn svg { width: 20px; height: 20px; }
.navbar-avatar-btn--user { background: var(--message-bubble); border-color: transparent; }
.navbar-avatar-btn--user:hover { box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--message-bubble) 90%, transparent); opacity: 1; }
.navbar-avatar-initial { font-weight: 600; font-size: 15px; color: #fff; }

/* hamburger — sidebar toggle */
.navbar-menu-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 9px;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    transition: background 0.2s ease;
}
.navbar-menu-btn:hover { background: var(--bg-input); }
.navbar-menu-btn span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: var(--text-secondary);
    transition: background 0.2s ease;
}
.navbar-menu-btn:hover span { background: var(--text-primary); }

/* Phones (down to iPhone SE): one row, search collapses to a drop-down */
@media (max-width: 600px) {
    body { padding-top: 60px; --navbar-h: 60px; }
    .top-navbar { padding: 10px clamp(12px, 4vw, 18px); gap: 10px; }
    .navbar-logo { font-size: 22px; }
    .navbar-icon-btn,
    .navbar-menu-btn { width: 40px; height: 40px; }   /* comfortable tap targets */

    /* keep only the essentials on phones — hide the inert avatar + (for now) fap */
    .navbar-fap,
    .navbar-avatar-btn { display: none; }

    /* tap the search icon to drop a full-width field below the bar */
    .navbar-right .navbar-search-toggle { display: inline-flex; }
    .navbar-search-toggle[aria-expanded="true"] {
        background: var(--bg-input);
        color: var(--text-primary);
    }
    .navbar-search {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        left: clamp(10px, 4vw, 18px);
        right: clamp(10px, 4vw, 18px);
        max-width: none;
        margin: 0;
        z-index: 1200;
        box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.5);
        animation: searchDrop 0.22s ease;
    }
    .top-navbar.search-open .navbar-search { display: flex; }
}

@keyframes searchDrop {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: none; }
}

@keyframes bellSwing {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(12deg); }
    40% { transform: rotate(-9deg); }
    60% { transform: rotate(6deg); }
    80% { transform: rotate(-3deg); }
}

/* ===== Sidebar v2 — masthead + SVG icons, matched to the navbar (Phase 02) ===== */
.sidebar {
    width: 312px;
    left: -312px;
    background: var(--bg-container-solid);
    border-right: 1px solid var(--border-main);
    box-shadow: 14px 0 44px -22px rgba(0, 0, 0, 0.55);
}

.sidebar-header { padding: 16px 18px; }
.sidebar-brand {
    font-family: 'Bodoni Moda', Georgia, 'Times New Roman', serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1;
    color: var(--text-primary);
    text-decoration: none;
}

.close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    color: var(--text-secondary);
    transition: background 0.2s ease, color 0.2s ease;
}
.close-btn svg { width: 20px; height: 20px; }
.close-btn:hover { background: var(--bg-input); color: var(--text-primary); }

.sidebar-wallet { display: inline-flex; margin: 12px 16px 6px; }

.sidebar-nav { padding: 8px 8px 24px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 11px 14px;
    margin: 1px 4px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.sidebar-nav a:hover {
    background: var(--bg-input);
    transform: translateX(2px);
}

.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-right: 14px;
    text-align: initial;
    color: var(--text-muted);
    transition: color 0.18s ease;
}
.sidebar-icon svg { width: 20px; height: 20px; }
.sidebar-nav a:hover .sidebar-icon { color: var(--message-bubble); }

.sidebar-link-accent,
.sidebar-link-accent .sidebar-icon { color: var(--message-bubble); }
.sidebar-link-muted,
.sidebar-link-muted .sidebar-icon { color: var(--text-muted); }

.sidebar-divider {
    height: 1px;
    background: var(--border-main);
    margin: 10px 18px;
}

.sidebar-theme-toggle,
.sidebar-palette-switcher {
    margin: 1px 4px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 15px;
}
.sidebar-theme-toggle:hover,
.sidebar-palette-switcher:hover { background: var(--bg-input); }
.sidebar-theme-toggle .sidebar-icon,
.sidebar-palette-switcher .sidebar-icon { color: var(--text-muted); }
/* ============================================================================
   Global media lightbox (templates/includes/lightbox.html) — ONE shared,
   reusable component for every page. Styled to look & behave exactly like the
   chat gallery lightbox (.gallery-lightbox in messenger.css); values mirrored
   here so the chat component stays untouched. Use it from new code via
   window.AppLightbox.open(items, startIndex).
   ========================================================================== */
.app-lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}
.app-lightbox.show { display: flex; }

.app-lightbox-media {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.app-lightbox-media img {
    max-width: 100%;
    max-height: 100vh;
    object-fit: contain;
}
.app-lightbox-media video {
    max-width: 100%;
    height: 100vh;
}

.app-lightbox-close {
    position: absolute;
    top: 20px; right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 32px;
    line-height: 1;
    width: 50px; height: 50px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}
.app-lightbox-close:hover { background: rgba(255, 255, 255, 0.2); }

.app-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 48px;
    line-height: 1;
    width: 60px; height: 80px;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    -webkit-tap-highlight-color: transparent;
    outline: none;
}
.app-lightbox-nav:hover { background: rgba(255, 255, 255, 0.2); }
.app-lightbox-prev { left: 20px; }
.app-lightbox-next { right: 20px; }

.app-lightbox-counter {
    position: absolute;
    top: 20px; left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10;
}

@media (max-width: 768px) {
    .app-lightbox-nav { width: 40px; height: 60px; font-size: 32px; }
    .app-lightbox-prev { left: 10px; }
    .app-lightbox-next { right: 10px; }
}
