/**
 * ShareThePlace - Modern Mobile-First CSS
 * Clean, smooth, Instagram/TikTok inspired
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --primary: #1a2744;
    --primary-light: #2a3754;
    --accent: #d96b3d;
    --accent-light: #e58a63;
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --red: #ef4444;
    --green: #22c55e;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);

    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --bottom-nav-height: calc(60px + var(--safe-bottom));
    --top-bar-height: 56px;
}

/* ========================================
   Reset & Base
   ======================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--gray-900);
    background: var(--gray-50);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img, video {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    border: none;
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
}

input, textarea, select {
    font: inherit;
    border: none;
    outline: none;
    -webkit-appearance: none;
}

/* ========================================
   Top Bar
   ======================================== */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: calc(var(--top-bar-height) + var(--safe-top));
    padding-top: var(--safe-top);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-left: 16px;
    padding-right: 16px;
    z-index: 100;
}

/* Top bar sections */
.top-bar-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.top-bar-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    max-width: 600px;
    margin: 0 16px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.top-bar-logo {
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.top-bar-logo svg {
    width: 28px;
    height: 35px;
}

.top-bar-logo-text {
    font-weight: 700;
    font-size: 18px;
    display: none;
}

@media (min-width: 768px) {
    .top-bar-logo-text {
        display: block;
    }

    .top-bar-center {
        gap: 16px;
    }
}

/* Mobile: no center section wrapper needed */
@media (max-width: 767px) {
    .top-bar-center {
        margin: 0 12px;
    }
}

.search-bar {
    flex: 1;
    position: relative;
    max-width: 280px;
    min-width: 120px;
}

.search-bar input {
    width: 100%;
    height: 40px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    padding: 0 16px 0 40px;
    font-size: 14px;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.search-bar input:focus {
    background: var(--white);
    border-color: var(--primary);
}

.search-bar input::placeholder {
    color: var(--gray-400);
}

/* Mobile: show search icon only, expand on focus */
@media (max-width: 767px) {
    .search-bar input {
        height: 38px;
        padding-left: 38px;
        font-size: 15px;
    }

    .search-bar-icon {
        left: 12px;
        width: 16px;
        height: 16px;
    }
}

.search-bar-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
    pointer-events: none;
}

/* Search Container & Dropdown */
.search-container {
    position: relative;
    flex: 1;
    max-width: 320px;
    min-width: 120px;
}

.search-bar {
    max-width: none;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-300);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    padding: 0;
}

.search-clear svg {
    width: 12px;
    height: 12px;
    color: var(--gray-600);
}

.search-bar.has-value .search-clear {
    opacity: 1;
    visibility: visible;
}

.search-clear:hover {
    background: var(--gray-400);
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 0 0 1px rgba(0,0,0,0.05);
    max-height: 420px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.98);
    transition: all 0.2s ease;
    z-index: 200;
}

.search-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.search-dropdown::-webkit-scrollbar {
    width: 6px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

/* Search Sections */
.search-section {
    padding-bottom: 4px;
}

.search-section:empty,
.search-section[style*="display: none"] {
    padding: 0;
}

.search-section-header {
    padding: 14px 16px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-500);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-section-header button {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--accent);
    cursor: pointer;
    font-weight: 500;
}

.search-section-header button:hover {
    text-decoration: underline;
}

/* Search Result Items */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.search-result-item:hover,
.search-result-item.selected {
    background: var(--gray-50);
}

/* User Result */
.search-result-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-info p {
    font-size: 13px;
    color: var(--gray-500);
    margin: 2px 0 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Location Result */
.search-result-location-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #e58a63);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.search-result-location-icon svg {
    width: 22px;
    height: 22px;
    color: var(--white);
}

/* Recent item remove button */
.search-result-remove {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
}

.search-result-remove:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

.search-result-remove svg {
    width: 16px;
    height: 16px;
}

