/* CSS Variables - Light theme by default */
:root {
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f2f2f7;
    --bg-card: #ffffff;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #aeaeb2;
    --accent: #0a84ff;
    --accent-gradient: linear-gradient(135deg, #5e5ce6 0%, #bf5af2 50%, #ff375f 100%);
    --border: #d2d2d7;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --glass: rgba(255, 255, 255, 0.9);
    --story-ring: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --like-color: #ff375f;
    --success: #30d158;
}

/* Dark theme - applied to :root, html, or body */
:root.dark-theme,
html.dark-theme,
body.dark-theme {
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;
    --bg-card: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --text-tertiary: #636366;
    --border: #38383a;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --glass: rgba(28, 28, 30, 0.9);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(ellipse at 20% 0%, rgba(94, 92, 230, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(191, 90, 242, 0.05) 0%, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
}

.dark-theme body {
    background-image: 
        radial-gradient(ellipse at 20% 0%, rgba(94, 92, 230, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(191, 90, 242, 0.1) 0%, transparent 50%);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

/* Layout */
.app {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    gap: 64px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Left Sidebar - Navigation only */
.sidebar {
    position: sticky;
    top: 20px;
    width: 240px;
    height: fit-content;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    transition: background 0.4s ease, border-color 0.4s ease;
    z-index: 100;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.sidebar .logo {
    font-size: 22px;
    margin-bottom: 16px;
    padding: 4px 10px;
}

.sidebar .nav-menu {
    flex-direction: column;
    gap: 2px;
}

.sidebar .nav-link {
    padding: 10px 12px;
    font-size: 14px;
}

.sidebar .nav-link svg {
    width: 22px;
    height: 22px;
}

.sidebar .theme-toggle {
    margin-top: 12px;
    padding: 10px 12px;
}

.sidebar .theme-toggle-label {
    font-size: 13px;
}

.sidebar .toggle-switch {
    width: 40px;
    height: 22px;
}

.sidebar .toggle-switch::after {
    width: 16px;
    height: 16px;
}

.sidebar .toggle-switch.active::after {
    transform: translateX(18px);
}

/* Sidebar Profile Card (Desktop) */
.sidebar-profile-card {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: 16px;
    margin-top: 12px;
    transition: background 0.4s ease;
    text-decoration: none;
    color: inherit;
}

.sidebar-profile-card:hover {
    background: var(--border);
}

.sidebar-profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.sidebar-profile-details {
    display: flex;
    flex-direction: column;
}

.sidebar-profile-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.sidebar-profile-name {
    font-size: 12px;
    color: var(--text-secondary);
}

.sidebar-profile-logout {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.sidebar-profile-logout:hover {
    background: var(--bg-secondary);
    color: #ff3b30;
}

.sidebar-profile-logout svg {
    width: 20px;
    height: 20px;
}

/* Right Sidebar - Profile & Suggestions Card */
.right-sidebar {
    position: sticky;
    top: 20px;
    width: 320px;
    height: auto;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.right-card {
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.right-card-profile {
    display: flex;
    align-items: center;
    gap: 14px;
}

.right-card-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.right-card-info {
    flex: 1;
}

.right-card-username {
    font-weight: 600;
    font-size: 14px;
}

.right-card-name {
    font-size: 14px;
    color: var(--text-secondary);
}

.right-card-switch {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
}

.right-card-suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    margin-top: 8px;
}

.right-card-suggestions-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.right-card-suggestions-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
}

.right-card-suggestions-link:hover {
    color: var(--accent);
}

.right-card-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
}

.right-card-suggestion-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.right-card-suggestion-info {
    display: flex;
    flex-direction: column;
}

.right-card-suggestion-username {
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    color: var(--text-primary);
}

.right-card-suggestion-username:hover {
    color: var(--accent);
}

.right-card-suggestion-reason {
    font-size: 12px;
    color: var(--text-secondary);
}

.right-card-follow-btn {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
}

.right-card-follow-btn:hover {
    color: var(--text-primary);
}

.right-card-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

.right-card-footer a {
    color: var(--text-tertiary);
    text-decoration: none;
}

.right-card-footer a:hover {
    text-decoration: underline;
}

.right-card-copyright {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 12px;
}

.logo {
    font-size: 26px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 8px 16px;
    margin-bottom: 20px;
    letter-spacing: -0.5px;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: var(--bg-tertiary);
}

.nav-link.active {
    background: var(--accent);
    color: white;
}

.nav-link svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nav-link span {
    position: relative;
}

.notification-badge {
    position: absolute;
    right: -8px;
    top: -4px;
    background: var(--like-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin-top: 12px;
}

.theme-toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-right: 12px;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    background: var(--text-tertiary);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

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

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toggle-switch.active::after {
    transform: translateX(20px);
}

/* Main Content */
.main {
    flex: 1;
    max-width: 700px;
    margin: 0 auto;
    padding-bottom: 100px;
}

/* Stories */
.stories-container {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: background 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border);
}

.stories-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x mandatory;
}

.stories-scroll::-webkit-scrollbar {
    height: 4px;
}

.stories-scroll.hidden {
    display: none;
}

.story {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    scroll-snap-align: start;
}

.story-ring {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    padding: 3px;
    background: var(--story-ring);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 15px rgba(220, 39, 67, 0.25);
}

.story-ring:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 25px rgba(220, 39, 67, 0.4);
}

.story-ring.seen {
    background: var(--border);
    box-shadow: none;
}

.story-ring.your-story {
    position: relative;
}

.story-add-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--bg-card);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.story-add-btn:hover {
    transform: scale(1.1);
}

.story-add-btn svg {
    width: 12px;
    height: 12px;
    color: white;
}

.story-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
    object-fit: cover;
}

.story-name {
    font-size: 12px;
    color: var(--text-primary);
    max-width: 68px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}

/* Posts */
.posts {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.posts.hidden {
    display: none;
}

/* Create Post Card */
.create-post-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 12px 16px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: background 0.4s ease, border-color 0.4s ease;
}

/* Desktop only - hide on mobile and tablet */
.create-post-card.desktop-only {
    display: flex;
}

@media (max-width: 1100px) {
    .create-post-card.desktop-only {
        display: none !important;
    }
}

@media (max-width: 640px) {
    .create-post-card.desktop-only[style*="display: flex"] {
        display: none !important;
    }
}

.create-post-card.hidden {
    display: none;
}

.create-post-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.create-post-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.create-post-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.create-post-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(94, 92, 230, 0.4);
    transition: transform 0.2s ease;
}

