/* ============================================================
   湖北信息工程学校校园论坛 - 主样式表
   校园蓝 · 现代卡片风格 · 响应式布局
   ============================================================ */

/* ----------------------------------------------------------
   CSS Variables
   ---------------------------------------------------------- */
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #0f9d58;
    --warning: #f4b400;
    --danger: #db4437;
    --danger-light: #fce8e6;
    --info: #4285f4;
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;
    --white: #fff;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 4px;
    --transition: 0.2s ease;
    --max-width: 960px;
    --sidebar-width: 260px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei",
                 sans-serif;
    background: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 64px; /* 手机端底部导航留空 */
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ----------------------------------------------------------
   Top Navigation
   ---------------------------------------------------------- */
#top-nav {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.nav-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}
.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-brand:hover { text-decoration: none; color: var(--primary-dark); }
#nav-links { display: flex; align-items: center; gap: 4px; }
#nav-links a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    white-space: nowrap;
}
#nav-links a:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}
#nav-links a.active {
    background: var(--primary);
    color: var(--white);
}

/* ----------------------------------------------------------
   Main Content Area
   ---------------------------------------------------------- */
#app-main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px;
}

/* ----------------------------------------------------------
   Page Layouts
   ---------------------------------------------------------- */
.page { animation: fadeIn 0.25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 {
    font-size: 1.5rem;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Two-column layout for admin */
.two-col {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 768px) {
    .two-col { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------
   Cards
   ---------------------------------------------------------- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
    transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}
.card-title { font-size: 1.1rem; font-weight: 600; color: var(--gray-900); }
.card-meta { font-size: 0.8rem; color: var(--gray-500); }
.card-body { color: var(--gray-700); line-height: 1.7; }
.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
    gap: 8px;
}

/* Post Card */
.post-card .post-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.post-card .post-title a {
    color: var(--gray-900);
}
.post-card .post-title a:hover {
    color: var(--primary);
    text-decoration: none;
}
.post-card .post-summary {
    font-size: 0.9rem;
    color: var(--gray-600);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card .post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-card .post-tags .tag {
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

/* Comment Card */
.comment-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 10px;
}
.comment-card .comment-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
}
.comment-card .comment-time {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-left: 8px;
}
.comment-card .comment-body {
    margin-top: 6px;
    font-size: 0.92rem;
    color: var(--gray-700);
}

/* Stats Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    min-height: 82px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    word-break: break-word;
    overflow: hidden;
}
.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--gray-600);
    margin-top: 4px;
}
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.stat-clickable { cursor: pointer; }
.stat-card.stat-clickable:hover { box-shadow: var(--shadow); transform: translateY(-2px); transition: all var(--transition); }

/* ----------------------------------------------------------
   Forms
   ---------------------------------------------------------- */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gray-800);
    margin-bottom: 6px;
}
.form-group label .required { color: var(--danger); margin-left: 2px; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--gray-900);
    background: var(--white);
    transition: border-color var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}
input.input-error, textarea.input-error, select.input-error {
    border-color: var(--danger);
}

textarea { resize: vertical; min-height: 120px; }
select { cursor: pointer; }

.form-hint { font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

/* Form card */
.form-card {
    max-width: 480px;
    margin: 40px auto;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 32px;
}
.form-card h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.4rem;
    color: var(--gray-900);
}

/* ----------------------------------------------------------
   Buttons
   ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

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

.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { opacity: 0.9; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { opacity: 0.9; }

.btn-warning { background: var(--warning); color: var(--white); }
.btn-warning:hover { opacity: 0.9; }

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

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { display: flex; width: 100%; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------
   Badges & Tags
   ---------------------------------------------------------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #e6f4ea; color: var(--success); }
.badge-warning { background: #fef7e0; color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: #e8f0fe; color: var(--info); }
.badge-gray { background: var(--gray-200); color: var(--gray-600); }

.role-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
}
.role-admin { background: var(--danger-light); color: var(--danger); }
.role-teacher { background: #fef7e0; color: #e37400; }
.role-student { background: var(--primary-light); color: var(--primary); }

.status-pending { color: var(--warning); }
.status-approved { color: var(--success); }
.status-rejected { color: var(--danger); }

/* ----------------------------------------------------------
   Admin Sidebar
   ---------------------------------------------------------- */