/* Search Footer */
.search-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--gray-100);
    color: var(--gray-600);
    font-size: 14px;
    text-decoration: none;
    transition: background 0.15s;
}

.search-footer:hover {
    background: var(--gray-50);
}

.search-footer svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.search-footer svg:first-child {
    color: var(--gray-400);
}

.search-footer svg:last-child {
    margin-left: auto;
    color: var(--gray-400);
}

.search-footer strong {
    color: var(--gray-900);
}

/* No Results */
.search-no-results {
    padding: 32px 16px;
    text-align: center;
    color: var(--gray-500);
}

.search-no-results svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.search-no-results p {
    margin: 0;
    font-size: 14px;
}

/* Mobile Search Dropdown */
@media (max-width: 767px) {
    .search-container {
        max-width: none;
    }

    .search-dropdown {
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        border-radius: 0 0 16px 16px;
        max-height: calc(100vh - 56px - 60px);
    }
}

/* Desktop Navigation */
.desktop-nav {
    display: none;
    align-items: center;
    gap: 8px;
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

.desktop-nav-item {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.desktop-nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.desktop-nav-item.active {
    color: var(--primary);
    background: var(--gray-100);
}

.desktop-nav-item svg {
    width: 24px;
    height: 24px;
}

/* Desktop Create Button */
.desktop-nav-create {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: 10px;
    color: var(--white);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(217, 107, 61, 0.3);
    transition: all 0.2s;
}

.desktop-nav-create:hover {
    box-shadow: 0 3px 12px rgba(217, 107, 61, 0.4);
}

.desktop-nav-create:active {
    transform: scale(0.95);
}

.desktop-nav-create svg {
    width: 18px;
    height: 18px;
}

/* User Menu */
.user-menu {
    position: relative;
    display: none;
}

@media (min-width: 768px) {
    .user-menu {
        display: block;
    }
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 6px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    transition: background 0.2s;
}

.user-menu-trigger:hover {
    background: var(--gray-200);
}

.user-menu-trigger img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-menu-trigger svg {
    width: 16px;
    height: 16px;
    color: var(--gray-500);
    transition: transform 0.2s;
}

.user-menu.open .user-menu-trigger svg {
    transform: rotate(180deg);
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 240px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--gray-200);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 200;
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-menu-header strong {
    font-size: 15px;
    font-weight: 600;
}

.user-menu-header span {
    font-size: 13px;
    color: var(--gray-500);
}

.user-menu-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 4px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--gray-700);
    transition: background 0.2s;
    text-align: left;
}

.user-menu-item:hover {
    background: var(--gray-50);
}

.user-menu-item svg {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.user-menu-item-danger {
    color: var(--red);
}

.user-menu-item-danger svg {
    color: var(--red);
}

.user-menu-logout {
    margin: 0;
}

/* Auth Buttons */
.auth-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-text {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-700);
    padding: 10px 16px;
    border-radius: var(--radius);
    transition: background 0.2s;
    display: none;
}

@media (min-width: 768px) {
    .btn-text {
        display: block;
    }
}

.btn-text:hover {
    background: var(--gray-100);
}

.btn-accent-sm {
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    background: var(--accent);
    padding: 10px 20px;
    border-radius: var(--radius);
    transition: opacity 0.2s;
    white-space: nowrap;
}

/* Mobile: smaller auth button */
@media (max-width: 767px) {
    .btn-accent-sm {
        padding: 8px 14px;
        font-size: 13px;
    }
}

.btn-accent-sm:hover {
    opacity: 0.9;
}

/* Top Bar Button */
.top-bar-btn {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.top-bar-btn:active {
    background: var(--gray-100);
}

.top-bar-btn svg {
    width: 24px;
    height: 24px;
}

.badge-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--white);
}

/* Mobile Only */
.mobile-only {
    display: flex;
}

@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }
}

/* ========================================
   App Content
   ======================================== */
