:root {
    --bg-page: #FDF6F8;
    --surface: #FFFFFF;
    --text: #1F2229;
    --text-muted: #6B7280;
    --primary: #FF4F7E;
    --primary-hover: #E8386A;
    --primary-soft: #FFE6ED;
    --border: #ECE6E9;
    --danger: #D64545;
    --radius-lg: 22px;
    --radius-md: 12px;
    --font-display: 'Quicksand', sans-serif;
    --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
    --bg-page: #15121A;
    --surface: #201C26;
    --text: #F5F1F7;
    --text-muted: #A79CB0;
    --primary: #FF6B93;
    --primary-hover: #FF85A6;
    --primary-soft: #3A2430;
    --border: #322C3B;
    --danger: #FF8080;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg-page);
    color: var(--text);
    font-family: var(--font-body);
    transition: background 0.2s ease, color 0.2s ease;
}

/* ===================== Auth pages (Login / Register) ===================== */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.06);
}

[data-theme="dark"] .auth-card {
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.theme-toggle,
.theme-toggle-static {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-page);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle {
    position: absolute;
    top: 18px;
    right: 18px;
}

    .theme-toggle svg,
    .theme-toggle-static svg {
        width: 16px;
        height: 16px;
        color: var(--text);
    }

.brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

    .brand-mark svg {
        width: 30px;
        height: 30px;
    }

.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    text-align: center;
    margin: 0;
}

.brand-tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin: 4px 0 16px;
}

.form-group {
    margin-bottom: 10px;
}

    .form-group label {
        display: block;
        font-size: 0.78rem;
        font-weight: 600;
        margin-bottom: 4px;
        color: var(--text-muted);
    }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-page);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

[data-theme="dark"] .form-control {
    background: #17141C;
}

.form-control[readonly] {
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-control-select {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-page);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-body);
}

[data-theme="dark"] .form-control-select {
    background: #17141C;
}

textarea.form-control {
    resize: vertical;
    min-height: 70px;
}

.form-control:focus,
.form-control-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-error {
    color: var(--danger);
    font-size: 0.75rem;
    margin-top: 3px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s ease;
    text-align: center;
}

    .btn-primary:hover {
        background: var(--primary-hover);
    }

.btn-outline-danger {
    width: 100%;
    padding: 12px;
    border-radius: 999px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
}

.auth-footer {
    text-align: center;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

    .auth-footer a {
        color: var(--primary);
        text-decoration: none;
        font-weight: 600;
    }

@media (max-height: 700px) {
    .brand-tagline {
        display: none;
    }

    .auth-card {
        padding: 40px 24px 20px;
    }

    .form-group {
        margin-bottom: 8px;
    }
}

/* ===================== Avatar / profile photo ===================== */

.avatar-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.6rem;
    margin: 0 auto 12px;
}

.avatar-wrapper {
    position: relative;
    display: inline-block;
    isolation: isolate;
    width: 76px;
    margin: 0 auto 12px;
}

    .avatar-wrapper img,
    .avatar-wrapper .avatar-circle {
        width: 76px;
        height: 76px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid var(--border);
        display: block;
        margin: 0;
    }

.avatar-edit-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

    .avatar-edit-badge svg {
        width: 13px;
        height: 13px;
        color: #fff;
    }

/* ===================== Profile menu list ===================== */

.profile-menu {
    margin-top: 16px;
    border-top: 1px solid var(--border);
}

.profile-menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.92rem;
}

    .profile-menu-item .chevron {
        color: var(--text-muted);
        font-size: 1.1rem;
    }

/* ===================== App shell (authenticated pages) ===================== */

.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0 10px;
    margin-bottom: 20px;
}

.app-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

    .app-nav-item svg {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .app-nav-item:hover {
        background: var(--bg-page);
    }

    .app-nav-item.active {
        background: var(--primary-soft);
        color: var(--primary);
    }



.app-topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 14px;
    flex-shrink: 0;
}

.app-main {
    flex: 1;
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-main-inner {
    max-width: 460px;
    margin: 0 auto;
    width: 100%;
}

    .app-main-inner.discover-wide {
        max-width: 1100px;
    }

/* Only the Chat Room needs a pinned header/input with internal message scroll */
.app-main.chat-scroll {
    overflow: hidden;
}

    .app-main.chat-scroll .app-main-inner {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

/* Bottom nav — hidden on desktop, shown on mobile */
.bottom-nav {
    display: none;
}

@media (max-width: 768px) {
    .app-sidebar {
        display: none;
    }

    .app-main {
        padding: 16px 16px calc(84px + env(safe-area-inset-bottom));
    }

    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        justify-content: space-around;
        z-index: 50;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 0.66rem;
        font-weight: 600;
    }

        .bottom-nav-item svg {
            width: 22px;
            height: 22px;
        }

        .bottom-nav-item.active {
            color: var(--primary);
        }
}
.ongoing-join-btn, .home-hero-btn, .home-event-cta {
    opacity: 0;
    animation: fadeInBtn 0.15s ease forwards;
    animation-delay: 0.05s;
}

@keyframes fadeInBtn {
    to {
        opacity: 1;
    }
}
.avatar-box {
    width: var(--avatar-size, 40px);
    height: var(--avatar-size, 40px);
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: block;
}

    .avatar-box img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }