/* Msocial_ITCS333 - global design system.
   Tokens below are derived from the hand-drawn design (Msocial Design.pdf)
   and the Figma-exported component styles (icon buttons, overlay badge,
   floating action button). */

:root {
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --shadow-icon: 0px 0px 4px rgba(0, 0, 0, 0.25);
    --shadow-fab: 0px 5px 5px rgba(0, 0, 0, 0.25);
    --overlay-badge-bg: rgba(41, 0, 0, 0.46);
    --accent: #4f46e5;
    --accent-hover: #4338ca;
}

html[data-theme="light"] {
    --surface: #ffffff;
    --surface-alt: #f4f4f7;
    --text: #000000;
    --border-color: #6F6F6F;
}

html[data-theme="dark"] {
    --surface: #242424;
    --surface-alt: #1a1a1a;
    --text: #f0f0f0;
    --border-color: #5a5a5a;
}

html[data-theme="light"] body {
    background-color: var(--surface-alt);
    color: var(--text);
}

html[data-theme="dark"] body {
    background-color: var(--surface-alt);
    color: var(--text);
}

body {
    margin: 0;
    padding-top: 80px;
    font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a {
    color: var(--accent);
}

/* ---------- Header / navigation (floating glass pill + gradient wings) ---------- */

.logo-img {
    height: 30px;
    width: auto;
    display: block;
}

.app-header {
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 12px 0 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 30;
    pointer-events: none;
}

.bar-wing {
    flex: 1 1 auto;
    min-width: 16px;
}

.bar-wing-left {
    background: linear-gradient(to bottom, var(--surface) 0%, transparent 100%);
}

.bar-wing-right {
    background: linear-gradient(to bottom, var(--surface) 0%, transparent 100%);
}

.bar-pill {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-icon);
    pointer-events: auto;
    flex-wrap: wrap;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
}

.bar-pill > a,
.bar-pill > span {
    color: inherit;
    text-decoration: none;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-size: 13px;
}

.bar-pill > a:hover {
    background: var(--surface-alt);
}

#theme-toggle {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-color);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

#theme-toggle:hover {
    background: var(--surface-alt);
}

.header-search {
    display: flex;
    align-items: center;
    gap: 4px;
}

.header-search input {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 12px;
    width: 140px;
}

.header-search button {
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-size: 12px;
}

.header-search button:hover {
    background: var(--accent-hover);
}

/* ---------- Bottom floating nav island ---------- */

.bottom-nav-island {
    display: flex;
    align-items: stretch;
    justify-content: center;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
    z-index: 25;
    pointer-events: none;
}

.bottom-nav-island .bar-wing-left {
    background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
}

.bottom-nav-island .bar-wing-right {
    background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
}

.bottom-nav-island .bar-pill {
    gap: 6px;
    padding: 8px 12px;
}

.bottom-nav-island a {
    color: inherit;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.bottom-nav-island a:hover {
    background: var(--surface-alt);
}

@media (max-width: 700px) {
    .bar-wing {
        display: none;
    }

    .header-search input {
        width: 100px;
    }

    .bar-pill .welcome-text {
        display: none;
    }
}

/* ---------- Page layout ---------- */

.page-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 12px 24px 110px;
    box-sizing: border-box;
}

/* ---------- Auth pages (Login / Register) & Create Post ---------- */

.auth-page {
    display: flex;
    min-height: calc(100vh - 80px);
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
}

.auth-card,
.form-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    box-sizing: border-box;
    box-shadow: var(--shadow-icon);
}

.auth-card h2,
.form-card h2 {
    text-align: center;
    margin-top: 0;
}

.auth-card form > div,
.form-card form > div {
    margin-bottom: 14px;
}

.auth-card input,
.auth-card textarea,
.form-card input,
.form-card textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-alt);
    color: var(--text);
    font-family: inherit;
}

.auth-card button[type="submit"],
.form-card button[type="submit"] {
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.auth-card button[type="submit"]:hover,
.form-card button[type="submit"]:hover {
    background: var(--accent-hover);
}

.auth-card p {
    text-align: center;
    font-size: 14px;
}

/* ---------- Search page ---------- */

.search-bar {
    display: flex;
    gap: 8px;
    margin: 16px 0 24px;
}

.search-bar input {
    flex: 1;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text);
}

.search-bar button {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
}

.search-bar button:hover {
    background: var(--accent-hover);
}

/* ---------- Profile card ---------- */

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-icon);
}

/* ---------- Floating action button (Create Post shortcut) ---------- */

.fab-button {
    position: fixed;
    right: 24px;
    bottom: 90px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    line-height: 1;
    text-decoration: none;
    filter: drop-shadow(var(--shadow-fab));
    z-index: 20;
    transition: transform 0.15s ease;
}

.fab-button:hover {
    background: var(--accent-hover);
    transform: scale(1.06);
}

/* The rules below are strictly functional (grid layout / popup positioning)
   so the video/image feed and post popup actually work, restyled to match
   the design system above. */

.feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.grid-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    border-radius: var(--radius-sm);
    background: var(--surface-alt);
}

.grid-cell img,
.grid-cell video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-cell .text-cell {
    width: 100%;
    height: 100%;
    overflow: hidden;
    padding: 4px;
    box-sizing: border-box;
}

.grid-cell .like-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: auto;
    background: var(--overlay-badge-bg);
    color: #fff;
    font-size: 12px;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    backdrop-filter: blur(2px);
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.popup-box {
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 16px;
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-icon);
}