.admin-sidebar {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: sticky;
    top: 72px;
}
.admin-sidebar a {
    display: block;
    padding: 14px 20px;
    color: var(--gray-700);
    font-size: 0.9rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
}
.admin-sidebar a:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
    border-left-color: var(--primary);
}
.admin-sidebar a.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
}

/* Mobile admin sidebar: horizontal scrollable tabs */
@media (max-width: 768px) {
    .two-col { display: flex; flex-direction: column; gap: 12px; }
    .admin-sidebar {
        position: static;
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 4px;
        border-radius: var(--radius-sm);
        background: var(--gray-100);
        box-shadow: none;
        scrollbar-width: none;
    }
    .admin-sidebar::-webkit-scrollbar { display: none; }
    .admin-sidebar a {
        display: inline-flex;
        align-items: center;
        padding: 8px 14px;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.82rem;
        flex-shrink: 0;
        border-radius: var(--radius-xs);
    }
    .admin-sidebar a:hover { border-left: none; }
    .admin-sidebar a.active {
        border-left: none;
        border-bottom-color: var(--primary);
        background: var(--white);
        border-radius: var(--radius-xs);
    }
    #admin-content { min-width: 0; overflow-x: hidden; }
}

/* ----------------------------------------------------------
   Empty State
   ---------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-500);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ----------------------------------------------------------
   Loading & Toast
   ---------------------------------------------------------- */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}
.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}
@media (max-width: 768px) {
    #toast-container {
        top: auto;
        bottom: 80px;
        right: 12px;
        left: 12px;
        max-width: none;
        align-items: center;
    }
}
.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); color: var(--gray-900); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ----------------------------------------------------------
   Announcements
   ---------------------------------------------------------- */
.announcement-banner {
    background: linear-gradient(135deg, #fff9e6, #fef2cd);
    border: 1px solid #fce8b2;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}
.announcement-banner .ann-title {
    font-weight: 700;
    color: #e37400;
    margin-bottom: 4px;
}
.announcement-banner .ann-content {
    font-size: 0.9rem;
    color: var(--gray-700);
}

/* ----------------------------------------------------------
   Post Detail
   ---------------------------------------------------------- */
.post-detail-header {
    margin-bottom: 16px;
}
.post-detail-header h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--gray-900);
    line-height: 1.4;
}
.post-detail-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-600);
}
.post-detail-content {
    background: var(--white);
    padding: 28px 28px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 1.05rem;
    line-height: 2;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--gray-900);
    margin-top: 12px;
    border-left: 4px solid var(--primary-light);
}
@media (max-width: 768px) {
    .post-detail-content {
        padding: 18px 14px;
        font-size: 0.95rem;
        line-height: 1.85;
    }
    .post-detail-header h2 { font-size: 1.25rem; }
}

/* ----------------------------------------------------------
   Comment Section
   ---------------------------------------------------------- */