.app-content {
    padding-top: calc(var(--top-bar-height) + var(--safe-top) + 8px);
    padding-bottom: var(--bottom-nav-height);
    min-height: 100vh;
    min-height: 100dvh;
}

@media (min-width: 768px) {
    .app-content {
        padding-bottom: 40px;
    }
}

/* ========================================
   Bottom Navigation
   ======================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-height);
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding-top: 8px;
    padding-bottom: var(--safe-bottom);
    z-index: 100;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

.bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--gray-400);
    font-size: 10px;
    font-weight: 500;
    padding: 4px 12px;
    transition: color 0.2s;
}

.bottom-nav-item svg {
    width: 24px;
    height: 24px;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active svg {
    stroke-width: 2.5;
}

.bottom-nav-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid transparent;
}

.bottom-nav-item.active .bottom-nav-avatar {
    border-color: var(--primary);
}

.bottom-nav-badge {
    position: absolute;
    top: 0;
    right: 4px;
    min-width: 16px;
    height: 16px;
    background: var(--red);
    color: var(--white);
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.bottom-nav-create {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    margin-top: -8px;
    box-shadow: 0 4px 12px rgba(217, 107, 61, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.bottom-nav-create:active {
    transform: scale(0.95);
}

.bottom-nav-create svg {
    width: 24px;
    height: 24px;
}

/* ========================================
   Feed
   ======================================== */
.feed {
    max-width: 600px;
    margin: 0 auto;
    padding: 0;
}

@media (min-width: 768px) {
    .feed {
        padding: 20px;
    }
}

.feed-item {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
}

@media (min-width: 768px) {
    .feed-item {
        border-radius: var(--radius);
        border: 1px solid var(--gray-200);
        margin-bottom: 20px;
    }
}

.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
}

.feed-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.feed-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.feed-user-info {
    display: flex;
    flex-direction: column;
}

.feed-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
}

.feed-location {
    font-size: 12px;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
}

.feed-location svg {
    width: 12px;
    height: 12px;
}

.feed-time {
    font-size: 12px;
    color: var(--gray-400);
}

.feed-media {
    position: relative;
    background: var(--gray-100);
    aspect-ratio: 1;
    overflow: hidden;
}

.feed-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 12px 8px;
}

.feed-action {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    border-radius: var(--radius-sm);
    transition: transform 0.2s;
}

.feed-action:active {
    transform: scale(0.9);
}

.feed-action svg {
    width: 24px;
    height: 24px;
}

.feed-action.liked {
    color: var(--red);
}

.feed-action.liked svg {
    fill: var(--red);
    stroke: var(--red);
}

.feed-action-location {
    margin-left: auto;
    color: var(--accent);
}

.feed-body {
    padding: 0 16px 16px;
}