.create-post-btn:hover {
    transform: scale(1.05);
}

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

.post {
    background: var(--bg-card);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: background 0.4s ease, box-shadow 0.4s ease;
    border: 1px solid var(--border);
}

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

.post-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.post-info {
    display: flex;
    flex-direction: column;
}

.post-username {
    font-weight: 600;
    font-size: 14px;
}

.post-location {
    font-size: 12px;
    color: var(--text-secondary);
}

.post-follow-btn {
    margin-left: auto;
    padding: 6px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.post-follow-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.post-follow-btn.following {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.post-menu {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.post-menu:hover {
    color: var(--text-primary);
}

.post-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.post-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
}

.post-actions-left {
    display: flex;
    gap: 16px;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.2s ease;
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.liked svg {
    color: var(--like-color);
    fill: var(--like-color);
}

.action-btn svg {
    width: 26px;
    height: 26px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.bookmark-btn {
    margin-left: auto;
}

.post-likes {
    padding: 0 20px 8px;
    font-weight: 600;
    font-size: 14px;
}

.post-caption {
    padding: 0 20px 12px;
    font-size: 14px;
    line-height: 1.5;
}

.post-caption-top {
    padding: 8px 20px 12px;
    font-size: 14px;
    line-height: 1.5;
}

.post-caption-top span {
    color: var(--text-secondary);
}

.post-caption strong {
    font-weight: 600;
}

.post-caption span {
    color: var(--text-secondary);
}

.post-comments {
    padding: 0 20px 12px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}

.post-comments:hover {
    color: var(--text-primary);
}

.post-time {
    padding: 0 20px 16px;
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.post {
    animation: fadeIn 0.5s ease forwards;
}

.post:nth-child(2) { animation-delay: 0.1s; }
.post:nth-child(3) { animation-delay: 0.2s; }
.post:nth-child(4) { animation-delay: 0.3s; }

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

.action-btn.liking {
    animation: likeAnimation 0.4s ease;
}

/* Post Menu Dropdown */
.post-menu-wrapper {
    position: relative;
}

.post-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 8px 0;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: none;
    overflow: hidden;
}

.post-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

.post-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.post-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.post-dropdown-item.danger {
    color: #ff3b30;
}

.post-dropdown-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.post-dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton Stories */
.skeleton-stories {
    display: none;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.skeleton-stories.show {
    display: flex;
}

.skeleton-story {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.skeleton-story-ring {
    width: 68px;
    height: 68px;
    border-radius: 50%;
}

.skeleton-story-name {
    width: 50px;
    height: 12px;
}

/* Skeleton Posts */
.skeleton-container {
    display: none;
}

.skeleton-container.show {
    display: block;
}

.skeleton-post {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 24px;
}

.skeleton-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-username {
    width: 120px;
    height: 14px;
}

.skeleton-location {
    width: 80px;
    height: 10px;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 1;
}

.skeleton-actions {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
}

.skeleton-icon {
    width: 26px;
    height: 26px;
    border-radius: 6px;
}

.skeleton-likes {
    width: 100px;
    height: 14px;
    margin: 0 20px;
}

.skeleton-caption {
    width: 80%;
    height: 14px;
    margin: 0 20px 8px;
}

.skeleton-comments {
    width: 150px;
    height: 12px;
    margin: 0 20px;
}

/* Mobile Styles */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    z-index: 200;
    transition: transform 0.3s ease;
}

.mobile-header.hidden {
    transform: translateY(-100%);
}

.mobile-header-title {
    font-size: 22px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mobile-header-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-primary);
}

.mobile-header-btn svg {
    width: 26px;
    height: 26px;
}

.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    height: 64px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 10px 20px 10px;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.mobile-nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 100%;
}

.mobile-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease, transform 0.2s ease;
    border-radius: 12px;
}

.mobile-nav-btn:hover {
    background: var(--bg-tertiary);
}

.mobile-nav-btn.active {
    color: var(--accent);
}

.mobile-nav-btn svg {
    width: 24px;
    height: 24px;
}

.mobile-nav-btn span {
    display: none;
}

.mobile-create-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: var(--accent-gradient);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(94, 92, 230, 0.4);
    transition: transform 0.2s ease;
}

.mobile-create-btn:hover {
    transform: scale(1.05);
}

.mobile-create-btn svg {
    width: 22px;
    height: 22px;
    color: white;
}

/* Mobile Profile Button as Link */
.mobile-profile-btn {
    text-decoration: none;
    border-radius: 12px;
}

.mobile-profile-btn:hover {
    background: var(--bg-tertiary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

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

.modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 auto;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 20px;
}

.modal-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

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

.modal-username {
    font-weight: 600;
    font-size: 14px;
}

.modal-textarea {
    width: 100%;
    min-height: 120px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 15px;
    resize: none;
    outline: none;
    margin-bottom: 16px;
}

.modal-textarea::placeholder {
    color: var(--text-secondary);
}

.modal-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--text-primary);
}