.comment-section { margin-top: 24px; }
.comment-section h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.comment-form {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
@media (max-width: 480px) {
    .comment-form {
        padding: 10px;
    }
    .comment-form textarea {
        font-size: 0.9rem;
        min-height: 80px;
    }
    .comment-form .flex-between {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    .comment-form .flex-between > span {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .comment-sort-tab {
        padding: 3px 10px;
        font-size: 0.7rem;
    }
}

/* ----------------------------------------------------------
   Pagination
   ---------------------------------------------------------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    flex-wrap: wrap;
}
.pagination button {
    padding: 8px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--gray-700);
    transition: all var(--transition);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: default; }

/* ----------------------------------------------------------
   Category Tabs
   ---------------------------------------------------------- */
.category-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.category-tabs .cat-tab {
    padding: 8px 16px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--gray-600);
    transition: all var(--transition);
    white-space: nowrap;
}
.category-tabs .cat-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.category-tabs .cat-tab.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ----------------------------------------------------------
   Notifications
   ---------------------------------------------------------- */
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--gray-200);
    transition: background var(--transition);
    cursor: pointer;
}
.notif-item:hover { background: var(--gray-50); }
.notif-item.unread { background: var(--primary-light); }
.notif-item .notif-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}
.notif-item.read .notif-dot { background: transparent; }
.notif-item .notif-content { flex: 1; }
.notif-item .notif-text { font-size: 0.9rem; color: var(--gray-800); }
.notif-item .notif-time { font-size: 0.78rem; color: var(--gray-500); margin-top: 2px; }

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */
@media (max-width: 768px) {
    .nav-brand { font-size: 0.9rem; }
    #nav-links { gap: 0; flex-shrink: 0; }
    #nav-links a { padding: 4px 7px; font-size: 0.78rem; display: inline-flex; align-items: center; }
    /* Hide verbose text labels on mobile nav, keep compact */
    #nav-links a.mobile-compact { font-size: 0; }
    #nav-links a.mobile-compact::before { font-size: 0.85rem; content: attr(data-icon); }
    #app-main { padding: 12px; }
    .card { padding: 14px; }
    .form-card { padding: 24px 16px; margin: 20px auto; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px 10px; min-height: 76px; }
    .stat-card .stat-value { font-size: 1.4rem; }
    .post-detail-content { padding: 16px; }
    .btn { padding: 8px 16px; font-size: 0.85rem; }
}

@media (max-width: 480px) {
    .nav-brand { font-size: 0.82rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    #nav-links a { padding: 3px 6px; font-size: 0.72rem; }
    #nav-links a.mobile-compact::before { font-size: 0.78rem; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .stat-card { padding: 10px 8px; min-height: 70px; }
    .stat-card .stat-value { font-size: 1.25rem; }
    .category-tabs .cat-tab { padding: 6px 12px; font-size: 0.78rem; }
}

/* Mobile bottom nav - show on mobile */
#mobile-nav {
    display: none;
}
@media (max-width: 768px) {
    body { padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
    #mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--gray-200);
        z-index: 100;
        justify-content: space-around;
        padding: 6px 0 env(safe-area-inset-bottom, 0px);
        box-shadow: 0 -1px 4px rgba(0,0,0,0.08);
    }
    #mobile-nav a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 12px;
        color: var(--gray-600);
        font-size: 0.7rem;
        text-decoration: none;
        min-width: 48px;
        min-height: 48px;
        justify-content: center;
    }
    #mobile-nav a.active { color: var(--primary); }
    #mobile-nav .mnav-icon { font-size: 1.3rem; }
    #app-main { padding-bottom: 16px; }
}

