/* BlueCMS Community Demo - Theme Support */

/* Dark Theme (Default) */
:root {
    --primary: #a78bfa;
    --primary-light: #c4b5fd;
    --primary-dark: #8b5cf6;
    --secondary: #f472b6;
    --accent: #22d3ee;
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #f87171;
    --bg-dark: #0c0a1d;
    --bg-card: #141225;
    --bg-card-hover: #1c1935;
    --bg-elevated: #1e1a38;
    --bg-input: #1e1a38;
    --border: rgba(167, 139, 250, 0.15);
    --border-light: rgba(167, 139, 250, 0.25);
    --border-input: rgba(167, 139, 250, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #a5b4c8;
    --text-muted: #6b7a8e;
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
[data-theme="light"] {
    --primary: #8b5cf6;
    --primary-light: #a78bfa;
    --primary-dark: #7c3aed;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-elevated: #f1f5f9;
    --bg-input: #ffffff;
    --border: rgba(0, 0, 0, 0.08);
    --border-light: rgba(0, 0, 0, 0.12);
    --border-input: rgba(0, 0, 0, 0.2);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

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

/* ========== Header ========== */
.header {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

/* 모바일 헤더 숨김/표시 애니메이션 */
.header.header-hidden {
    transform: translateY(-100%);
}

.header.header-visible {
    transform: translateY(0);
}

[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.95);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 65px;
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    -webkit-text-fill-color: var(--primary);
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-menu a {
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-menu a:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-menu a.active {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.user-menu:hover {
    border-color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 14px;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-level {
    font-size: 11px;
    color: var(--primary);
}

/* Header Icons */
.header-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.icon-btn i {
    font-size: 16px;
}

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

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

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-primary);
    cursor: pointer;
}

/* ========== Page Title ========== */
.page-title-section {
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-dark) 100%);
}

.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: var(--primary);
}

.page-desc {
    color: var(--text-secondary);
    margin-top: 8px;
    font-size: 14px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 15px;
}

.breadcrumb a {
    color: var(--text-muted);
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

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

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

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s;
}

.card:hover {
    border-color: var(--border-light);
}

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

.card-header h2, .card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header i {
    color: var(--primary);
}

.card-body {
    padding: 22px;
}

/* ========== Board List ========== */
.board-list-header {
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 80px;
    padding: 14px 22px;
    background: rgba(0, 0, 0, 0.2);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.board-list-item {
    display: grid;
    grid-template-columns: 80px 1fr 120px 100px 80px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    align-items: center;
    transition: background 0.2s;
    cursor: pointer;
}

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

.board-list-item:hover {
    background: var(--bg-card-hover);
}

.board-list-item.notice {
    background: rgba(139, 92, 246, 0.05);
}

.item-num {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.item-title-area {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.item-category {
    padding: 4px 10px;
    background: var(--bg-elevated);
    color: var(--primary);
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    flex-shrink: 0;
}

.item-title {
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-title .badge-new {
    display: inline-block;
    background: var(--danger);
    color: var(--text-primary);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.item-title .badge-hot {
    display: inline-block;
    background: linear-gradient(135deg, var(--warning), #f97316);
    color: #1f2937;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.item-title .comment-count {
    color: var(--primary);
    font-size: 13px;
    margin-left: 6px;
}

.item-writer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.item-writer .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: var(--text-primary);
}

.item-date {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.item-views {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ========== Gallery Grid ========== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    padding: 22px;
}

.gallery-item {
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: all 0.3s;
    cursor: pointer;
}

.gallery-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.gallery-thumb {
    aspect-ratio: 4/3;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 36px;
    position: relative;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-info {
    padding: 15px;
}

.gallery-info .title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gallery-info .meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 30px 0;
}

.pagination a, .pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.pagination a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .active {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    border-color: transparent;
    color: var(--text-primary);
}

/* ========== Search Box ========== */
.search-box {
    display: flex;
    gap: 10px;
    padding: 20px 22px;
    background: transparent;
    border-top: none;
}

.search-box select {
    padding: 10px 15px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
}

.search-box input {
    flex: 1;
    padding: 10px 15px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

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

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

/* ========== Sidebar ========== */
.sidebar-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 20px;
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    color: var(--primary);
}

/* ========== Level Badge ========== */
.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--warning), #fb923c);
    color: #1f2937;
    font-size: 10px;
    font-weight: 600;
    border-radius: 10px;
}

/* ========== Rating ========== */
.rating-stars {
    display: flex;
    gap: 2px;
    color: var(--warning);
    font-size: 14px;
}

.rating-stars .empty {
    color: var(--text-muted);
}

/* ========== Footer ========== */
footer {
    background: rgba(5, 3, 15, 0.9);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    padding: 50px 0 25px;
    margin-top: 60px;
}

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

.footer-logo {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-links {
    display: flex;
    gap: 25px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.2s;
}

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

.footer-copyright {
    font-size: 12px;
    text-align: center;
    padding-top: 25px;
    margin-top: 25px;
    border-top: 1px solid var(--border);
}

/* ========== Demo Navigation ========== */
.demo-nav {
    position: fixed;
    bottom: 30px;
    left: 30px;
    display: flex;
    gap: 10px;
    z-index: 9999;
}

.demo-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s;
}

.demo-nav a:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    color: var(--text-primary);
}

.demo-nav a.active {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    border-color: transparent;
    color: var(--text-primary);
}

/* ========== Responsive ========== */
@media (max-width: 1200px) {
    .board-list-header,
    .board-list-item {
        grid-template-columns: 60px 1fr 100px 80px;
    }

    .board-list-header > :nth-child(5),
    .board-list-item .item-views {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .board-list-header,
    .board-list-item {
        grid-template-columns: 1fr 100px;
    }

    .board-list-header > :nth-child(1),
    .board-list-header > :nth-child(4),
    .board-list-item .item-num,
    .board-list-item .item-date {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .nav-menu,
    .header-actions {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .page-title {
        font-size: 1.4rem;
    }

    .board-list-header {
        display: none;
    }

    .board-list-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .board-list-item .item-writer {
        display: none;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .search-box {
        flex-wrap: wrap;
    }

    .search-box select {
        width: 100%;
    }

    .demo-nav {
        bottom: 15px;
        left: 15px;
        right: auto;
    }

    .demo-nav a {
        padding: 10px 14px;
        font-size: 12px;
    }

    /* Footer mobile */
    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Theme toggle mobile - next to demo-nav */
    .theme-toggle {
        bottom: 15px;
        left: 115px;
        right: auto;
        padding: 10px 14px;
    }

    .theme-toggle span {
        display: none;
    }

    /* Page title section mobile */
    .page-title-section {
        padding: 25px 0;
    }

    .page-desc {
        font-size: 13px;
    }

    /* Container padding mobile */
    .container {
        padding: 0 15px;
    }
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.mobile-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-card);
    z-index: 9999;
    transition: right 0.3s;
    overflow-y: auto;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.mobile-menu.active {
    right: 0;
}

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

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

.mobile-menu-user .user-avatar {
    width: 40px;
    height: 40px;
    font-size: 16px;
}

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

.mobile-menu-user .user-name {
    font-size: 15px;
    font-weight: 600;
}

.mobile-menu-user .user-level {
    font-size: 12px;
}

.mobile-menu-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
}

.mobile-menu-nav {
    padding: 15px 0;
    flex: 1;
    overflow-y: auto;
}

.mobile-menu-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    font-size: 15px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
    background: var(--bg-elevated);
    color: var(--primary);
}

.mobile-menu-nav a i {
    width: 20px;
    text-align: center;
}

.mobile-menu-actions {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    margin-top: auto;
}

.mobile-menu-actions .icon-btn {
    flex: 1;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
}

/* ========== Main Content Area ========== */
.main-content {
    padding-top: 30px;
    min-height: calc(100vh - 65px - 200px);
}

/* 서브페이지 GNB 여백 */
.page-title-section + .container .main-content,
.container > .main-content:first-child {
    padding-top: 30px;
}

/* ========== Content Card ========== */
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-card);
}

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

.content-card-body {
    padding: 25px;
}

/* ========== Form Inputs (Enhanced visibility) ========== */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 2px solid var(--border-input);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: var(--bg-card);
    border-color: #d1d5db;
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ========== Theme Toggle Button ========== */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    left: 145px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.theme-toggle i {
    font-size: 16px;
    color: var(--primary);
}

.theme-toggle span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

[data-theme="light"] .theme-toggle {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Light Theme - Enhanced Styles */
/* GNB active menu - white text */
[data-theme="light"] .nav-menu a.active {
    color: #fff;
}

/* Attendance calendar checked days */
[data-theme="light"] .calendar-day.checked {
    color: #fff;
}

/* Attendance button */
[data-theme="light"] .attendance-btn {
    color: #fff;
}

/* Board menu active item */
[data-theme="light"] .board-menu a.active {
    color: #fff;
}

[data-theme="light"] .board-menu a.active .count {
    color: #fff;
}

/* Follow button */
[data-theme="light"] .follow-btn {
    color: #fff;
}

[data-theme="light"] .follow-btn.following {
    color: var(--text-secondary);
}

/* Post action buttons - liked state */
[data-theme="light"] .post-action-btn.liked {
    color: #fff;
}

[data-theme="light"] .post-action-btn.bookmarked {
    color: #fff;
}

[data-theme="light"] .post-action-btn.shared {
    color: #fff;
}

/* Sidebar header text */
[data-theme="light"] .sidebar-header {
    color: var(--text-primary);
}

/* Code blocks in light mode - dark background for readability */
[data-theme="light"] pre,
[data-theme="light"] code {
    background: #1e293b;
    color: #e2e8f0;
}

[data-theme="light"] .post-content pre,
[data-theme="light"] .post-body pre,
[data-theme="light"] .comment-content pre {
    background: #1e293b;
    color: #e2e8f0;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
}

[data-theme="light"] .post-content code,
[data-theme="light"] .post-body code,
[data-theme="light"] .comment-content code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
}

[data-theme="light"] .post-content pre code,
[data-theme="light"] .post-body pre code,
[data-theme="light"] .comment-content pre code {
    background: transparent;
    padding: 0;
}

/* Attendance page - calendar days checked */
[data-theme="light"] .calendar-grid .day-item.checked,
[data-theme="light"] .calendar-grid .day-item.checked .day-number,
[data-theme="light"] .calendar-grid .day-item.checked .day-label {
    color: #fff;
}

[data-theme="light"] .calendar-grid .day-item.checked i {
    color: #fff;
}

/* Streak bonus section - achieved days white text */
[data-theme="light"] .streak-circle.achieved,
[data-theme="light"] .streak-circle.achieved .streak-day-num,
[data-theme="light"] .streak-circle.achieved .streak-day-label {
    color: #fff;
}

[data-theme="light"] .streak-circle.bonus,
[data-theme="light"] .streak-circle.bonus .streak-day-num,
[data-theme="light"] .streak-circle.bonus .streak-day-label {
    color: #1f2937;
}

/* Info card icons with gradient background - white icon */
[data-theme="light"] .info-card-icon.pink {
    color: #fff;
}

/* Q&A status and post stats - darker text in light mode */
[data-theme="light"] .qna-status-text {
    color: #6b7280;
}

[data-theme="light"] .qna-status.pending .qna-status-text {
    color: #b45309;
}

[data-theme="light"] .qna-status.solved .qna-status-text {
    color: #047857;
}

[data-theme="light"] .answer-count {
    color: #4b5563;
}

[data-theme="light"] .post-stat {
    color: #4b5563;
}

[data-theme="light"] .post-time {
    color: #6b7280;
}

/* ========== Content Grid ========== */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 25px;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Logo Styles ========== */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-badge {
    padding: 3px 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--primary);
}

/* ========== Navigation Menu ========== */
/* Note: .nav-menu is defined earlier in line 116 */

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

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

.nav-link.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.nav-link i {
    font-size: 0.9rem;
}

/* ========== User Menu ========== */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.user-menu:hover {
    border-color: var(--primary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.85rem;
}

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

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-level {
    font-size: 0.7rem;
    color: var(--primary);
}

/* ========== Footer ========== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 40px 0 25px;
    margin-top: 50px;
}

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

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 8px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color 0.2s;
}

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

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

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

.modal-body {
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
}

.modal-footer {
    display: block;
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

a.modal-footer:hover {
    background: var(--bg-elevated);
}

.btn-see-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: gap 0.2s;
}

a.modal-footer:hover .btn-see-all {
    gap: 10px;
}

/* ========== Notification List ========== */
.notification-list {
    padding: 0;
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 18px 25px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
    cursor: pointer;
}

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

.notification-item:hover {
    background: var(--bg-elevated);
}

.notification-item.unread {
    background: rgba(139, 92, 246, 0.05);
}

.notification-item.unread:hover {
    background: rgba(139, 92, 246, 0.1);
}

.notification-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

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

.notification-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.notification-text strong {
    color: var(--primary);
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 5px;
}

/* ========== Demo Nav Position Fix ========== */
.demo-nav {
    position: fixed;
    bottom: 30px;
    left: 30px;
    right: auto;
    z-index: 9999;
}

.theme-toggle {
    left: 145px !important;
    right: auto !important;
}

@media (max-width: 768px) {
    .demo-nav {
        bottom: 15px;
        left: 15px;
        right: auto;
    }

    .theme-toggle {
        bottom: 15px !important;
        left: 115px !important;
        right: auto !important;
    }
}

/* ========== User Profile Modal ========== */
.user-profile-modal {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    min-width: 280px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    display: none;
    animation: fadeInScale 0.2s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.user-profile-modal.show {
    display: block;
}

.user-profile-modal .modal-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.user-profile-modal .user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-profile-modal .user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile-modal .user-info {
    flex: 1;
}

.user-profile-modal .user-name {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.user-profile-modal .user-name .level-icon {
    width: 20px;
    height: 20px;
}

.user-profile-modal .user-level {
    font-size: 12px;
    color: var(--text-muted);
}

.user-profile-modal .user-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

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

.user-profile-modal .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.user-profile-modal .stat-label {
    font-size: 11px;
    color: var(--text-muted);
}

.user-profile-modal .modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-profile-modal .modal-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.user-profile-modal .modal-action-btn:hover {
    border-color: var(--primary);
    background: rgba(167, 139, 250, 0.1);
    color: var(--primary);
}

.user-profile-modal .modal-action-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    color: white;
}

.user-profile-modal .modal-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(167, 139, 250, 0.3);
}

/* ========== Level Icon ========== */
.level-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
}

.level-icon img,
img.level-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    vertical-align: middle;
}

/* ========== Clickable Nickname ========== */
.nickname-link {
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.nickname-link:hover {
    color: var(--primary);
}

/* ========================================
   Unified Level Badge System
   ======================================== */

/* Level Badge Base */
.level-badge-unified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
}

.level-badge-unified i {
    font-size: 10px;
}

/* Tier 1: 초보 (1-4) - 회색 */
.level-tier-1 { background: linear-gradient(135deg, rgba(107, 114, 128, 0.2), rgba(75, 85, 99, 0.2)); color: #9ca3af; }
.level-tier-1 i { color: #9ca3af; }

/* Tier 2: 초급 (5-8) - 초록 */
.level-tier-2 { background: linear-gradient(135deg, rgba(132, 204, 22, 0.2), rgba(101, 163, 13, 0.2)); color: #a3e635; }
.level-tier-2 i { color: #a3e635; }

/* Tier 3: 중급 (9-12) - 시안 */
.level-tier-3 { background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(8, 145, 178, 0.2)); color: #22d3ee; }
.level-tier-3 i { color: #22d3ee; }

/* Tier 4: 고급 (13-16) - 보라 */
.level-tier-4 { background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.2)); color: #a78bfa; }
.level-tier-4 i { color: #a78bfa; }

/* Tier 5: 최고급 (17-20) - 골드 */
.level-tier-5 { background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.25)); color: #fbbf24; }
.level-tier-5 i { color: #fbbf24; }

/* Tier 6: 전설 (21-24) - 레드 */
.level-tier-6 { background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(220, 38, 38, 0.25)); color: #f87171; }
.level-tier-6 i { color: #f87171; }

/* Level icons by tier */
.level-tier-1 .level-badge-icon::before { content: '\f4d8'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* seedling */
.level-tier-2 .level-badge-icon::before { content: '\f1bb'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* tree */
.level-tier-3 .level-badge-icon::before { content: '\f3a5'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* gem */
.level-tier-4 .level-badge-icon::before { content: '\f005'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* star */
.level-tier-5 .level-badge-icon::before { content: '\f521'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* crown */
.level-tier-6 .level-badge-icon::before { content: '\f06d'; font-family: 'Font Awesome 6 Free'; font-weight: 900; } /* fire */

/* Animated glow for high levels */
.level-tier-5,
.level-tier-6 {
    animation: levelGlow 2s ease-in-out infinite alternate;
}

@keyframes levelGlow {
    from { box-shadow: 0 0 5px rgba(251, 191, 36, 0.3); }
    to { box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
}

.level-tier-6 {
    animation: levelGlowRed 2s ease-in-out infinite alternate;
}

@keyframes levelGlowRed {
    from { box-shadow: 0 0 5px rgba(248, 113, 113, 0.3); }
    to { box-shadow: 0 0 15px rgba(248, 113, 113, 0.5); }
}

/* ========================================
   Mobile Optimization - Enhanced Styles
   ======================================== */

/* Mobile Post Cards */
@media (max-width: 768px) {
    /* Post Card Mobile Styles */
    .post-card {
        padding: 15px;
    }

    .post-card .post-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .post-card .post-title {
        font-size: 15px;
        line-height: 1.4;
    }

    .post-card .post-content {
        font-size: 13px;
    }

    .post-card .post-footer {
        flex-wrap: wrap;
        gap: 10px;
    }

    .post-card .post-stats {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Q&A Card Mobile */
    .post-card.qna-style {
        flex-direction: column;
    }

    .post-card.qna-style .qna-status {
        width: 100%;
        padding: 12px;
        border-radius: 10px;
        flex-direction: row;
        justify-content: center;
        min-width: auto;
    }

    .post-card.qna-style .post-main {
        width: 100%;
    }

    /* Post Writer Mobile */
    .post-writer {
        font-size: 12px;
    }

    .post-writer .level-icon {
        width: 16px;
        height: 16px;
    }

    /* Category Tabs Mobile */
    .category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    .category-tab {
        flex-shrink: 0;
        padding: 8px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    /* Section Header Mobile */
    .section-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .section-header h2 {
        font-size: 1.1rem;
        width: 100%;
    }

    /* Ranking Widget Mobile */
    .ranking-widget .ranking-item {
        padding: 12px;
    }

    .ranking-widget .user-info {
        font-size: 13px;
    }

    /* Index Page Sections Mobile */
    .home-section {
        margin-bottom: 25px;
    }

    .home-section .section-title {
        font-size: 1.1rem;
        margin-bottom: 15px;
    }

    /* Notice Banner Mobile */
    .notice-banner {
        padding: 10px 15px;
        font-size: 13px;
    }

    /* Quick Actions Mobile */
    .quick-actions {
        flex-direction: column;
        gap: 8px;
    }

    .quick-action-btn {
        width: 100%;
        justify-content: center;
    }

    /* Profile Section Mobile (Mypage) */
    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-avatar {
        margin: 0 auto 15px;
    }

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

    .profile-stats {
        justify-content: center;
    }

    .profile-cover {
        min-height: 100px;
        padding: 20px 15px;
    }

    .profile-cover-name {
        font-size: 1rem;
    }

    /* Attendance Page Mobile */
    .calendar-grid {
        gap: 6px;
    }

    .calendar-day {
        padding: 8px 4px;
        font-size: 12px;
    }

    .calendar-day .day-number {
        font-size: 14px;
    }

    .streak-section {
        padding: 15px;
    }

    .streak-circles {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .streak-circle {
        width: 50px;
        height: 50px;
        font-size: 11px;
    }

    .streak-day-num {
        font-size: 14px;
    }

    /* Hero Section Mobile */
    .hero-section {
        padding: 25px 15px;
    }

    .hero-icon {
        font-size: 2.5rem;
        margin-bottom: 10px;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-desc {
        font-size: 13px;
    }

    /* Ranking Page Mobile */
    .ranking-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .ranking-tabs::-webkit-scrollbar {
        display: none;
    }

    .ranking-tab {
        flex-shrink: 0;
        padding: 10px 16px;
        font-size: 13px;
    }

    .ranking-card {
        padding: 12px 15px;
    }

    .ranking-card .rank-number {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .ranking-card .user-name {
        font-size: 14px;
    }

    .ranking-card .stat-value {
        font-size: 14px;
    }

    /* Message Page Mobile */
    .message-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .message-sidebar {
        position: relative;
        top: 0;
    }

    .message-compose-btn {
        width: 100%;
        margin: 10px 0;
    }

    .message-nav {
        display: flex;
        overflow-x: auto;
        padding: 10px;
        gap: 5px;
    }

    .message-nav-item {
        flex-shrink: 0;
        padding: 10px 15px;
        border-radius: 10px;
        border-left: none;
    }

    .message-nav-item .label {
        display: none;
    }

    .message-nav-item i {
        margin: 0;
    }

    .message-item {
        padding: 12px 15px;
    }

    .message-avatar {
        width: 40px;
        height: 40px;
    }

    .message-title {
        font-size: 13px;
    }

    .message-preview {
        font-size: 12px;
    }

    .message-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .message-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Board Page Mobile */
    .board-header {
        flex-direction: column;
        gap: 15px;
    }

    .board-info {
        text-align: center;
    }

    .board-actions {
        width: 100%;
        justify-content: center;
    }

    /* View Page Mobile */
    .view-header {
        padding: 15px;
    }

    .view-title {
        font-size: 1.2rem;
    }

    .view-meta {
        flex-wrap: wrap;
        gap: 8px;
    }

    .view-content {
        padding: 15px;
        font-size: 14px;
    }

    /* Comment Section Mobile */
    .comment-item {
        padding: 12px;
    }

    .comment-avatar {
        width: 36px;
        height: 36px;
    }

    .comment-content {
        font-size: 13px;
    }

    .comment-form textarea {
        min-height: 80px;
    }

    /* Sidebar Mobile */
    .content-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: -1;
    }

    /* Info Cards Mobile */
    .info-card {
        padding: 15px;
    }

    .info-card-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .info-card-value {
        font-size: 1.2rem;
    }

    /* Modal Mobile */
    .modal-content {
        max-width: calc(100vw - 30px);
        max-height: calc(100vh - 60px);
        margin: 15px;
    }

    .notification-modal {
        max-width: calc(100vw - 30px);
    }

    /* Footer Mobile */
    .footer {
        padding: 30px 0 20px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .footer-partners {
        flex-direction: column;
    }

    .partner-btn {
        min-width: auto;
        justify-content: flex-start;
    }

    /* Write Page Mobile */
    .write-form {
        padding: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .form-group label {
        font-size: 13px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 12px 14px;
        font-size: 14px;
    }

    .write-actions {
        flex-direction: column;
        gap: 10px;
    }

    .write-actions .btn {
        width: 100%;
    }

    /* Tables Mobile */
    .admin-table {
        display: block;
        overflow-x: auto;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 8px;
        font-size: 12px;
        white-space: nowrap;
    }
}

/* Small Mobile (max-width: 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .page-title {
        font-size: 1.2rem;
    }

    .page-title-section {
        padding: 20px 0;
    }

    /* Header Mobile */
    .header-inner {
        height: 55px;
        padding: 0 12px;
    }

    .logo {
        font-size: 1.1rem;
    }

    /* Post Card Small Mobile */
    .post-card {
        padding: 12px;
    }

    .post-card .post-title {
        font-size: 14px;
    }

    /* Streak Section Small Mobile */
    .streak-circle {
        width: 44px;
        height: 44px;
    }

    .streak-day-num {
        font-size: 12px;
    }

    .streak-day-label {
        font-size: 9px;
    }

    /* Ranking Small Mobile */
    .ranking-card .rank-number {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .ranking-card .user-avatar {
        width: 36px;
        height: 36px;
    }

    /* Message Small Mobile */
    .message-avatar {
        width: 36px;
        height: 36px;
    }

    .message-sender {
        font-size: 13px;
    }

    /* Theme Toggle Small Mobile */
    .theme-toggle {
        padding: 8px 14px;
    }

    /* Demo Nav Small Mobile */
    .demo-nav a {
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        padding: 20px;
    }

    .hero-icon {
        font-size: 2rem;
    }

    .page-title-section {
        padding: 20px 0;
    }

    .modal-content {
        max-height: 90vh;
    }
}

/* ========================================
   Mobile Critical Overrides (Must be at end)
   ======================================== */
@media (max-width: 768px) {
    /* Force hide desktop navigation */
    .nav-menu {
        display: none !important;
    }

    .header-actions {
        display: none !important;
    }

    /* Force show mobile menu button */
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: none;
        border: none;
        font-size: 22px;
        color: var(--text-primary);
        cursor: pointer;
    }

    /* Header layout for mobile */
    .header-inner {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Container padding */
    .container {
        padding: 0 15px;
    }

    /* Index page - post cards grid */
    .posts-grid {
        grid-template-columns: 1fr !important;
    }

    /* Attendance - streak circles */
    .streak-circles {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 10px !important;
        justify-content: center !important;
    }

    .streak-circle {
        width: 48px !important;
        height: 48px !important;
        flex-shrink: 0;
    }

    .streak-day-num {
        font-size: 13px !important;
    }

    .streak-day-label {
        font-size: 9px !important;
    }

    /* Info stats row */
    .info-stats {
        flex-direction: column;
        gap: 10px;
    }

    .info-stat {
        width: 100%;
    }

    /* Board page category tabs */
    .category-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        gap: 5px;
    }

    .category-tab {
        flex-shrink: 0;
        white-space: nowrap;
    }

    /* Sidebar widget on mobile */
    .sidebar-widget,
    .sidebar-card {
        margin-bottom: 15px;
    }

    /* Post card layout */
    .post-card {
        padding: 15px;
    }

    /* User menu on mobile */
    .user-menu {
        padding: 5px 8px 5px 5px;
    }

    .user-menu .user-info {
        display: none;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
    }
}

/* ========================================
   Prevent Horizontal Scroll on Mobile
   ======================================== */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Tables - scrollable within container */
.table-container,
.board-table-wrap,
.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

@media (max-width: 768px) {
    /* Prevent page-level horizontal scroll */
    html, body {
        overflow-x: hidden !important;
    }

    /* All major containers */
    .container,
    .content-card,
    .post-card,
    .comment-section,
    .sidebar-widget,
    .sidebar-card {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* View.php - Post detail page mobile */
    .post-view,
    .comments-section {
        max-width: 100%;
        box-sizing: border-box;
    }

    .content-grid {
        display: block !important;
        padding: 15px 0;
    }

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

    /* Main content - visible overflow for proper rendering */
    .main-content {
        max-width: 100%;
        overflow-x: visible;
    }

    /* Board sections - allow content to show, just constrain width */
    .board-header-section,
    .board-toolbar-section {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Tables - keep as table, allow scroll if needed */
    .admin-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    /* Board table - preserve table layout */
    .board-table {
        display: table;
        width: 100%;
    }

    /* Board list - make scrollable */
    .board-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .board-list-header,
    .board-list-item {
        min-width: 100%;
    }

    /* Form inputs don't overflow */
    input, textarea, select {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Images don't overflow */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Flex containers wrap properly */
    .flex-row,
    .d-flex {
        flex-wrap: wrap;
    }

    /* Toolbar section - allow horizontal scroll for tabs only */
    .board-toolbar-section {
        overflow-x: visible;
    }

    .category-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-right: 15px;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Comment form */
    .comment-form {
        max-width: 100%;
    }

    .comment-form textarea {
        width: 100%;
        box-sizing: border-box;
    }

    /* Search box */
    .search-box {
        flex-wrap: wrap;
        gap: 8px;
    }

    .search-box input,
    .search-box select {
        flex: 1;
        min-width: 0;
    }

    /* View page content */
    .view-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .view-content img {
        max-width: 100%;
        height: auto;
    }

    .view-content pre,
    .view-content code {
        overflow-x: auto;
        max-width: 100%;
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    /* Modal adjustments */
    .modal-content {
        max-width: calc(100vw - 20px);
        margin: 10px;
    }

    /* Stats boxes */
    .stats-row,
    .stat-cards,
    .info-cards {
        flex-wrap: wrap;
    }

    .stat-card,
    .info-card {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
}