.modal-upload:hover {
    background: var(--border);
}

.modal-upload svg {
    width: 24px;
    height: 24px;
    color: var(--accent);
}

.modal-upload span {
    font-size: 14px;
    font-weight: 500;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.modal-share-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.modal-share-btn:hover {
    opacity: 0.9;
}

/* Mobile Profile Menu */
.mobile-profile-menu {
    position: fixed;
    bottom: 90px;
    left: 16px;
    right: 16px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 16px;
    z-index: 250;
    display: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.mobile-profile-menu.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.mobile-profile-menu-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.mobile-profile-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-profile-menu-info {
    display: flex;
    flex-direction: column;
}

.mobile-profile-menu-username {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.mobile-profile-menu-name {
    font-size: 13px;
    color: var(--text-secondary);
}

.mobile-profile-menu-items {
    display: flex;
    flex-direction: column;
}

.mobile-profile-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 12px;
}

.mobile-profile-menu-item:hover {
    background: var(--bg-tertiary);
}

.mobile-profile-menu-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.mobile-profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.mobile-profile-logout {
    color: #ff3b30 !important;
}

.mobile-profile-logout svg {
    color: #ff3b30 !important;
}

.mobile-profile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 240;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-profile-overlay.show {
    display: block;
    opacity: 1;
}

/* Mobile Theme Toggle */
.mobile-profile-menu-theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 8px;
    border-radius: 12px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.mobile-profile-menu-theme:hover {
    background: var(--bg-tertiary);
}

.mobile-theme-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-theme-info svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.mobile-theme-info span {
    font-size: 15px;
    color: var(--text-primary);
    margin-right: 12px;
}

.mobile-theme-toggle {
    position: relative;
    width: 50px;
    height: 28px;
    background: var(--text-tertiary);
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.mobile-theme-toggle.active {
    background: var(--accent);
}

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

.mobile-theme-toggle.active .mobile-theme-slider {
    transform: translateX(22px);
}

/* Tablet */
@media (min-width: 1101px) {
    .sidebar-profile-card {
        display: flex;
    }
}

@media (max-width: 1100px) {
    .sidebar, .right-sidebar {
        display: none;
    }
    .app {
        padding: 16px;
        justify-content: center;
    }
}

/* Mobile */
@media (max-width: 640px) {
    body {
        background: var(--bg-primary);
    }
    .app {
        display: block;
        padding: 8px;
        padding-top: 56px;
        padding-bottom: 90px;
        max-width: 100% !important;
        gap: 0;
    }
    .sidebar, .right-sidebar {
        display: none !important;
    }
    .mobile-header {
        display: flex;
    }
    .mobile-bottom-nav {
        display: block;
    }
    .main {
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
        margin: 0;
    }
    .stories-container {
        border-radius: 20px !important;
        margin-bottom: 10px;
        border: 1px solid var(--border) !important;
        padding: 16px;
        box-shadow: var(--shadow);
    }
    .stories-scroll {
        padding: 0;
    }
    .story-ring {
        width: 64px;
        height: 64px;
    }
    .story-name {
        max-width: 64px;
        font-size: 11px;
    }
    .create-post-card {
        display: none;
    }
    .post {
        border-radius: 20px !important;
        border: 1px solid var(--border) !important;
        margin-bottom: 4px;
        box-shadow: var(--shadow) !important;
    }
 .post-header {
 padding:10px12px;
 gap:6px;
 display:flex;
 align-items:center;
 justify-content:space-between;
 }
 .post-user {
 flex:1;
 min-width:0;
 gap:8px;
 }
 .post-avatar {
 width:32px;
 height:32px;
 flex-shrink:0;
 }
 .post-info {
 min-width:0;
 flex:1;
 }
 .post-username {
 font-size:13px;
 max-width:80px;
 white-space:nowrap;
 overflow:hidden;
 text-overflow:ellipsis;
 display:inline-block;
 }
 .post-location {
 font-size:11px;
 max-width:60px;
 white-space:nowrap;
 overflow:hidden;
 text-overflow:ellipsis;
 display:inline-block;
 }
 .post-follow-btn {
 padding:4px8px!important;
 font-size:10px;
 flex-shrink:0;
 min-width:auto;
 }
 .post-menu {
 padding:2px!important;
 flex-shrink:0;
 }
 .post-menu svg {
 width:16px;
 height:16px;
 }
 .post-menu-wrapper {
 flex-shrink:0;
 }
 .post-actions {
        padding: 14px 16px;
    }
    .post-actions-left {
        gap: 16px;
    }
    .action-btn svg {
        width: 26px;
        height: 26px;
    }
    .post-likes {
        padding: 0 16px 8px;
        font-size: 14px;
    }
    .post-caption-top {
        padding: 8px 16px 10px;
        font-size: 14px;
    }
    .post-caption {
        padding: 0 16px 12px;
        font-size: 14px;
    }
    .post-comments {
        padding: 0 16px 12px;
        font-size: 14px;
    }
    .post-time {
        padding: 0 16px 16px;
        font-size: 12px;
    }
    .story-ring {
        width: 56px;
        height: 56px;
    }
    .story-name {
        max-width: 56px;
        font-size: 10px;
    }
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    .modal-content {
        max-width: 100%;
        max-height: 90vh;
        border-radius: 24px 24px 0 0;
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-textarea {
        min-height: 100px;
    }
    .modal-footer {
        padding: 12px 16px;
    }
}

/* Legal Pages */
.legal-page {
    min-height: 100vh;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.legal-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.legal-header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.legal-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 16px;
    transition: color 0.2s ease;
}

.legal-back:hover {
    color: var(--accent);
}

.legal-title {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    line-height: 1.2;
}

.legal-updated {
    color: var(--text-secondary);
    font-size: 14px;
}

.legal-content {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.legal-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.legal-section h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.legal-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 8px;
}

.legal-section p {
    line-height: 1.6;
    color: var(--text-primary);
}

.legal-section ul,
.legal-section ol {
    margin-left: 24px;
    line-height: 1.6;
}

.legal-section li {
    margin-bottom: 8px;
}

.legal-section a {
    color: var(--accent);
    text-decoration: none;
}

.legal-section a:hover {
    text-decoration: underline;
}

.legal-section strong {
    font-weight: 600;
}

.legal-section code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.legal-table th,
.legal-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.legal-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
}

.legal-table tr:last-child td {
    border-bottom: none;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 12px;
}

.faq-item summary {
    padding: 16px;
    cursor: pointer;
    font-weight: 600;
    background: var(--bg-card);
    transition: background 0.2s ease;
}

.faq-item summary:hover {
    background: var(--bg-tertiary);
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item[open] summary {
    border-bottom: 1px solid var(--border);
}

.faq-item p,
.faq-item ul,
.faq-item ol {
    padding: 16px;
    margin: 0;
}

.legal-footer {
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.legal-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.legal-footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
}

.legal-footer-links a:hover {
    color: var(--text-primary);
}

.legal-footer-copyright {
    color: var(--text-secondary);
    font-size: 14px;
}

@media (max-width: 640px) {
    .legal-container {
        padding: 16px;
    }

    .legal-title {
        font-size: 24px;
    }

    .legal-section h2 {
        font-size: 20px;
    }

    .legal-section h3 {
        font-size: 16px;
    }

    .legal-footer-links {
        flex-direction: column;
        gap: 12px;
    }

    .legal-table {
        font-size: 14px;
    }

    .legal-table th,
    .legal-table td {
        padding: 8px;
    }
}