.feed-likes {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.feed-caption {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 6px;
}

.feed-caption-user {
    font-weight: 600;
    margin-right: 6px;
}

.feed-caption-text {
    color: var(--gray-700);
}

.feed-comments-link {
    font-size: 13px;
    color: var(--gray-400);
}

/* ========================================
   Empty Feed
   ======================================== */
.empty-feed {
    min-height: calc(100vh - var(--top-bar-height) - var(--bottom-nav-height) - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.empty-feed-content {
    text-align: center;
    max-width: 300px;
}

.empty-feed-content svg {
    width: 80px;
    height: 80px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-feed-content h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.empty-feed-content p {
    color: var(--gray-500);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* ========================================
   Buttons
   ======================================== */
.btn-accent {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 48px;
    padding: 0 28px;
    background: var(--accent);
    color: var(--white);
    font-weight: 600;
    font-size: 15px;
    border-radius: var(--radius-full);
    transition: transform 0.2s, opacity 0.2s;
}

.btn-accent:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* ========================================
   Auth Screens
   ======================================== */
.auth-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
}

.auth-container {
    width: 100%;
    max-width: 380px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    margin-bottom: 20px;
    color: var(--primary);
}

.auth-logo svg {
    width: 48px;
    height: 60px;
    margin: 0 auto;
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--gray-500);
    font-size: 15px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.input-group {
    position: relative;
}

.input-group input {
    width: 100%;
    height: 54px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 0 18px;
    font-size: 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 39, 68, 0.1);
}

.input-group input::placeholder {
    color: var(--gray-400);
}

.input-group.error input {
    border-color: var(--red);
}

.input-error {
    display: block;
    font-size: 13px;
    color: var(--red);
    margin-top: 6px;
    padding-left: 4px;
}

.btn-auth {
    height: 54px;
    background: var(--primary);
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius);
    margin-top: 8px;
    transition: opacity 0.2s;
}

.btn-auth:active {
    opacity: 0.9;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
    color: var(--gray-400);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.auth-link {
    display: block;
    text-align: center;
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 24px;
}

.auth-link a {
    color: var(--accent);
    font-weight: 600;
}

/* ========================================
   Modal Sheet (Bottom Sheet)
   ======================================== */
.modal-sheet {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    visibility: hidden;
}

.modal-sheet.open {
    visibility: visible;
}

.modal-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.modal-sheet.open .modal-sheet-backdrop {
    opacity: 1;
}

.modal-sheet-content {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px calc(20px + var(--safe-bottom));
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-sheet {
        align-items: center;
    }

    .modal-sheet-content {
        border-radius: var(--radius);
        margin: 20px;
        max-height: 80vh;
    }
}

.modal-sheet.open .modal-sheet-content {
    transform: translateY(0);
}

.modal-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    margin: 0 auto 16px;
}

@media (min-width: 768px) {
    .modal-sheet-handle {
        display: none;
    }
}

.modal-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-sheet-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Create Form
   ======================================== */
.create-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.create-media-zone {
    background: var(--gray-50);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.create-media-zone.dragover {
    border-color: var(--accent);
    background: rgba(217, 107, 61, 0.05);
}

.create-media-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 40px 20px;
    color: var(--gray-400);
    cursor: pointer;
    transition: background 0.2s;
}

.create-media-placeholder:hover {
    background: var(--gray-100);
}

.create-media-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--gray-300);
}

.create-media-placeholder span {
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-600);
}

.create-media-placeholder small {
    font-size: 13px;
    color: var(--gray-400);
}

.create-media-preview {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
}

.create-media-preview:empty {
    display: none;
}

.create-media-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.create-media-preview img,
.create-media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.create-media-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    color: var(--white);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 5;
}

.create-media-remove:hover {
    background: var(--red);
}

.create-media-remove svg {
    width: 14px;
    height: 14px;
}

/* Add more button in preview */
.create-media-add-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    aspect-ratio: 1;
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.create-media-add-more:hover {
    background: var(--gray-200);
    border-color: var(--accent);
}

.create-media-add-more svg {
    width: 24px;
    height: 24px;
    color: var(--gray-400);
}

.create-media-add-more span {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-500);
}

.create-media-add-more:hover svg,
.create-media-add-more:hover span {
    color: var(--accent);
}

/* Video indicator in preview */
.preview-video-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.preview-video-icon svg {
    width: 14px;
    height: 14px;
    color: #fff;
    margin-left: 2px;
}

.create-field {
    position: relative;
}

.create-field textarea {
    width: 100%;
    min-height: 100px;
    padding: 14px 16px;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--radius);
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    transition: all 0.2s;
}

.create-field textarea:focus {
    background: var(--white);
    border-color: var(--primary);
}

.char-count {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-size: 12px;
    color: var(--gray-400);
}

.create-location-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--gray-50);
    border: 2px solid transparent;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.create-location-wrapper:focus-within {
    background: var(--white);
    border-color: var(--primary);
}

.create-location-wrapper svg {
    width: 20px;
    height: 20px;
    color: var(--accent);
    flex-shrink: 0;
}