/* Hide desktop elements on mobile */
@media (max-width: 768px) {
    .desktop-only { display: none !important; }
    /* Prevent horizontal overflow */
    body { overflow-x: hidden; }
    #app-main { overflow-x: hidden; }
    .page { overflow-x: hidden; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
    .card { max-width: 100%; overflow: hidden; }
    .post-detail-meta { gap: 6px; font-size: 0.78rem; }
    .post-detail-meta > * { white-space: nowrap; }
    /* Larger touch targets for buttons */
    .btn { min-height: 44px; }
    .btn-sm { min-height: 36px; padding: 6px 14px; }
    .pagination button { min-width: 36px; min-height: 36px; }
    /* Mobile form tweaks */
    .search-filter-bar .filter-row { flex-direction: column; }
    .search-filter-bar input, .search-filter-bar select { width: 100%; min-width: auto; }
    .search-filter-bar .filter-search { min-width: auto; flex: auto; }
    .sort-dropdown { width: 100%; }
    /* Post type selector - scrollable on mobile */
    .post-type-selector { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
    .post-type-chip { flex-shrink: 0; }
    /* Fix card footer for mobile */
    .card-footer { flex-direction: column; align-items: stretch; }
    .card-footer .btn { width: 100%; text-align: center; min-height: 40px; }
    /* Ensure admin sidebar doesn't overflow */
    .admin-sidebar { max-width: 100%; }
    /* Button group wrap */
    .btn-group { flex-wrap: wrap; }
    .btn-group .btn { flex: 0 1 auto; }
    /* Profile header mobile */
    .profile-header { flex-direction: column; align-items: center; text-align: center; }
    .profile-stats { justify-content: center; }
}
@media (min-width: 769px) {
    .mobile-only { display: none !important; }
}

/* ----------------------------------------------------------
   Chat Bubbles (私信)
   ---------------------------------------------------------- */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    max-height: 60vh;
    overflow-y: auto;
    background: var(--gray-50);
    border-radius: var(--radius);
}
.chat-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
    position: relative;
}
.chat-bubble.mine {
    align-self: flex-end;
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
    align-self: flex-start;
    background: var(--white);
    color: var(--gray-900);
    border: 1px solid var(--gray-200);
    border-bottom-left-radius: 4px;
}
.chat-bubble .chat-time {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}
.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 12px 0;
}
.chat-input-bar input {
    flex: 1;
}
.conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background var(--transition);
}
.conversation-item:hover { background: var(--gray-50); }
.conversation-item .conv-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.conversation-item .conv-info { flex: 1; min-width: 0; }
.conversation-item .conv-name { font-weight: 600; font-size: 0.95rem; }
.conversation-item .conv-last { font-size: 0.82rem; color: var(--gray-600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item .conv-meta { text-align: right; }
.conversation-item .conv-time { font-size: 0.75rem; color: var(--gray-500); }
.conversation-item .conv-unread {
    display: inline-block;
    background: var(--danger);
    color: var(--white);
    border-radius: 12px;
    padding: 1px 7px;
    font-size: 0.72rem;
    margin-top: 4px;
}

/* ----------------------------------------------------------
   User Profile / Home
   ---------------------------------------------------------- */
.profile-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.profile-avatar {
    width: 96px; height: 96px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    flex-shrink: 0;
    overflow: hidden;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-info { flex: 1; min-width: 0; }
.profile-info h3 { margin-bottom: 8px; font-size: 1.3rem; word-break: break-word; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.profile-info .profile-detail { font-size: 0.9rem; color: var(--gray-600); margin-bottom: 4px; }
.profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}
.profile-stat {
    text-align: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background var(--transition);
}
.profile-stat:hover { background: var(--gray-100); }
.profile-stat .stat-num { font-size: 1.2rem; font-weight: 700; color: var(--primary); }
.profile-stat .stat-label { font-size: 0.78rem; color: var(--gray-500); }

/* Mobile profile fixes */
@media (max-width: 768px) {
    .profile-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 18px 14px;
        gap: 14px;
    }
    .profile-avatar {
        width: 80px; height: 80px;
        font-size: 2rem;
    }
    .profile-info {
        width: 100%;
        min-width: 0;
        text-align: center;
    }
    .profile-info h3 {
        font-size: 1.15rem;
        justify-content: center;
        line-height: 1.5;
    }
    .profile-info .profile-detail {
        font-size: 0.85rem;
    }
    .profile-stats {
        justify-content: center;
        gap: 16px;
    }
    .profile-stat {
        padding: 6px 10px;
    }
    .profile-stat .stat-num {
        font-size: 1.1rem;
    }
    .profile-header .btn-group {
        justify-content: center;
        width: 100%;
    }
}
@media (max-width: 480px) {
    .profile-header {
        padding: 14px 10px;
        gap: 10px;
    }
    .profile-avatar {
        width: 64px; height: 64px;
        font-size: 1.5rem;
    }
    .profile-info h3 {
        font-size: 1rem;
    }
    .profile-stats {
        gap: 8px;
    }
    .profile-stat {
        padding: 4px 8px;
    }
    .profile-stat .stat-num {
        font-size: 1rem;
    }
    .profile-stat .stat-label {
        font-size: 0.7rem;
    }
    /* Fix for very narrow screens */
    .card-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .card-footer .btn {
        width: 100%;
        justify-content: center;
        min-height: 40px;
    }
}

/* Profile Edit */
.profile-edit-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.profile-edit-section h4 {
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}
@media (max-width: 480px) {
    .profile-edit-section {
        padding: 14px;
    }
    .profile-edit-section h4 {
        font-size: 1rem;
    }
    .privacy-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    .privacy-item .privacy-label {
        font-size: 0.85rem;
    }
}

/* ----------------------------------------------------------
   Modal / Dialog
   ---------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-box {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-box h3 { margin-bottom: 16px; }

/* ----------------------------------------------------------
   Feedback Cards
   ---------------------------------------------------------- */
.feedback-card .feedback-type {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.feedback-type-bug { background: #fce8e6; color: #c5221f; }
.feedback-type-feature { background: #e8f0fe; color: #1967d2; }
.feedback-type-ui { background: #fef7e0; color: #ea8600; }
.feedback-type-content { background: #e6f4ea; color: #137333; }
.feedback-type-other { background: var(--gray-200); color: var(--gray-600); }

/* ----------------------------------------------------------
   Ban UI
   ---------------------------------------------------------- */
.ban-duration-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.ban-duration-btn {
    padding: 6px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 20px;
    background: var(--white);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all var(--transition);
}
.ban-duration-btn:hover { border-color: var(--danger); color: var(--danger); }
.ban-duration-btn.selected { background: var(--danger); color: var(--white); border-color: var(--danger); }

/* ----------------------------------------------------------
   Image Upload
   ---------------------------------------------------------- */
.upload-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.upload-preview img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--gray-200);
}
.upload-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    cursor: pointer;
    color: var(--gray-600);
    transition: all var(--transition);
}
.upload-label:hover { border-color: var(--primary); color: var(--primary); }
.upload-input { display: none; }

/* ----------------------------------------------------------
   Tab Switcher
   ---------------------------------------------------------- */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: 16px;
}
.tab-nav .tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--gray-600);
    transition: all var(--transition);
}
.tab-nav .tab-btn:hover { color: var(--primary); }
.tab-nav .tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ----------------------------------------------------------
   Privacy Toggle
   ---------------------------------------------------------- */
.privacy-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-100);
}
.privacy-item .privacy-label { font-size: 0.9rem; color: var(--gray-800); }
.privacy-item .privacy-desc { font-size: 0.8rem; color: var(--gray-500); }
.toggle-switch {
    position: relative;
    width: 44px; height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { display: none; }
.toggle-switch .slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 12px;
    cursor: pointer;
    transition: background var(--transition);
}
.toggle-switch .slider::after {
    content: '';
    position: absolute;
    width: 20px; height: 20px;
    left: 2px; top: 2px;
    background: var(--white);
    border-radius: 50%;
    transition: transform var(--transition);
}
.toggle-switch input:checked + .slider { background: var(--primary); }
.toggle-switch input:checked + .slider::after { transform: translateX(20px); }

