/* ══════════════════════════════════════════════════════════
   Minimal Social - Design System
   ══════════════════════════════════════════════════════════ */

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
    --bg:          #f5f5f5;
    --surface:     #ffffff;
    --text:        #111111;
    --text-2:      #555555;
    --text-3:      #aaaaaa;
    --border:      #e8e8e8;
    --border-color: #e8e8e8;   /* alias for legacy rules */
    --accent:      #111111;
    --accent-fg:   #ffffff;
    --like:        #e0245e;
    --shadow-sm:   0 1px 6px  rgba(0,0,0,.07);
    --shadow:      0 2px 14px rgba(0,0,0,.09);
    --shadow-md:   0 4px 28px rgba(0,0,0,.13);
    --r:           16px;
    --r-sm:        10px;
    --r-pill:      100px;
    --nav-h:       64px;
    --header-h:    56px;
    --font:        'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --ease:        0.18s ease;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #121212;
        --surface:     #1e1e1e;
        --text:        #f5f5f5;
        --text-2:      #aaaaaa;
        --text-3:      #666666;
        --border:      #2c2c2c;
        --border-color: #2c2c2c;
        --accent:      #ffffff;
        --accent-fg:   #111111;
        --like:        #ff4f7e;
        --shadow-sm:   0 1px 6px  rgba(0,0,0,.3);
        --shadow:      0 2px 14px rgba(0,0,0,.4);
        --shadow-md:   0 4px 28px rgba(0,0,0,.5);
    }
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }

/* ─── Utilities ──────────────────────────────────────────── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════
   LOGIN
   ══════════════════════════════════════════════════════════ */
.full-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 1000;
}

.login-container {
    text-align: center;
    padding: 24px;
}

.login-container h1 {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 800;
    letter-spacing: -3px;
    color: var(--text);
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-3);
    font-size: .95rem;
    margin-bottom: 40px;
}

.google-btn {
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    padding: 14px 32px;
    border-radius: var(--r-pill);
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: -.01em;
    transition: opacity var(--ease);
}
.google-btn:hover    { opacity: .8; }
.google-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════════ */
#app-shell {
    position: fixed;
    inset: 0;
    background: var(--bg);
}

/* ─── App Screens ────────────────────────────────────────── */
.app-screen {
    position: absolute;
    inset: 0;
    bottom: var(--nav-h);
    display: none;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg);
}
.app-screen.active { display: flex; }

/* ─── App Header ─────────────────────────────────────────── */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--header-h);
    flex-shrink: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.app-header h2 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.4px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: .82rem;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    transition: background var(--ease), color var(--ease);
}
.text-btn:hover { background: var(--border); color: var(--text); }

/* ══════════════════════════════════════════════════════════
   BOTTOM NAV
   ══════════════════════════════════════════════════════════ */
#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 50;
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-3);
    font-size: .68rem;
    font-weight: 600;
    padding: 8px 4px;
    height: 100%;
    transition: color var(--ease);
    letter-spacing: .02em;
    text-transform: uppercase;
}
.nav-btn.active { color: var(--text); }
.nav-icon { width: 20px; height: 20px; }

.nav-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: -2px;
    background: var(--text);
    color: transparent;
    font-size: 0;
    min-width: 8px;
    height: 8px;
    border-radius: var(--r-pill);
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════
   FEED
   ══════════════════════════════════════════════════════════ */
.feed-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 16px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.feed-container::-webkit-scrollbar { display: none; }

.status-tile {
    flex-shrink: 0;
    width: 200px;
    min-height: 180px;
    background: var(--surface);
    border-radius: var(--r);
    padding: 18px 16px 14px;
    box-shadow: var(--shadow-sm);
    scroll-snap-align: start;
    cursor: pointer;
    transition: transform var(--ease), box-shadow var(--ease);
    display: flex;
    flex-direction: column;
    gap: 9px;
    border: 1px solid var(--border);
}
.status-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.tile-pfp {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

.tile-name {
    font-size: .85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.2px;
}

.tile-status {
    font-size: .9rem;
    color: var(--text-2);
    line-height: 1.6;
    flex: 1;
    word-break: break-word;
}

.tile-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.tile-time {
    font-size: .68rem;
    color: var(--text-3);
}

.like-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--text-3);
    padding: 4px 8px;
    border-radius: var(--r-pill);
    transition: all var(--ease);
}
.like-btn:hover { color: var(--like); }
.like-btn.liked { color: var(--like); }

