/**
 * AskGangnam - Fresh & Light Reddit-Style Design
 */

/* ===== Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
:root {
    /* Reddit Colors */
    --primary: #0079D3;
    --primary-hover: #006CBD;
    --primary-light: #E8F4FC;

    /* Accent (alias for primary) */
    --accent: #0079D3;
    --accent-hover: #006CBD;

    /* Upvote/Downvote colors - Reddit exact */
    --upvote: #FF4500;
    --downvote: #7193FF;

    --success: #46D160;
    --warning: #FFB800;
    --danger: #EA0027;

    /* Reddit Page Background - exact color */
    --bg-page: #DAE0E6;

    /* Card/Widget backgrounds */
    --bg-primary: #DAE0E6;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #F6F7F8;
    --bg-hover: rgba(0,0,0,0.04);

    /* Text Colors - Reddit exact */
    --text-primary: #1C1C1C;
    --text-secondary: #576F76;
    --text-tertiary: #878A8C;
    --text-link: #0079D3;

    /* Border - Reddit style */
    --border-color: #EDEFF1;
    --border-hover: #898989;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 6px rgba(0,0,0,0.1);
    --shadow-card: 0 2px 4px rgba(0,0,0,0.04);

    /* Radius - Reddit uses 4px mostly */
    --radius-sm: 4px;
    --radius-md: 4px;
    --radius-lg: 8px;
    --radius-full: 9999px;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 12px;
    --space-lg: 16px;
    --space-xl: 24px;

    /* Typography - Reddit uses IBM Plex Sans */
    --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
    --bg-primary: #030303;
    --bg-secondary: #1A1A1B;
    --bg-tertiary: #272729;
    --bg-hover: #343536;

    --text-primary: #D7DADC;
    --text-secondary: #818384;
    --text-tertiary: #6A6C6E;
    --text-link: #4FBCFF;

    --border-color: #343536;
    --border-hover: #545456;

    --accent: #4FBCFF;
    --accent-hover: #3BA8E8;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: #DAE0E6;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--text-link);
}

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

button, input, textarea, select {
    font-family: inherit;
    font-size: inherit;
}

/* ===== 3-Column Layout (Reddit Style) ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 48px;
}

/* Left Sidebar */
.left-sidebar {
    width: 270px;
    flex-shrink: 0;
    position: fixed;
    top: 48px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
    transition: width 0.2s ease;
}

.left-sidebar.collapsed {
    width: 48px;
    overflow: hidden;
}

.left-sidebar.collapsed .sidebar-section,
.left-sidebar.collapsed .sidebar-divider {
    display: none;
}

.left-sidebar.collapsed .sidebar-collapse-btn {
    position: static;
    width: 32px;
    height: 32px;
    margin: 8px auto;
    display: flex;
    background: transparent;
}

/* Main Content Wrapper - Centered like Reddit */
.main-wrapper {
    margin-left: 270px;
    width: calc(100% - 270px);
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 20px 24px;
    transition: margin-left 0.2s ease, width 0.2s ease;
}

.left-sidebar.collapsed ~ .main-wrapper {
    margin-left: 48px;
    width: calc(100% - 48px);
}

.main-content {
    width: 100%;
    max-width: 640px;
    min-width: 0;
    flex-shrink: 1;
}

/* Right Sidebar */
.right-sidebar {
    width: 312px;
    flex-shrink: 0;
    position: sticky;
    top: 68px;
    height: fit-content;
    max-height: calc(100vh - 88px);
    overflow-y: auto;
    align-self: flex-start;
}

/* Hide scrollbar but keep functionality */
.left-sidebar::-webkit-scrollbar,
.right-sidebar::-webkit-scrollbar {
    width: 4px;
}

.left-sidebar::-webkit-scrollbar-thumb,
.right-sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 2px;
}

.right-sidebar::-webkit-scrollbar {
    width: 0;
}

@media (max-width: 1200px) {
    .right-sidebar {
        display: none;
    }
    .main-content {
        max-width: 800px;
    }
}