/* ----------------------------------------------------------
   Radio Group
   ---------------------------------------------------------- */
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }
.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

/* ----------------------------------------------------------
   Post Type Selector (3B)
   ---------------------------------------------------------- */
.post-type-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.post-type-chip {
    padding: 8px 14px;
    border: 2px solid var(--gray-300);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-600);
    transition: all var(--transition);
    white-space: nowrap;
    background: var(--white);
}
.post-type-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.post-type-chip.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Type-specific form sections */
.type-fields-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-bottom: 16px;
    animation: fadeIn 0.2s ease;
}
.type-fields-section .type-hint {
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Poll option editor */
.poll-option-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.poll-option-row input {
    flex: 1;
}
.poll-option-row .btn-remove-option {
    flex-shrink: 0;
    padding: 6px 10px;
    font-size: 0.8rem;
}

/* ----------------------------------------------------------
   Post Type Badges (3B)
   ---------------------------------------------------------- */
.post-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}
.post-type-poll { background: #e8f5e9; color: #2e7d32; }
.post-type-qa { background: #e3f2fd; color: #1565c0; }
.post-type-trade { background: #fff3e0; color: #e65100; }
.post-type-lost_found { background: #fce4ec; color: #c62828; }
.post-type-study { background: #f3e5f5; color: #6a1b9a; }
.post-type-confession { background: #fce4ec; color: #d81b60; }

/* Price tag on cards */
.price-tag {
    font-weight: 700;
    color: #e65100;
    font-size: 1rem;
}
.trade-status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.trade-selling { background: #fff3e0; color: #e65100; }
.trade-sold { background: #e8f5e9; color: #2e7d32; }
.trade-closed { background: var(--gray-200); color: var(--gray-600); }

.item-status-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}
.item-lost { background: #fce4ec; color: #c62828; }
.item-found { background: #e8f5e9; color: #2e7d32; }
.item-resolved { background: var(--gray-200); color: var(--gray-600); }

.study-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
}
.study-meta span {
    background: #f3e5f5;
    color: #6a1b9a;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* ----------------------------------------------------------
   Poll Voting UI (3B)
   ---------------------------------------------------------- */
.poll-option-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.poll-option-item:hover {
    border-color: var(--primary);
}
.poll-option-item.voted {
    border-color: var(--primary);
    background: var(--primary-light);
    cursor: default;
}
.poll-option-item .poll-bar-bg {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--primary-light);
    z-index: 0;
    transition: width 0.5s ease;
    border-radius: 0;
}
.poll-option-item .poll-option-text {
    flex: 1;
    z-index: 1;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.poll-option-item .poll-vote-count {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.85rem;
    z-index: 1;
}
.poll-option-item .poll-percent {
    color: var(--gray-600);
    font-size: 0.8rem;
    margin-left: 6px;
}
.poll-option-item .poll-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-400);
    border-radius: 50%;
    flex-shrink: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.poll-option-item.selected .poll-radio {
    border-color: var(--primary);
    background: var(--primary);
}
.poll-option-item.selected .poll-radio::after {
    content: '✓';
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 700;
}
.poll-option-item.voted .poll-radio {
    display: none;
}
.poll-result-section {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.poll-result-section h4 {
    margin-bottom: 12px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.poll-total-votes {
    font-size: 0.82rem;
    color: var(--gray-500);
    margin-top: 8px;
    text-align: right;
}

/* ----------------------------------------------------------
   Accepted Answer (3B)
   ---------------------------------------------------------- */
.comment-card.accepted-answer {
    border: 2px solid var(--success);
    background: #f1f8e9;
    position: relative;
}
.comment-card.accepted-answer::before {
    content: '✅ 已采纳';
    position: absolute;
    top: -10px;
    right: 12px;
    background: var(--success);
    color: var(--white);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 600;
}
.btn-accept-answer {
    padding: 4px 10px;
    font-size: 0.75rem;
}

/* Comment floor number */
.comment-floor {
    display: inline-block;
    color: var(--gray-400);
    font-size: 0.75rem;
    margin-right: 4px;
}
.comment-author-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    margin-left: 4px;
}
.comment-author-badge.author { background: var(--primary-light); color: var(--primary); }
.comment-author-badge.teacher { background: #fef7e0; color: #e37400; }
.comment-author-badge.admin { background: var(--danger-light); color: var(--danger); }

/* Comment sort tabs */
.comment-sort-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.comment-sort-tab {
    padding: 4px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 16px;
    cursor: pointer;
    font-size: 0.78rem;
    color: var(--gray-600);
    transition: all var(--transition);
    background: var(--white);
}
.comment-sort-tab:hover { border-color: var(--primary); color: var(--primary); }
.comment-sort-tab.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ----------------------------------------------------------
   Trade / Lost-Found Detail Info Box (3B)
   ---------------------------------------------------------- */
.type-info-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}
.type-info-box .info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
}
.type-info-box .info-label {
    color: var(--gray-500);
    font-size: 0.8rem;
}
.type-info-box .info-value {
    font-weight: 600;
    color: var(--gray-900);
}
.trade-warning {
    font-size: 0.78rem;
    color: var(--warning);
    background: #fef7e0;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    margin-top: 8px;
}
.confession-target-display {
    display: inline-block;
    background: linear-gradient(135deg, #fce4ec, #f8bbd0);
    color: #d81b60;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 600;
    margin: 8px 0;
}

/* ----------------------------------------------------------
   Search & Filter Bar (3B)
   ---------------------------------------------------------- */
.search-filter-bar {
    background: var(--white);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.search-filter-bar .filter-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}
.search-filter-bar input,
.search-filter-bar select {
    width: auto;
    min-width: 120px;
    padding: 8px 12px;
    font-size: 0.85rem;
}
.search-filter-bar .filter-search {
    flex: 1;
    min-width: 180px;
}
.sort-dropdown {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
    min-width: 110px;
}

/* ----------------------------------------------------------
   Confession Wall Card (3B)
   ---------------------------------------------------------- */
.post-card.confession-card {
    border-left: 4px solid #f06292;
    background: linear-gradient(135deg, #fff5f8, #fff);
}
.post-card.confession-card .post-title {
    color: #c62828;
}

/* ----------------------------------------------------------
   Home Banner Search Box
   ---------------------------------------------------------- */
.home-search-input { width: 200px; transition: all 0.2s ease; }
.home-search-input::placeholder { color: rgba(255,255,255,0.7); }
@media (max-width: 768px) {
    .home-banner { padding: 14px 16px; }
    .home-search-wrap { width: 100%; }
    .home-search-input { width: 100%; min-width: 0; flex: 1; }
}
@media (max-width: 480px) {
    .home-search-input { font-size: 0.82rem; padding: 6px 10px; }
    #btn-home-search { padding: 6px 12px; font-size: 0.78rem; }
}

/* ----------------------------------------------------------
   Reply-to (in-comment reply reference)
   ---------------------------------------------------------- */
.comment-reply-to {
    font-size: 0.78rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
}

/* ----------------------------------------------------------
   Comment reply (nested)
   ---------------------------------------------------------- */
.comment-reply {
    border-left: 3px solid var(--primary);
    margin-bottom: 8px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: 0 8px 8px 0;
}

/* ----------------------------------------------------------
   Collapse toggle
   ---------------------------------------------------------- */
.collapse-toggle-wrap {
    text-align: center;
    padding: 12px 0;
    border-top: 1px solid var(--gray-200);
    margin-top: 8px;
}

/* ----------------------------------------------------------
   User Title Badge (分级头衔)
   ---------------------------------------------------------- */
.user-title-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin: 0 2px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 1px rgba(0,0,0,0.15);
    box-shadow: 0 1px 3px rgba(102,126,234,0.3);
}
@media (max-width: 768px) {
    .user-title-badge {
        font-size: 0.65rem;
        padding: 1px 7px;
    }
}

/* Title color preset picker (admin edit user modal) */
.title-color-preset {
    display: inline-block;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    margin: 2px;
    border: 2px solid var(--gray-300);
    vertical-align: middle;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.title-color-preset:hover {
    transform: scale(1.2);
    border-color: var(--gray-500);
}
.title-color-preset.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* ----------------------------------------------------------
   Comment Header Row (mobile wrapping)
   ---------------------------------------------------------- */
.comment-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
@media (max-width: 480px) {
    .comment-header-row {
        gap: 4px;
    }
    .comment-header-row .btn {
        padding: 2px 6px;
        font-size: 0.65rem;
        min-height: 28px;
    }
    .comment-card {
        padding: 10px;
    }
    [style*="margin-left:44px"] {
        margin-left: 20px !important;
    }
}

/* ----------------------------------------------------------
   Utility (continued)
   ---------------------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ----------------------------------------------------------
   Enhanced Animations
   ---------------------------------------------------------- */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes shake {
    0%,100% { transform: rotate(0deg); }
    20% { transform: rotate(-5deg); }
    40% { transform: rotate(5deg); }
    60% { transform: rotate(-3deg); }
    80% { transform: rotate(3deg); }
}
@keyframes flipIn {
    from { transform: perspective(400px) rotateY(90deg); opacity: 0; }
    to { transform: perspective(400px) rotateY(0); opacity: 1; }
}
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Enhance existing animations */
.modal-overlay {
    animation: fadeIn 0.2s ease;
}
.modal-box {
    animation: scaleIn 0.25s ease;
}
.btn:active {
    transform: scale(0.97);
    transition: transform 0.08s ease;
}

/* Chat bubble entrance */
.chat-bubble {
    animation: slideUp 0.25s ease;
}

/* ----------------------------------------------------------
   Chat Attachment Bar
   ---------------------------------------------------------- */
.chat-attachment-bar {
    display: flex;
    gap: 4px;
    padding: 8px 0;
    border-top: 1px solid var(--gray-200);
    flex-wrap: wrap;
}
.chat-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--gray-300);
    background: var(--white);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition);
}
.chat-attach-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: translateY(-1px);
}
@media (max-width: 480px) {
    .chat-attach-btn {
        width: 36px; height: 36px;
        font-size: 0.95rem;
    }
}

/* ----------------------------------------------------------
   Chat Bubble Types
   ---------------------------------------------------------- */
.chat-bubble-image {
    padding: 4px;
    background: transparent;
}
.chat-bubble-image.mine {
    background: transparent;
}
.chat-bubble-image img {
    display: block;
}

/* Red packet bubble */
.chat-bubble-red-packet {
    animation: bounceIn 0.4s ease;
    transition: transform var(--transition);
}
.chat-bubble-red-packet:hover {
    transform: scale(1.03);
}
.chat-bubble-red-packet:active {
    transform: scale(0.97);
}

/* ----------------------------------------------------------
   Membership Badge & Card
   ---------------------------------------------------------- */
.membership-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
    animation: fadeIn 0.3s ease;
}
.membership-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.membership-card:hover {
    box-shadow: var(--shadow-lg);
}

/* ----------------------------------------------------------
   Wallet Card
   ---------------------------------------------------------- */
.wallet-card {
    transition: transform var(--transition), box-shadow var(--transition);
}
.wallet-card:hover {
    box-shadow: 0 6px 20px rgba(26,115,232,0.3);
}

/* ----------------------------------------------------------
   Quick Actions Grid
   ---------------------------------------------------------- */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
@media (max-width: 480px) {
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
    }
    .quick-actions-grid .btn {
        padding: 10px 6px;
        font-size: 0.75rem;
    }
    .quick-actions-grid .btn span:first-child {
        font-size: 1.2rem;
    }
}

/* ----------------------------------------------------------
   Membership Plan Cards
   ---------------------------------------------------------- */
.membership-plan-card {
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
}
.membership-plan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.membership-plan-card ul {
    list-style: none;
    padding: 0;
    margin: 8px 0;
}
.membership-plan-card li {
    padding: 4px 0;
    font-size: 0.85rem;
}
.membership-plan-card li::before {
    content: '✅ ';
    font-size: 0.75rem;
}

/* ----------------------------------------------------------
   Paywall Overlay
   ---------------------------------------------------------- */
.paywall-overlay {
    animation: fadeIn 0.3s ease;
}

/* ----------------------------------------------------------
   Profile Header Card (new compact design)
   ---------------------------------------------------------- */
.profile-header-card {
    transition: box-shadow var(--transition);
}
.profile-header-card:hover {
    box-shadow: var(--shadow-lg);
}

/* ----------------------------------------------------------
   Collapsible card headers
   ---------------------------------------------------------- */
.collapse-header {
    cursor: pointer;
    user-select: none;
}
.collapse-header:hover {
    color: var(--primary);
}

/* ----------------------------------------------------------
   Enhanced mobile responsiveness
   ---------------------------------------------------------- */
@media (max-width: 768px) {
    /* Wallet and membership cards stack properly */
    .wallet-card > div {
        flex-direction: column;
        align-items: flex-start;
    }
    .wallet-card > div > div:last-child {
        flex-direction: row;
        flex-wrap: wrap;
    }
    /* Membership plan cards stack vertically */
    .membership-plan-card {
        min-width: 100%;
    }
    /* Profile header card */
    .profile-header-card > div {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    /* Quick actions grid 3 columns on mobile */
    .quick-actions-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 480px) {
    /* Smaller stat cards */
    .stat-card .stat-value {
        font-size: 1.2rem;
    }
    /* Tighter spacing for cards */
    .card { padding: 12px; }
    /* Admin table overflow */
    table { font-size: 0.75rem; }
    /* Red packet modal */
    .modal-box { padding: 16px; }
}