.like-count {
    display: none;
}

.heart {
    font-size: 1.05rem;
    transition: transform .15s;
    display: inline-block;
}
.like-btn.liked .heart { transform: scale(1.15); }

/* ══════════════════════════════════════════════════════════
   FAB
   ══════════════════════════════════════════════════════════ */
.fab {
    position: fixed;
    bottom: calc(var(--nav-h) + 18px);
    right: 22px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    font-size: 26px;
    font-weight: 300;
    line-height: 1;
    cursor: grab;
    z-index: 40;
    box-shadow: 0 4px 18px rgba(0,0,0,.28);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
    touch-action: none;
    transition: box-shadow var(--ease);
}
.fab:hover  { box-shadow: 0 6px 28px rgba(0,0,0,.35); }
.fab:active { cursor: grabbing; }

/* ══════════════════════════════════════════════════════════
   STATUS MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.48);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--r) var(--r) 0 0;
    width: 100%;
    max-width: 560px;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 {
    font-size: .95rem;
    font-weight: 700;
    letter-spacing: -.3px;
}

.char-count, .char-hint {
    font-size: .72rem;
    color: var(--text-3);
    font-weight: 500;
}

#status-input {
    width: 100%;
    height: 88px;
    resize: none;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-size: .9rem;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color var(--ease);
}
#status-input:focus { border-color: var(--text); }

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 10px 22px;
    border-radius: var(--r-pill);
    font-size: .85rem;
    font-weight: 500;
    transition: background var(--ease);
}
.btn-ghost:hover { background: var(--bg); }

#post-status {
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    padding: 10px 26px;
    border-radius: var(--r-pill);
    font-size: .85rem;
    font-weight: 600;
    transition: opacity var(--ease);
}
#post-status:hover    { opacity: .8; }
#post-status:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════════
   FRIEND REQUESTS PANEL
   ══════════════════════════════════════════════════════════ */
.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 90;
}

.side-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: min(340px, 92vw);
    background: var(--surface);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 28px rgba(0,0,0,.14);
    transform: translateX(100%);
    transition: transform .26s ease;
}
.side-panel.open { transform: translateX(0); }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-header h3 { font-size: .95rem; font-weight: 700; }

.icon-btn {
    background: none;
    border: none;
    width: 30px; height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .8rem;
    color: var(--text-2);
    transition: background var(--ease);
}
.icon-btn:hover { background: var(--bg); }

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

.request-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    transition: background var(--ease);
}
.request-item:hover { background: var(--bg); }

.request-pfp {
    width: 42px; height: 42px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

.request-info    { flex: 1; min-width: 0; }
.request-name    { font-size: .85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.request-handle  { font-size: .72rem; color: var(--text-2); margin-top: 2px; }
.request-actions { display: flex; gap: 6px; }

.btn-accept {
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    padding: 5px 12px;
    border-radius: var(--r-pill);
    font-size: .72rem;
    font-weight: 600;
    transition: opacity var(--ease);
}
.btn-accept:hover { opacity: .8; }

.btn-reject {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
    padding: 5px 10px;
    border-radius: var(--r-pill);
    font-size: .72rem;
    transition: background var(--ease);
}
.btn-reject:hover { background: var(--bg); }

/* ══════════════════════════════════════════════════════════
   EXPLORE SCREEN
   ══════════════════════════════════════════════════════════ */
.search-wrapper {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

#search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 10px 18px;
    font-size: .9rem;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    transition: border-color var(--ease);
}
#search-input:focus { border-color: var(--text); }

.explore-results { flex: 1; overflow-y: auto; padding: 8px; }

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background var(--ease);
}
.user-row:hover { background: var(--surface); }

.user-row-pfp {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
    flex-shrink: 0;
}

.user-row-info    { flex: 1; min-width: 0; }
.user-row-handle  { font-size: .9rem; font-weight: 600; }
.user-row-sub     { font-size: .72rem; color: var(--text-3); margin-top: 2px; }

.friend-chip {
    flex-shrink: 0;
    font-size: .72rem;
    font-weight: 600;
    padding: 5px 13px;
    border-radius: var(--r-pill);
    border: none;
    white-space: nowrap;
}
.chip-add { background: var(--accent); color: var(--accent-fg); transition: opacity var(--ease); cursor: pointer; }
.chip-add:hover    { opacity: .8; }
.chip-add:disabled { opacity: .5; cursor: not-allowed; }
.chip-pending  { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); cursor: default; }
.chip-friends  { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); cursor: default; }