.create-location-wrapper input {
    flex: 1;
    background: none;
    font-size: 15px;
}

.create-location-wrapper input::placeholder {
    color: var(--gray-400);
}

.detect-location-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
    border-radius: 50%;
    transition: all 0.2s;
}

.detect-location-btn:hover {
    background: var(--gray-200);
    color: var(--accent);
}

.detect-location-btn svg {
    width: 18px;
    height: 18px;
}

.location-suggestions {
    margin-top: 8px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: none;
}

.location-suggestions.show {
    display: block;
}

.location-suggestion {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.location-suggestion:hover {
    background: var(--gray-50);
}

.location-suggestion svg {
    width: 18px;
    height: 18px;
    color: var(--accent);
}

.location-suggestion span {
    font-size: 14px;
}

.btn-create {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 52px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: var(--white);
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius);
    transition: opacity 0.2s, transform 0.2s;
}

.btn-create:hover {
    opacity: 0.95;
}

.btn-create:active {
    transform: scale(0.98);
}

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

.btn-create svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   Toast
   ======================================== */
.toast-auto {
    position: fixed;
    top: calc(var(--top-bar-height) + var(--safe-top) + 12px);
    left: 16px;
    right: 16px;
    max-width: 400px;
    margin: 0 auto;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    z-index: 300;
    animation: toastIn 0.3s ease-out, toastOut 0.3s ease-in 3s forwards;
}

.toast-success {
    background: var(--green);
    color: var(--white);
}

.toast-error {
    background: var(--red);
    color: var(--white);
}

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

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

/* ========================================
   Real-time Notification Toast
   ======================================== */
.notif-toast-container {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    right: 16px;
    z-index: 400;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
}

@media (min-width: 768px) {
    .notif-toast-container {
        bottom: 24px;
    }
}

.notif-toast {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 12px 16px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--gray-200);
    max-width: 320px;
    pointer-events: auto;
    animation: notifToastIn 0.3s ease-out;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.notif-toast:hover {
    transform: translateX(-4px);
}

.notif-toast.hiding {
    animation: notifToastOut 0.3s ease-in forwards;
}

.notif-toast-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.notif-toast-content {
    flex: 1;
    min-width: 0;
}

.notif-toast-text {
    font-size: 14px;
    color: var(--gray-800);
    line-height: 1.4;
}

.notif-toast-text strong {
    font-weight: 600;
}