/* Tablet view - sidebar still visible, main content adjusts */
@media (max-width: 1024px) {
    .main-wrapper {
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .main-content {
        max-width: 700px;
    }
}

@media (max-width: 960px) {
    .left-sidebar {
        width: 270px;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .left-sidebar.collapsed {
        width: 270px;
        transform: translateX(-100%);
    }
    .left-sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
    .left-sidebar.collapsed ~ .main-wrapper {
        margin-left: 0;
    }
}

/* ===== Header (Light Style) ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: #FFFFFF;
    border-bottom: 1px solid #EDEFF1;
    height: 48px;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.header-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 700;
    font-size: 18px;
    color: var(--text-primary);
    flex-shrink: 0;
}

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

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #FF4500 0%, #FF6B35 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 12px;
}

/* Search in Header */
.search-container {
    flex: 1;
    max-width: 600px;
    margin: 0 var(--space-lg);
}

.search-form {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 40px;
    padding: 0 16px 0 44px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-input:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

.search-input:focus {
    background: #FFFFFF;
    border-color: var(--primary);
    outline: none;
}

.search-btn {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 0;
    display: flex;
}

/* Header Nav */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-left: auto;
    flex-shrink: 0;
}

.header-nav .btn {
    font-size: 14px;
    font-weight: 600;
}

/* ===== Left Sidebar (Light Style) ===== */
.left-sidebar {
    background: #FFFFFF;
    border-radius: 0;
    padding: 0;
    border-right: 1px solid var(--border-color);
}

/* Sidebar collapse toggle button */
.sidebar-collapse-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .left-sidebar {
    background: #1A1A1B;
    border-color: #343536;
}

.sidebar-section {
    padding: 0 var(--space-md);
    margin-bottom: var(--space-md);
}

.sidebar-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    padding: var(--space-sm) var(--space-sm);
    margin-bottom: 0;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav-item {
    margin-bottom: 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 10px var(--space-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 400;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.sidebar-nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav-link.active {
    background: var(--bg-hover);
    color: var(--primary);
    font-weight: 500;
}

.sidebar-nav-link svg,
.sidebar-nav-link .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    color: var(--text-secondary);
}

.community-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #FF4500 0%, #FF6B35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: var(--space-md) var(--space-md);
}

.sidebar-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
}

.sidebar-title-row:hover {
    background: var(--bg-hover);
}

.sidebar-expand-icon {
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.sidebar-section.collapsed .sidebar-expand-icon {
    transform: rotate(-90deg);
}

.section-content {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
}

.topic-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    display: inline-block;
}

/* Flair items in sidebar */
.sidebar-flairs .sidebar-nav-link {
    padding: 6px var(--space-sm);
}

/* ===== Main Content ===== */
/* Layout handled in .app-layout section */

/* ===== Community Header Banner ===== */
.community-header {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.community-banner {
    height: 150px;
    background: linear-gradient(135deg, #33A8FF 0%, #0079D3 50%, #005AA7 100%);
    position: relative;
}

.community-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.community-info {
    display: flex;
    align-items: flex-end;
    gap: var(--space-lg);
    padding: 0 var(--space-xl);
    margin-top: -40px;
    position: relative;
}

.community-avatar {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    border: 4px solid var(--bg-secondary);
    background: linear-gradient(135deg, #FF4500 0%, #FF6B35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.community-avatar img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.community-details {
    flex: 1;
    padding-bottom: var(--space-lg);
}

.community-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.community-handle {
    font-size: 14px;
    color: var(--text-tertiary);
}

.community-actions {
    display: flex;
    gap: var(--space-sm);
    padding-bottom: var(--space-lg);
}

/* ===== Featured Posts Carousel ===== */
.featured-section {
    margin-bottom: var(--space-lg);
}

.featured-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: 0 var(--space-sm);
}

.featured-header svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.featured-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.featured-carousel {
    display: flex;
    gap: var(--space-md);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    scrollbar-width: thin;
}

.featured-carousel::-webkit-scrollbar {
    height: 6px;
}

.featured-carousel::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.featured-carousel::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.featured-card {
    flex-shrink: 0;
    width: 160px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.featured-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.featured-card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.featured-card-meta {
    font-size: 11px;
    color: var(--text-tertiary);
}

.featured-card-icon {
    width: 24px;
    height: 24px;
    margin-top: var(--space-sm);
    color: var(--success);
}

/* ===== Sort Tabs ===== */
.sort-tabs {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.sort-tab {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-tertiary);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.sort-tab:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sort-tab.active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Post Card ===== */
.post-card {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    transition: all var(--transition-fast);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.post-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-md);
}

/* Vote Section */
.vote-section,
.vote-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    min-width: 40px;
}

.vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.vote-btn:hover {
    background: var(--bg-hover);
}

.vote-btn.upvote:hover,
.vote-btn.upvote.active {
    color: var(--upvote);
    background: rgba(255, 69, 0, 0.1);
}

.vote-btn.downvote:hover,
.vote-btn.downvote.active {
    color: var(--downvote);
    background: rgba(113, 147, 255, 0.1);
}

.vote-score {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--space-xs) 0;
}

/* Post Content */
.post-content {
    flex: 1;
    padding: var(--space-md);
    min-width: 0;
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-xs);
}

.flair {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.post-title a {
    color: inherit;
}

.post-title a:hover {
    color: var(--accent);
}

.post-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-xs);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.subreddit-name {
    font-weight: 700;
    color: var(--text-primary);
}

.subreddit-name:hover {
    text-decoration: underline;
}

.post-by {
    color: var(--text-tertiary);
}

.post-author {
    color: var(--text-tertiary);
}

.post-author:hover {
    text-decoration: underline;
    color: var(--text-primary);
}

.post-time {
    color: var(--text-tertiary);
}

.post-dot {
    color: var(--text-tertiary);
}

.post-thumbnail {
    width: 140px;
    height: 100px;
    flex-shrink: 0;
    margin: var(--space-md);
    margin-left: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-tertiary);
}

.post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Post Actions */
.post-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.post-action,
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.post-action:hover,
.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ===== Right Sidebar ===== */
/* Base sidebar styling - layout handled in .app-layout section */
.right-sidebar {
    background: transparent;
    padding: 0;
}