/* ══════════════════════════════════════════════════════════
   PROFILE SCREEN
   ══════════════════════════════════════════════════════════ */
#profile-screen { overflow-y: auto; }
#profile-content { display: flex; flex-direction: column; min-height: 100%; }

.profile-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
}

.profile-back-btn {
    background: none;
    border: none;
    color: var(--text-2);
    font-size: .85rem;
    font-weight: 500;
    padding: 16px 20px 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: color var(--ease);
}
.profile-back-btn:hover { color: var(--text); }

.profile-body {
    padding: 28px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.profile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--border);
}

.profile-name {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.4px;
    text-align: center;
}

.profile-handle {
    font-size: .9rem;
    color: var(--text-2);
    font-weight: 500;
}

.profile-bio {
    font-size: .875rem;
    color: var(--text-2);
    text-align: center;
    line-height: 1.55;
    max-width: 300px;
    margin-top: 4px;
}

/* Current Status on Profile */
.current-status-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 14px 16px;
    margin-bottom: 20px;
}
.current-status-label {
    font-size: .67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-3);
    margin-bottom: 6px;
}
.current-status-text {
    font-size: .9rem;
    color: var(--text);
    line-height: 1.5;
}

/* Photos Grid */
.profile-photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    border-radius: var(--r-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.profile-photo {
    aspect-ratio: 1;
    object-fit: cover;
    width: 100%;
    background: var(--border);
}

/* Friend Action Button (stranger/friend view) */
.profile-action-btn {
    width: 100%;
    padding: 12px;
    border-radius: var(--r-pill);
    font-size: .88rem;
    font-weight: 600;
    font-family: var(--font);
    border: none;
    cursor: pointer;
    margin-bottom: 12px;
    transition: opacity var(--ease);
}
.btn-friend-add     { background: var(--accent); color: var(--accent-fg); }
.btn-friend-pending { background: var(--bg); color: var(--text-3); border: 1px solid var(--border); cursor: default; }
.btn-friend-remove  { background: var(--bg); color: var(--like); border: 1px solid #fad0dc; }
.profile-action-btn:hover:not(.btn-friend-pending) { opacity: .8; }
.profile-action-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Profile Edit Form (own profile) ───────────────────── */
.profile-edit-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.form-hint {
    font-size: .7rem;
    color: var(--text-3);
    margin-top: -2px;
}

.form-input, .form-textarea {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 10px 14px;
    font-size: .9rem;
    font-family: var(--font);
    color: var(--text);
    outline: none;
    transition: border-color var(--ease);
}
.form-input:focus, .form-textarea:focus { border-color: var(--text); }
.form-textarea { resize: none; height: 80px; }

/* Photo URL Inputs */
.photos-input-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.photo-slot { display: flex; flex-direction: column; gap: 6px; }
.photo-url-input {
    width: 100%;
    padding: 8px 10px;
    font-size: .68rem;
    font-family: var(--font);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--ease);
}
.photo-url-input:focus { border-color: var(--text); }
.photo-preview {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--r-sm);
    background: var(--border);
}

.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}
.avatar-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform var(--ease), border-color var(--ease);
    background: var(--border);
    object-fit: contain;
}
.avatar-option:hover { transform: scale(1.05); }
.avatar-option.selected { border-color: var(--accent); }

.save-profile-btn {
    width: 100%;
    padding: 13px;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: var(--r-pill);
    font-size: .9rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    transition: opacity var(--ease);
}
.save-profile-btn:hover    { opacity: .8; }
.save-profile-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Status History ─────────────────────────────────────── */
.history-section {
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.section-title {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text-3);
    margin-bottom: 12px;
}

.history-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-text { font-size: .875rem; color: var(--text); line-height: 1.5; }
.history-time { font-size: .7rem; color: var(--text-3); margin-top: 4px; }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
    color: var(--text-3);
    font-size: .85rem;
    text-align: center;
    padding: 48px 24px;
    line-height: 1.6;
    width: 100%;
}