.notif-toast-time {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.notif-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-toast-icon svg {
    width: 16px;
    height: 16px;
}

.notif-toast-icon.like {
    background: #fee2e2;
    color: #ef4444;
}

.notif-toast-icon.comment {
    background: #dbeafe;
    color: #3b82f6;
}

.notif-toast-icon.follow {
    background: #f3e8ff;
    color: #9333ea;
}

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

@keyframes notifToastOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ========================================
   Profile Page
   ======================================== */
.profile-header {
    background: var(--white);
    padding: 24px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.profile-header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .profile-avatar {
        width: 100px;
        height: 100px;
    }
}

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

.profile-username {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-name {
    font-size: 15px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.profile-bio {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.5;
    margin-bottom: 16px;
}

.profile-stats {
    display: flex;
    gap: 24px;
}

.profile-stat {
    text-align: center;
}

.profile-stat-value {
    font-size: 18px;
    font-weight: 700;
}

.profile-stat-label {
    font-size: 12px;
    color: var(--gray-500);
}

.profile-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-outline {
    height: 36px;
    padding: 0 20px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
}

.profile-posts {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

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

.profile-post-item {
    aspect-ratio: 1;
    background: var(--gray-100);
    overflow: hidden;
}

.profile-post-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.profile-post-item:hover img {
    transform: scale(1.05);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes heartPop {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes heartBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

.feed-action[data-like-btn] svg {
    transition: transform 0.2s;
}

.feed-action[data-like-btn]:active svg {
    animation: heartPop 0.3s;
}

.like-burst {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    height: 100px;
    color: var(--white);
    pointer-events: none;
    animation: heartBurst 0.8s ease-out forwards;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.like-burst svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* ========================================
   Notifications Page
   ======================================== */
.notifications-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.notifications-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.notifications-header h1 {
    font-size: 24px;
    font-weight: 700;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: background 0.2s;
}

.notification-item.unread {
    background: rgba(217, 107, 61, 0.05);
}

.notification-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-text {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 4px;
}

.notification-text strong {
    font-weight: 600;
}

.notification-time {
    font-size: 12px;
    color: var(--gray-400);
}

.notification-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.notifications-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}

.notifications-empty svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

/* ========================================
   Settings Page
   ======================================== */
.settings-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.settings-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--gray-200);
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.settings-item:not(:last-child) {
    border-bottom: 1px solid var(--gray-100);
}

.settings-label {
    font-size: 14px;
}

.settings-value {
    font-size: 14px;
    color: var(--gray-500);
}

/* ========================================
   Utilities
   ======================================== */
.hide { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-500); }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* ========================================
   Desktop Only
   ======================================== */
.desktop-only {
    display: none !important;
}

@media (min-width: 768px) {
    .desktop-only {
        display: flex !important;
    }
}

/* ========================================
   Notification Dropdown (Desktop)
   ======================================== */
.notif-dropdown {
    position: relative;
}

.notif-dropdown-trigger {
    position: relative;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    border-radius: var(--radius);
    transition: background 0.2s;
    background: none;
    border: none;
    cursor: pointer;
}

.notif-dropdown-trigger:hover {
    background: var(--gray-100);
}

.notif-dropdown-trigger svg {
    width: 24px;
    height: 24px;
}

.notif-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    background: var(--red);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid var(--white);
}

.notif-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 380px;
    max-height: 480px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border: 1px solid var(--gray-200);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 150;
}

.notif-dropdown.open .notif-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.notif-dropdown-header span {
    font-weight: 600;
    font-size: 15px;
    color: var(--gray-900);
}

.notif-mark-read-btn {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.notif-mark-read-btn:hover {
    background: rgba(217, 107, 61, 0.1);
}

.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}

.notif-dropdown-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.notif-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.notif-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    transition: background 0.2s;
    text-decoration: none;
    color: inherit;
}

.notif-dropdown-item:hover {
    background: var(--gray-50);
}

.notif-dropdown-item.unread {
    background: rgba(217, 107, 61, 0.05);
}

.notif-dropdown-item.unread:hover {
    background: rgba(217, 107, 61, 0.08);
}

.notif-dropdown-avatar {
    position: relative;
    flex-shrink: 0;
}

.notif-dropdown-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

.notif-dropdown-type {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--white);
}

.notif-dropdown-type svg {
    width: 10px;
    height: 10px;
}

.notif-dropdown-type.like {
    background: #ff4757;
    color: white;
}

.notif-dropdown-type.comment {
    background: #3498db;
    color: white;
}

.notif-dropdown-type.follow {
    background: #9b59b6;
    color: white;
}

.notif-dropdown-body {
    flex: 1;
    min-width: 0;
}

.notif-dropdown-text {
    font-size: 14px;
    color: var(--gray-700);
    line-height: 1.4;
    margin: 0;
}

.notif-dropdown-text strong {
    font-weight: 600;
    color: var(--gray-900);
}

.notif-dropdown-time {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
}

.notif-dropdown-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.notif-dropdown-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.notif-dropdown-empty svg {
    width: 48px;
    height: 48px;
    color: var(--gray-300);
    margin-bottom: 12px;
}

.notif-dropdown-empty p {
    font-size: 14px;
    margin: 0;
}

.notif-dropdown-footer {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    border-top: 1px solid var(--gray-100);
    transition: background 0.2s;
}

.notif-dropdown-footer:hover {
    background: var(--gray-50);
}

/* ========================================
   Reduced Motion
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