.widget {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.widget-header {
    padding: var(--space-md) var(--space-lg);
    background: var(--primary);
    color: white;
}

.widget-title {
    font-size: 14px;
    font-weight: 600;
    color: white;
    margin: 0;
}

.widget-content {
    padding: var(--space-lg);
}

.widget-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

/* Rules List */
.rules-list {
    list-style: none;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.rule-item:last-child {
    border-bottom: none;
}

.rule-number {
    font-weight: 700;
    color: var(--text-tertiary);
    min-width: 20px;
}

.rule-text {
    flex: 1;
}

.rule-expand {
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 12px;
    transition: transform var(--transition-fast);
}

.rule-header {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    padding: var(--space-md);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.rule-header:hover {
    background: var(--bg-hover);
}

.rule-detail {
    display: none;
    padding: var(--space-xs) var(--space-md) var(--space-md) 36px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.6;
    background: var(--bg-tertiary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    margin-top: -4px;
}

.rule-detail.show {
    display: block;
}

/* Flair List */
.flair-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.flair-link {
    display: inline-block;
}

/* Posting Schedule */
.schedule-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

.schedule-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.schedule-info {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.schedule-day {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin: var(--space-md) 0 var(--space-xs);
}

.schedule-item {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: var(--space-md);
    position: relative;
}

.schedule-item::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--text-tertiary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 12px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Notification Badge */
.notification-btn {
    position: relative;
}

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

/* ===== Avatar Utilities ===== */
.avatar-xs,
.avatar-sm,
.avatar-md,
.avatar-lg {
    border-radius: var(--radius-full);
    object-fit: cover;
    display: inline-block;
    vertical-align: middle;
}

.avatar-xs { width: 20px; height: 20px; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-md { width: 36px; height: 36px; }
.avatar-lg { width: 48px; height: 48px; }

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

/* ===== Submit Page ===== */
.submit-page {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--border-color);
}

.submit-page h1 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-lg);
    color: var(--text-primary);
}

/* Post Type Tabs */
.type-tabs {
    display: flex;
    gap: 0;
    margin-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.type-tab {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.type-tab:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.type-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.type-tab svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Submit Form */
.submit-form .form-group {
    margin-bottom: var(--space-lg);
}

.submit-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.submit-form .form-group input,
.submit-form .form-group textarea,
.submit-form .form-group select {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.submit-form .form-group input:focus,
.submit-form .form-group textarea:focus,
.submit-form .form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.char-counter {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    text-align: right;
    margin-top: var(--space-xs);
}

.help-text {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* ===== Auth Content (Login/Register in Main Layout) ===== */
.auth-content {
    display: flex;
    justify-content: center;
    padding: var(--space-xl) 0;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.login-card-title {
    font-size: 20px;
    font-weight: 700;
    color: #1c1c1c;
    text-align: center;
    margin-bottom: 8px;
}

.login-card-subtitle {
    font-size: 12px;
    color: #7c7c7c;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

.login-card-subtitle a {
    color: #0079D3;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form .form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #1c1c1c;
    margin-bottom: 8px;
}

.login-form .form-input {
    width: 100%;
    padding: 12px;
    background: #F6F7F8;
    border: 1px solid #EDEFF1;
    border-radius: 4px;
    font-size: 14px;
    color: #1c1c1c;
    transition: all 0.2s;
}

.login-form .form-input:focus {
    outline: none;
    background: #FFFFFF;
    border-color: #0079D3;
}

.login-form .form-input.error {
    border-color: #FF4500;
}

.login-form .form-error {
    display: block;
    font-size: 12px;
    color: #FF4500;
    margin-top: 4px;
}

.forgot-link {
    display: block;
    font-size: 12px;
    color: #0079D3;
    margin-bottom: 16px;
}

.login-footer-text {
    text-align: center;
    font-size: 13px;
    color: #7c7c7c;
    margin-top: 16px;
}

.login-footer-text a {
    color: #0079D3;
    font-weight: 600;
}

.btn-block {
    width: 100%;
}

/* Social Login Buttons */
.social-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.social-login-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: #F6F7F8;
    border: 1px solid #EDEFF1;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    color: #1c1c1c;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.social-login-btn:hover {
    background: #EDEFF1;
}

.social-login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.social-login-btn .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-login-btn .text {
    flex: 1;
    text-align: center;
}

.social-login-btn.google {
    background: #FFFFFF;
    border-color: #DADCE0;
}

.social-login-btn.google:hover {
    background: #F8F9FA;
}

.social-login-btn.kakao {
    background: #FEE500;
    border-color: #FEE500;
    color: #000000;
}

.social-login-btn.kakao:hover {
    background: #FADA0A;
}

/* Login Divider */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #EDEFF1;
}

.login-divider span {
    font-size: 12px;
    color: #7c7c7c;
    font-weight: 600;
}

/* Checkbox Label */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: #7c7c7c;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: #FF4500;
    cursor: pointer;
}

.checkbox-label a {
    color: #0079D3;
}

/* ===== Alerts ===== */
.alert {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 14px;
}

.alert-success {
    background: rgba(70, 209, 96, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
}

.alert-error {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
}

/* ===== Pagination ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    padding: var(--space-xl) 0;
}

.pagination-btn {
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-weight: 500;
    color: var(--accent);
    transition: all var(--transition-fast);
}

.pagination-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-tertiary);
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-tertiary); }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .post-card {
        flex-direction: column;
    }

    .vote-section,
    .vote-buttons {
        flex-direction: row;
        padding: var(--space-sm) var(--space-md);
    }

    .community-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .community-actions {
        justify-content: center;
    }
}

/* ===== Create Post ===== */
.create-post {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-xl);
}

.create-post h1 {
    margin-bottom: var(--space-xl);
}

.flair-select {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.flair-option {
    display: none;
}

.flair-label {
    display: inline-flex;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.flair-option:checked + .flair-label {
    border-color: var(--accent);
    background: rgba(123, 92, 245, 0.1);
}

/* ===== Profile ===== */
.profile-header {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.profile-banner {
    height: 150px;
    background: linear-gradient(135deg, var(--accent) 0%, #EC4899 100%);
}

.profile-info {
    padding: var(--space-xl);
    padding-top: 60px;
    position: relative;
}

.profile-avatar {
    position: absolute;
    top: -50px;
    left: var(--space-xl);
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent) 0%, #EC4899 100%);
    border: 4px solid var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
    font-weight: 700;
}

/* ===== Footer ===== */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-xl) 0;
    margin-top: var(--space-2xl);
}

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

.footer-links {
    display: flex;
    gap: var(--space-lg);
}

.footer-links a {
    font-size: 12px;
    color: var(--text-tertiary);
}

.footer-copyright {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Container adjustments for 3-column layout */
.container {
    max-width: 100%;
    padding: 0;
}

.content-layout {
    display: block;
}

.content-main {
    margin-right: 328px;
}

@media (max-width: 1200px) {
    .content-main {
        margin-right: 0;
    }
}

.sidebar {
    display: none;
}

/* ===== Post Detail Page ===== */
.post-detail-card {
    display: flex;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    overflow: hidden;
}

.post-detail-vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    min-width: 50px;
}

.vote-score-lg {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: var(--space-sm) 0;
}

.post-detail-main {
    flex: 1;
    padding: var(--space-lg);
}

.post-detail-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.post-author-link {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: 500;
    color: var(--text-secondary);
}

.post-author-link:hover {
    text-decoration: underline;
    color: var(--text-primary);
}

.post-detail-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    line-height: 1.3;
}

.post-detail-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.post-body {
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
}

.post-body h2, .post-body h3, .post-body h4 {
    font-weight: 700;
    margin: var(--space-lg) 0 var(--space-sm);
}

.post-images {
    margin-bottom: var(--space-lg);
}

.post-image {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.post-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.action-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-item:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Comments Section */
.comments-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

.comments-count {
    font-size: 16px;
    font-weight: 600;
}

.comments-sort {
    display: flex;
    gap: var(--space-md);
}

.sort-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.sort-link:hover,
.sort-link.active {
    color: var(--accent);
}

.comment-form {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.comment-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.comment-input-wrapper textarea {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
}

.comment-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.comment-input-wrapper button {
    align-self: flex-end;
}

.login-prompt {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.comment-input-disabled {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-tertiary);
    cursor: not-allowed;
}

.locked-notice {
    padding: var(--space-lg);
    text-align: center;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
}

.comments-list {
    padding: var(--space-lg);
}

/* Comment Item */
.comment-item {
    padding: var(--space-md) 0;
}

.comment-item + .comment-item {
    border-top: 1px solid var(--border-color);
}

.comment-vote {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-sm);
}

.comment-vote .vote-btn {
    width: 20px;
    height: 20px;
}

.comment-vote .vote-score {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 30px;
    text-align: center;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.comment-author {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.comment-author:hover {
    text-decoration: underline;
    color: var(--accent);
}

.comment-time {
    font-size: 12px;
    color: var(--text-tertiary);
}

.comment-karma {
    font-size: 11px;
    color: var(--text-tertiary);
}

.comment-body {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.comment-actions {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.comment-actions .action-item {
    padding: var(--space-xs) var(--space-sm);
    font-size: 11px;
}

.comment-replies {
    margin-left: var(--space-xl);
    padding-left: var(--space-lg);
    border-left: 2px solid var(--border-color);
    margin-top: var(--space-md);
}

/* Link Preview */
.post-link-preview {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--space-lg);
}

.post-link-preview img {
    width: 120px;
    height: 80px;
    object-fit: cover;
}

.post-link-preview .link-info {
    flex: 1;
    padding: var(--space-md);
}

.post-link-preview h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.post-link-preview p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.post-link-preview span {
    font-size: 11px;
    color: var(--text-tertiary);
}

.text-danger {
    color: var(--danger) !important;
}

@media (max-width: 768px) {
    .post-detail-card {
        flex-direction: column;
    }

    .post-detail-vote {
        flex-direction: row;
        justify-content: center;
        padding: var(--space-md);
    }

    .vote-score-lg {
        margin: 0 var(--space-md);
    }
}

/* ===== Profile Page ===== */
.profile-page {
    min-height: 100vh;
}

.profile-header-section {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.profile-header-banner {
    height: 150px;
    background-size: cover;
    background-position: center;
}

.profile-header-content {
    display: flex;
    align-items: flex-end;
    gap: var(--space-lg);
    padding: 0 var(--space-xl);
    transform: translateY(-40px);
    margin-bottom: -40px;
}

.profile-avatar-wrapper {
    position: relative;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--bg-secondary);
    object-fit: cover;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
}

.avatar-edit-btn:hover {
    background: var(--bg-tertiary);
}

.profile-header-info {
    padding-bottom: var(--space-md);
}

.profile-display-name {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.profile-username-text {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Profile Tabs */
.profile-tabs-wrapper {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 var(--space-xl);
}

.profile-tabs-nav {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
}

.profile-tab-link {
    padding: var(--space-md) var(--space-lg);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.profile-tab-link:hover {
    color: var(--text-primary);
}

.profile-tab-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Profile Content */
.profile-content-wrapper {
    display: grid;
    grid-template-columns: 1fr 312px;
    gap: var(--space-lg);
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-lg);
}

.profile-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.profile-filter-bar {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.profile-filter-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
}

.profile-filter-btn:hover {
    border-color: var(--border-hover);
}

.profile-filter-dropdown {
    position: relative;
}

.profile-filter-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 100;
    display: none;
}

.profile-filter-menu.show {
    display: block;
}

.profile-filter-menu .filter-option {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    font-size: 13px;
    text-decoration: none;
    transition: background var(--transition-fast);
}

.profile-filter-menu .filter-option:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.profile-filter-menu .filter-option:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.profile-filter-menu .filter-option:hover {
    background: var(--bg-tertiary);
}

.profile-filter-menu .filter-option.active {
    background: var(--accent);
    color: white;
}

.profile-filter-menu .filter-option.active svg {
    stroke: white;
}

.profile-create-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.profile-create-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
}

.profile-create-btn:hover {
    border-color: var(--border-hover);
}

.profile-filter-icon {
    margin-left: auto;
    padding: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
}

.profile-filter-icon:hover {
    background: var(--bg-tertiary);
}

/* Profile Empty State */
.profile-empty-state {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-2xl);
    text-align: center;
}

.profile-empty-state .empty-illustration {
    margin-bottom: var(--space-lg);
}

.profile-empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.profile-empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: var(--space-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Profile Sidebar Card */
.profile-sidebar {
    position: sticky;
    top: 70px;
    height: fit-content;
}

.profile-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.profile-card-banner {
    height: 80px;
    position: relative;
}

.profile-card-avatar {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--bg-secondary);
    object-fit: cover;
}

.profile-card-body {
    padding: 40px var(--space-lg) var(--space-lg);
}

.profile-card-name {
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-md);
}

.btn-outline-full,
.btn-primary-full {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-outline-full {
    background: transparent;
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
}

.btn-outline-full:hover {
    background: var(--bg-tertiary);
}

.btn-primary-full {
    background: var(--accent);
    border: none;
    color: white;
}

.btn-primary-full:hover {
    background: var(--accent-hover);
}

.profile-stats-grid {
    display: flex;
    justify-content: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
    margin: var(--space-md) 0;
}

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

.stat-number {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.stat-text {
    font-size: 12px;
    color: var(--text-tertiary);
}

.profile-karma-section {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.karma-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.karma-row.single {
    grid-template-columns: 1fr;
}

.karma-row:last-child {
    margin-bottom: 0;
}

.karma-item {
    text-align: left;
}

.karma-value {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.karma-label {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Profile Achievements */
.profile-achievements {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.achievements-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-sm);
}

.achievements-list {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.achievement-badge {
    width: 32px;
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.achievements-unlock {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

.view-all-link {
    color: var(--accent);
    font-weight: 600;
}

/* Profile Settings Section */
.profile-settings-section {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-color);
}

.settings-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.settings-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.settings-item-icon {
    flex-shrink: 0;
}

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

.settings-item-icon svg {
    width: 32px;
    height: 32px;
    color: var(--text-tertiary);
}

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

.settings-item-title {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

.settings-item-desc {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.btn-sm.btn-dark {
    padding: var(--space-xs) var(--space-md);
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Profile Social Section */
.profile-social-section {
    padding: var(--space-md) 0;
}

.social-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: var(--space-md);
}

.add-social-btn {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-social-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Login Modal ===== */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.login-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-modal {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.login-modal-overlay.active .login-modal {
    transform: scale(1);
}

.login-modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-secondary);
}

.login-modal-close:hover {
    background: var(--border-color);
}

.login-modal-content {
    padding: var(--space-2xl);
}

.login-modal-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: var(--space-sm);
}

.login-modal-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--space-xl);
    line-height: 1.5;
}

.login-modal-subtitle a {
    color: var(--accent);
    text-decoration: underline;
}

/* Login Form Fields - Old modal styles, keeping for backward compatibility */
.login-form-fields {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.login-input-group {
    position: relative;
}

.login-input {
    width: 100%;
    padding: var(--space-lg) var(--space-md) var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent);
}

.login-input-label {
    position: absolute;
    top: var(--space-sm);
    left: var(--space-md);
    font-size: 11px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.login-input-label .required {
    color: var(--danger);
}

.forgot-password-link {
    display: block;
    font-size: 12px;
    color: var(--accent);
    margin-top: var(--space-sm);
}

.login-footer {
    margin-top: var(--space-lg);
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--accent);
    font-weight: 600;
}

/* Form Checkbox */
.form-checkbox {
    margin: var(--space-md) 0;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-label a {
    color: var(--accent);
}

.login-submit-btn {
    width: 100%;
    padding: var(--space-md);
    background: var(--accent);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: var(--space-md);
    transition: background var(--transition-fast);
}

.login-submit-btn:hover {
    background: var(--accent-hover);
}

.login-submit-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
}

/* ===== Auth Layout (Standalone Login/Register) ===== */
.auth-body {
    background: #DAE0E6;
    min-height: 100vh;
}

.auth-body .auth-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: #FFFFFF;
    border-bottom: 1px solid #EDEFF1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.auth-header .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
}

.auth-header .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.auth-header .logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Auth Page (Full Page Login/Register) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #DAE0E6;
    padding: 24px;
    padding-top: 72px;
}

.auth-page .login-modal-title {
    color: #1c1c1c;
}

.auth-page .login-modal-subtitle {
    color: #7c7c7c;
}

.auth-page .login-modal-subtitle a {
    color: #0079D3;
}

.auth-page .login-input-label {
    color: #1c1c1c;
}

.auth-page .login-footer {
    color: #7c7c7c;
}

.auth-page .login-footer a {
    color: #0079D3;
}

.auth-page .forgot-password-link {
    color: #0079D3;
}

.auth-page .login-submit-btn {
    background: #FF4500;
    color: white;
}

.auth-page .login-submit-btn:hover {
    background: #FF5414;
}

.auth-page .login-modal-container {
    width: 100%;
    max-width: 400px;
}

.auth-page .login-modal {
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    transform: none;
    background: #FFFFFF;
}

.auth-page .login-input {
    background: #F6F7F8;
    color: #1c1c1c;
    border: 1px solid #EDEFF1;
}

.auth-page .login-input:focus {
    background: #FFFFFF;
    border-color: #0079D3;
    box-shadow: none;
    outline: none;
}

.auth-page .login-input.error {
    border-color: var(--danger);
}

.auth-page .error-message {
    display: block;
    font-size: 12px;
    color: var(--danger);
    margin-top: var(--space-xs);
}

/* Coming Soon Badge for Social Login */
.coming-soon-badge {
    font-size: 10px;
    background: var(--text-tertiary);
    color: white;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: auto;
    font-weight: 500;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-icon {
    font-size: 20px;
}

.toast-message {
    font-size: 14px;
    color: var(--text-primary);
}

/* ===== Chat Panel ===== */
.chat-panel {
    position: fixed;
    bottom: 0;
    right: var(--space-xl);
    width: 320px;
    height: 450px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 999;
    transform: translateY(calc(100% - 48px));
    transition: transform var(--transition-normal);
}

.chat-panel.open {
    transform: translateY(0);
}

.chat-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: pointer;
}

.chat-panel-title {
    font-size: 14px;
    font-weight: 600;
}

.chat-panel-actions {
    display: flex;
    gap: var(--space-sm);
}

.chat-panel-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
}

.chat-panel-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-message {
    max-width: 80%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.4;
}

.chat-message.incoming {
    background: var(--bg-tertiary);
    align-self: flex-start;
    border-bottom-left-radius: var(--radius-sm);
}

.chat-message.outgoing {
    background: var(--accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-skeleton {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-skeleton-message {
    height: 32px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.chat-skeleton-message:nth-child(odd) {
    width: 60%;
    align-self: flex-start;
}

.chat-skeleton-message:nth-child(even) {
    width: 70%;
    align-self: flex-end;
}

@keyframes skeleton-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.chat-panel-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    padding: var(--space-xs) var(--space-sm);
}

.chat-input {
    flex: 1;
    padding: var(--space-sm);
    background: none;
    border: none;
    font-size: 13px;
}

.chat-input:focus {
    outline: none;
}

.chat-input::placeholder {
    color: var(--text-tertiary);
}

.chat-send-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

/* Chat Conversations List */
.chat-conversations-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.chat-conversation-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.chat-conversation-item:hover {
    background: var(--bg-hover);
}

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

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

.chat-conv-name {
    display: block;
    font-weight: 500;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-conv-preview {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread-badge {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Chat Messages View */
.chat-messages-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-md);
}

.chat-back-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
}

.chat-back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-partner-name {
    font-weight: 600;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
}

.chat-message {
    max-width: 80%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 13px;
    line-height: 1.4;
}

.chat-message.theirs {
    background: var(--bg-tertiary);
    align-self: flex-start;
    border-bottom-left-radius: var(--radius-sm);
}

.chat-message.mine {
    background: var(--accent);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message-content {
    word-break: break-word;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-loading,
.chat-empty,
.chat-error {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    padding: var(--space-xl) var(--space-md);
}

.chat-error {
    color: var(--danger);
}

/* Profile Comment Item */
.profile-comment-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.comment-context {
    margin-bottom: var(--space-sm);
}

.comment-post-link {
    font-weight: 600;
    color: var(--text-primary);
}

.comment-post-link:hover {
    text-decoration: underline;
}

.comment-meta {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--space-xs);
}

.comment-body-preview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-sm);
}

.comment-stats {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* Social Links */
.social-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.social-link-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.social-link-item:hover {
    background: var(--accent);
    color: white;
}

.social-link-item svg {
    flex-shrink: 0;
}

.social-link-item-editable {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    font-size: 12px;
    margin-bottom: var(--space-xs);
    width: 100%;
}

.social-link-item-editable .social-link-content {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-secondary);
}

.social-link-item-editable .social-link-content svg {
    flex-shrink: 0;
}

.social-link-actions {
    display: flex;
    gap: 2px;
}

.social-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.social-action-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.social-action-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.social-action-btn.social-action-delete:hover {
    background: var(--danger);
    color: white;
}

.add-social-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.add-social-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-lg);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

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

.modal-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-close-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* Form Components */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.form-label .required {
    color: var(--danger);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
}


/* Btn variants */
.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Responsive Profile */
@media (max-width: 968px) {
    .profile-content-wrapper {
        grid-template-columns: 1fr;
    }

    .profile-sidebar {
        position: static;
    }
}

@media (max-width: 640px) {
    .profile-header-content {
        padding: 0 var(--space-md);
    }

    .profile-tabs-wrapper {
        padding: 0 var(--space-md);
    }

    .profile-tabs-nav {
        gap: 0;
    }

    .profile-tab-link {
        padding: var(--space-md);
        font-size: 13px;
    }

    .chat-panel {
        right: 0;
        width: 100%;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }
}


/* ===== Site Footer ===== */
.site-footer {
    margin-left: 256px;
    margin-right: 316px;
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-inner {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-md);
}

.footer-links a {
    color: var(--text-tertiary);
    font-size: 12px;
    transition: color var(--transition-fast);
}

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

.footer-copy {
    color: var(--text-tertiary);
    font-size: 11px;
}

@media (max-width: 1024px) {
    .site-footer {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    .site-footer {
        margin-left: 0;
    }
}

/* ===== Chat Panel Enhanced ===== */
.chat-unread-badge {
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    margin-left: var(--space-sm);
}

.chat-conversations {
    height: 100%;
    overflow-y: auto;
}

.chat-conversation-item {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    border-bottom: 1px solid var(--border-color);
}

.chat-conversation-item:hover {
    background: var(--bg-hover);
}

.chat-conversation-item.unread {
    background: rgba(123, 92, 245, 0.05);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: var(--space-md);
    object-fit: cover;
}

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

.chat-conversation-name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.chat-conversation-preview {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread {
    background: var(--accent);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.chat-messages-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-messages-header {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chat-back-btn {
    background: none;
    border: none;
    padding: var(--space-sm);
    margin-right: var(--space-sm);
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.chat-back-btn:hover {
    background: var(--bg-hover);
}

.chat-with-user {
    font-weight: 600;
    font-size: 14px;
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.chat-message {
    max-width: 80%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--accent);
    color: white;
}

.chat-message.received {
    align-self: flex-start;
    background: var(--bg-tertiary);
}

.chat-message-content {
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.chat-loading,
.chat-empty,
.chat-error {
    padding: var(--space-xl);
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

.chat-error {
    color: var(--danger);
}

.chat-panel-footer {
    border-top: 1px solid var(--border-color);
    padding: var(--space-md);
    background: var(--bg-secondary);
}

.chat-input-wrapper {
    display: flex;
    gap: var(--space-sm);
}

.chat-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    outline: none;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.chat-send-btn:hover {
    background: var(--accent-hover);
}

/* ===== Mobile Menu ===== */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: var(--space-sm);
    margin-right: var(--space-sm);
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.mobile-menu-overlay.active {
    opacity: 1;
}

body.mobile-menu-active {
    overflow: hidden;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-menu-overlay {
        display: block;
        pointer-events: none;
    }

    .mobile-menu-overlay.active {
        pointer-events: auto;
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
        padding: var(--space-md);
        padding-top: var(--space-md);
    }

    .main-content {
        max-width: 100%;
    }

    .left-sidebar {
        position: fixed;
        top: 48px;
        left: 0;
        bottom: 0;
        width: 280px;
        max-height: none;
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        z-index: 100;
        background: var(--bg-secondary);
        display: block !important;
        border-radius: 0;
        overflow-y: auto;
    }

    .left-sidebar.mobile-open {
        transform: translateX(0);
    }

    .logo-text {
        display: none;
    }

    .header-nav .btn-ghost span {
        display: none;
    }

    .search-container {
        flex: 1;
        max-width: none;
        margin: 0 var(--space-sm);
    }

    .search-input {
        width: 100%;
    }

    .post-card {
        flex-direction: column;
    }

    .vote-buttons {
        flex-direction: row;
        padding: var(--space-sm);
        justify-content: flex-start;
        gap: var(--space-md);
    }

    .post-thumbnail {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    .community-header .community-actions {
        flex-direction: column;
        gap: var(--space-sm);
    }

    .community-info {
        flex-direction: column;
        text-align: center;
    }

    .sort-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .featured-carousel {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: var(--space-sm);
    }

    .featured-card {
        min-width: 250px;
        flex-shrink: 0;
    }

    .settings-page {
        padding: var(--space-md);
    }

    .settings-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
    }

    .profile-content-wrapper {
        flex-direction: column;
    }

    .profile-sidebar {
        order: -1;
        width: 100%;
    }

    .profile-tabs-nav {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .chat-page {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 120px);
    }

    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        max-height: 50vh;
    }

    .modal-content {
        margin: var(--space-md);
        max-height: calc(100vh - var(--space-xl));
        overflow-y: auto;
    }

    .post-detail-card {
        flex-direction: column;
    }

    .post-detail-vote {
        flex-direction: row;
        padding: var(--space-md);
        gap: var(--space-md);
    }

    .comment-input-wrapper {
        flex-direction: column;
    }

    .comment-input-wrapper button {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 0 var(--space-sm);
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
    }

    .avatar-sm {
        width: 24px;
        height: 24px;
    }

    .post-actions {
        flex-wrap: wrap;
    }

    .post-action {
        font-size: 11px;
    }

    .main-wrapper {
        padding: var(--space-sm);
    }

    .main-content {
        width: 100%;
    }

    .widget {
        margin-bottom: var(--space-md);
    }

    .widget-content {
        padding: var(--space-md);
    }

    .btn {
        padding: var(--space-sm) var(--space-md);
        font-size: 13px;
    }

    .post-card-content {
        padding: var(--space-md);
    }

    .post-title {
        font-size: 15px;
    }

    .sort-tab {
        padding: var(--space-sm) var(--space-md);
        font-size: 12px;
    }
}

/* Safe area support for modern phones */
@supports (padding: max(0px)) {
    .header {
        padding-left: max(var(--space-md), env(safe-area-inset-left));
        padding-right: max(var(--space-md), env(safe-area-inset-right));
    }

    .main-wrapper {
        padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
    }
}

/* ============================================
   Mention Dropdown Styles
   ============================================ */
.mention-dropdown {
    position: absolute;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    min-width: 200px;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mention-item:hover,
.mention-item.active {
    background: var(--bg-hover);
}

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

.mention-username {
    font-size: 14px;
    font-weight: 500;
}

/* ============================================
   Global Toast Styles
   ============================================ */
.global-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.global-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.global-toast.success {
    border-left: 4px solid #22c55e;
}

.global-toast.error {
    border-left: 4px solid var(--danger);
}

.global-toast.warning {
    border-left: 4px solid #f59e0b;
}

/* ============================================
   Posts Loader Spinner
   ============================================ */
.posts-loader {
    display: flex;
    justify-content: center;
    padding: var(--space-xl);
}

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

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

/* ============================================
   Filter & Sort Dropdown Styles
   ============================================ */
.filter-dropdown,
.sort-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    z-index: 100;
    display: none;
}

.filter-dropdown.active,
.sort-dropdown.active {
    display: block;
}

.filter-dropdown a,
.sort-dropdown a {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--transition-fast);
}

.filter-dropdown a:hover,
.sort-dropdown a:hover {
    background: var(--bg-hover);
}

.filter-dropdown a.active,
.sort-dropdown a.active {
    color: var(--accent);
    font-weight: 500;
}

/* ============================================
   Notification Badge
   ============================================ */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ============================================
   Profile Action Button Improvements
   ============================================ */
.btn-primary-full {
    background: var(--accent);
    color: white;
    border: none;
}

.btn-outline-full {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-outline-full:hover {
    background: var(--bg-hover);
}

/* ============================================
   Trending Posts Widget
   ============================================ */
.trending-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.trending-item {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

.trending-item:last-child {
    border-bottom: none;
}

.trending-rank {
    width: 24px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.trending-item:nth-child(1) .trending-rank {
    background: linear-gradient(135deg, #ffd700, #ffb700);
    color: white;
}

.trending-item:nth-child(2) .trending-rank {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: white;
}

.trending-item:nth-child(3) .trending-rank {
    background: linear-gradient(135deg, #cd7f32, #b8722a);
    color: white;
}

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

.trending-title {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trending-title:hover {
    color: var(--accent);
}

.trending-meta {
    display: flex;
    gap: var(--space-sm);
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.empty-text {
    color: var(--text-tertiary);
    font-size: 13px;
    text-align: center;
    padding: var(--space-md) 0;
}
