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

body {
    font-family: Arial, "Microsoft YaHei", sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
    position: relative;
    padding-bottom: 150px; /* Footer height + spacing */
}

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

/* Material Design Header */
header {
    background: #2c3e50 url('/images/navbar-bg.jpg') center center no-repeat;
    background-size: cover;
    color: white;
    padding: 1rem 0 0 0;
    min-height: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: relative;
}

/* Add overlay for better text contrast */
header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.75);
    pointer-events: none;
}

.navbar {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
    padding: 1rem 0;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-menu li {
    margin: 0;
}

.nav-menu a {
    display: block;
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.nav-menu a:active {
    transform: translateY(0);
}

.user-status-bar {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 0.75rem 0;
    margin-top: 0.5rem;
    font-size: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    min-height: 40px;
    position: relative;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    text-align: center;
}

.user-status-bar a {
    color: #64B5F6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.user-status-bar a:hover {
    color: #90CAF9;
    text-decoration: underline;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: absolute;
    left: 20px;
    top: 5px;
    z-index: 2000;
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile responsive navigation */
@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .navbar {
        padding: 0.5rem 0;
    }

    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(44, 62, 80, 0.98);
        backdrop-filter: blur(20px);
        padding: 1rem 0;
        gap: 0;
        box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        z-index: 1500;
    }

    .nav-menu.active {
        display: flex;
        max-height: 90vh; overflow-y: auto;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        font-size: 1rem;
        padding: 1rem 1.5rem;
        border-radius: 0;
        background: transparent;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        text-align: left;
    }

    .nav-menu a:hover {
        background: rgba(255, 255, 255, 0.15);
        transform: none;
        box-shadow: none;
    }

    /* HIDE status bar on mobile by default */
    .user-status-bar {
        display: none;
    }

    header {
        min-height: auto;
        padding: 0.5rem 0 0 0;
    }

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

    /* Hero section mobile */
    .hero {
        padding: 1.5rem 1rem;
        margin: 1rem 0;
        border-radius: 8px;
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .stats {
        gap: 1rem;
    }

    .stat .number {
        font-size: 1.8rem;
    }

    .stat .label {
        font-size: 0.9rem;
    }

    /* Section mobile */
    .section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }

    .section h2 {
        font-size: 1.2rem;
        margin-bottom: 1rem;
        padding-bottom: 0.5rem;
    }

    /* Buttons mobile */
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    /* Fix image overflow globally */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Content images */
    .content img,
    .post-message img,
    .message img,
    .notice-item img,
    .topic-item img,
    .story-content img {
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 0.5rem 0;
    }

    /* Tables responsive */
    .topic-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .topic-table th,
    .topic-table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    /* Forum post mobile */
    .forum-post {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .post-message {
        font-size: 0.95rem;
        line-height: 1.6;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* User grid mobile - 2 columns */
    .user-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin: 1rem 0;
    }

    .user-card {
        padding: 0.75rem;
        border-radius: 6px;
    }

    .user-card:hover {
        transform: none;
    }

    .user-photo img, .no-photo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    .user-card h3 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .user-card p {
        font-size: 0.7rem;
        margin: 0.1rem 0;
        line-height: 1.3;
    }

    .user-card .btn-small {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        margin-top: 0.5rem;
    }

    /* Photo gallery mobile - 2 columns */
    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .photo-card {
        border-radius: 6px;
    }

    .photo-card img {
        height: 100px;
    }

    .photo-title {
        padding: 0.4rem;
        font-size: 0.75rem;
    }

    /* Forms mobile */
    .login-form, .profile-form {
        padding: 1.5rem;
        margin: 1rem auto;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Prevent iOS zoom */
        padding: 0.6rem;
    }

    /* Footer mobile */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Class columns */
    .class-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .class-column {
        padding: 1rem;
    }

    /* Two column layout */
    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .story-index {
        max-height: 200px;
    }

    .story-content {
        max-height: none;
        padding: 1rem;
    }

    /* Modal mobile */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1.5rem;
    }
}

/* Extra small phones */
@media (max-width: 400px) {
    .container {
        padding: 0 8px;
    }

    .section {
        padding: 0.75rem;
    }

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

    .stat .number {
        font-size: 1.5rem;
    }

    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .topic-table th,
    .topic-table td {
        padding: 0.4rem;
        font-size: 0.8rem;
    }
}

/* Material Design Hero Section */
.hero {
    background: white;
    padding: 3rem 2rem;
    margin: 2rem 0;
    text-align: center;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #1976D2;
    font-weight: 500;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
    padding: 1rem;
}

.stat .number {
    display: block;
    font-size: 2.5rem;
    font-weight: 600;
    color: #1976D2;
}

.stat .label {
    display: block;
    color: #616161;
    font-size: 1.1rem;
    margin-top: 0.5rem;
}

/* Material Design Layout */
.row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.section {
    background: white;
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.section:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.section h2 {
    margin-bottom: 1.5rem;
    color: #1976D2;
    border-bottom: 3px solid #1976D2;
    padding-bottom: 0.75rem;
    font-weight: 500;
    font-size: 1.5rem;
}

/* Material Design Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #1976D2;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    background: #1565C0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.btn-primary {
    background: #1976D2;
    border: none;
    padding: 0.85rem 2rem;
    font-size: 1.05rem;
    cursor: pointer;
}

.btn-small {
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: normal;
}

/* User Grid */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.user-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.user-card:hover {
    transform: translateY(-5px);
}

.user-photo img, .no-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
}

.no-photo {
    background: #ecf0f1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a5a6;
    margin: 0 auto 1rem;
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.photo-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 4px;
}

/* Forms */
.login-form, .profile-form {
    max-width: 600px;
    margin: 2rem auto;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.login-form {
    max-width: 400px;
    margin: 3rem auto;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input:disabled {
    background: #f5f5f5;
    color: #999;
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
    font-size: 0.85rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-error {
    background: #e74c3c;
    color: white;
}

/* Footer */
footer {
    background: #003d82;
    color: white;
    text-align: center;
    padding: 2rem 0;
    position: absolute;
    bottom: 0;
    width: 100%;
    left: 0;
}

footer p,
footer a,
footer .footer-links,
footer .footer-links a {
    color: white !important;
}

footer a {
    text-decoration: none;
    transition: opacity 0.3s;
}

footer a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.pagination a {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

/* Photo Gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.photo-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

.photo-card:hover {
    transform: translateY(-5px);
}

.photo-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.photo-title {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
}

.photo-view img {
    max-width: 100%;
    height: auto;
    margin: 2rem 0;
}

/* User Profile */
.user-profile {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.profile-photo img,
.profile-photo .no-photo {
    width: 200px;
    height: 200px;
    border-radius: 8px;
    object-fit: cover;
}

.profile-table {
    width: 100%;
    margin-top: 1rem;
}

.profile-table td {
    padding: 0.5rem;
    border-bottom: 1px solid #eee;
}

.profile-table td:first-child {
    font-weight: bold;
    width: 100px;
}

/* Topic/Notice Items */
.notice-item, .topic-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid #eee;
}

.notice-item:last-child,
.topic-item:last-child {
    border-bottom: none;
}

.notice-item h3,
.topic-item h3 {
    margin-bottom: 0.5rem;
}

.notice-item a,
.topic-item a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s;
}

.notice-item a:hover,
.topic-item a:hover {
    color: #3498db;
}

.meta {
    color: #7f8c8d;
    font-size: 0.9rem;
    white-space: nowrap;
}

.subtitle {
    color: #555;
    margin: 0.5rem 0;
}

.content {
    line-height: 1.8;
    margin: 2rem 0;
}

/* News/Stories */
.news-list, .stories-list {
    background: white;
}

.news-item, .story-item {
    padding: 1.5rem 0;
    border-bottom: 1px solid #eee;
}

.news-item:last-child, .story-item:last-child {
    border-bottom: none;
}

.intro {
    text-align: center;
    color: #7f8c8d;
    margin: 1rem 0 2rem;
}

.alert-success {
    background: #2ecc71;
    color: white;
}

/* Class Layout */
.class-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.class-column {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.class-column h2 {
    text-align: center;
    font-size: 1.5rem;
    color: #2c3e50;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #3498db;
}

.class-list {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.class-link {
    display: block;
    padding: 0.5rem 1rem;
    color: #2c3e50;
    text-decoration: none;
    font-size: 1rem;
    line-height: 1.8;
    transition: all 0.3s;
}

.class-link:hover {
    color: #3498db;
    text-decoration: underline;
    transform: translateX(5px);
}

/* Topic Table */
.topic-table {
    width: 100%;
    border-collapse: collapse;
}

.topic-table thead {
    background: #003d82;
    color: white;
}

.topic-table th {
    padding: 1rem;
    text-align: left;
    font-weight: bold;
}

.topic-table td {
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.topic-table tbody tr:hover {
    background: #f8f9fa;
}

.topic-table tr.even {
    background: white;
}

.topic-table tr.odd {
    background: #f5f5f5;
}

.topic-table tr.even:hover,
.topic-table tr.odd:hover {
    background: #e3f2fd;
}

.topic-table td a {
    color: #2c3e50;
    text-decoration: none;
}

.topic-table td a:hover {
    color: #3498db;
    text-decoration: underline;
}

.topic-table td:nth-child(2),
.topic-table td:nth-child(3),
.topic-table td:nth-child(4) {
    text-align: center;
}

/* Forum Controls */
.forum-controls {
    background: white;
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-group label {
    font-weight: bold;
    color: #2c3e50;
    white-space: nowrap;
}

.control-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.95rem;
}

.control-group select:hover {
    border-color: #3498db;
}

/* Forum Post Layout */
.forum-post {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.reply-post {
    margin-left: 2rem;
    background: #f8f9fa;
}

.post-info {
    border-right: 2px solid #eee;
    padding-right: 1.5rem;
}

.author-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    word-break: break-word;
}

.post-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    color: #7f8c8d;
    white-space: nowrap;
    white-space: nowrap;
}

.post-meta div:first-child {
    font-weight: 500;
}

.post-content {
    min-width: 0;
}

.post-message {
    line-height: 1.8;
    color: #333;
    word-wrap: break-word;
    overflow-wrap: break-word;
    margin-bottom: 1.5rem;
}

.replies-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #eee;
}

.replies-section h4 {
    margin-bottom: 1rem;
    color: #7f8c8d;
    font-size: 0.95rem;
}

.reply-item {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
    border-left: 3px solid #3498db;
    border-radius: 4px;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.reply-header strong {
    color: #2c3e50;
}

.reply-time {
    font-size: 0.85rem;
    color: #95a5a6;
}

.reply-message {
    line-height: 1.6;
    color: #495057;
}

/* Two Column Layout (for yqsy.php) */
.two-column-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.story-index {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.index-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.3s;
}

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

.index-item:hover {
    background: #f8f9fa;
}

.index-item.active {
    background: #e3f2fd;
    border-left: 4px solid #3498db;
}

.index-item a {
    text-decoration: none;
    color: inherit;
}

.index-item h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: #2c3e50;
}

.index-item .subtitle {
    margin: 0.25rem 0;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.index-item .meta {
    margin: 0.5rem 0 0 0;
    font-size: 0.8rem;
    color: #95a5a6;
    white-space: nowrap;
}

.story-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-height: 80vh;
    overflow-y: auto;
}

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

    .user-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .user-card {
        padding: 0.75rem;
        border-radius: 6px;
    }

    .user-photo img, .user-card .no-photo {
        width: 50px;
        height: 50px;
        margin-bottom: 0.5rem;
    }

    .user-card h3 {
        font-size: 0.85rem;
        margin-bottom: 0.25rem;
    }

    .user-card p {
        font-size: 0.75rem;
        line-height: 1.3;
    }

    .user-card .btn-small {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

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

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

    .user-profile {
        grid-template-columns: 1fr;
    }

    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }

    .two-column-layout {
        grid-template-columns: 1fr;
    }

    .story-index {
        max-height: 300px;
    }

    .forum-post {
        grid-template-columns: 1fr;
    }

    .post-info {
        border-right: none;
        border-bottom: 2px solid #eee;
        padding-right: 0;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
    }

    .reply-post {
        margin-left: 0;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 1.5rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: #333;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #f8f9fa;
    position: relative;
}

.drop-zone:hover {
    border-color: #2980b9;
    background: #e8f4f8;
}

.drop-zone.dragover {
    border-color: #27ae60;
    background: #d5f4e6;
}

.drop-zone p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1rem;
}

.drop-zone input[type="file"] {
    display: none;
}

.drop-zone #preview {
    margin-top: 1rem;
}

.drop-zone #preview img {
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Home page photo grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.photo-item {
    overflow: hidden;
    border-radius: 4px;
}

.photo-item img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    transition: transform 0.3s;
}

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

/* Image containment for forum/topic pages - prevent overflow */
.post-message,
.reply-message,
.reply-item,
.story-content,
.notice-content,
.news-content,
.topic-content,
.content {
    overflow: hidden;
}

.post-message img,
.reply-message img,
.reply-item img,
.story-content img,
.notice-content img,
.news-content img,
.topic-content img,
.content img,
.message img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
    margin: 0.5rem 0;
    object-fit: contain;
}

/* Responsive image containment */
@media (max-width: 768px) {
    .post-message img,
    .reply-message img,
    .reply-item img,
    .story-content img,
    .notice-content img,
    .news-content img,
    .topic-content img,
    .content img,
    .message img {
        max-width: 100% !important;
        width: auto !important;
    }
}

/* Mobile App-like Header Behavior */
@media (max-width: 768px) {
    /* Fixed header for mobile */
    header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 9000;
        transition: transform 0.3s ease;
    }
    
    header.header-hidden {
        transform: translateY(-100%);
    }
    
    /* Add padding to body to account for fixed header */
    body {
        padding-top: 50px;
    }
    
    /* Nav brand logo/text */
    .nav-brand {
        color: white;
        font-size: 1.2rem;
        font-weight: bold;
        text-decoration: none;
        margin-right: auto;
    }
    
    .navbar .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Mobile-only menu items */
    .mobile-only {
        display: block !important;
    }
    
    /* Chat link with online badge */
    .nav-chat {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        color: #4CAF50 !important;
        font-weight: bold;
    }
    
    .online-badge {
        background: #4CAF50;
        color: white;
        font-size: 0.75rem;
        padding: 2px 8px;
        border-radius: 12px;
        font-weight: normal;
    }
    
    /* Full screen feel - remove margins */
    main.container {
        padding-left: 8px;
        padding-right: 8px;
        margin-top: 0;
    }
    
    .section {
        border-radius: 0;
        margin-left: -8px;
        margin-right: -8px;
        padding: 1rem;
    }
}

/* Desktop - hide mobile-only items */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .nav-brand {
        display: none;
    }
}

/* Global nav-chat and nav-admin styles (for all screen sizes) */
.nav-chat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4CAF50 !important;
    font-weight: bold;
}

.online-badge {
    background: #4CAF50;
    color: white;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: normal;
}

.nav-admin {
    color: #ff9800 !important;
    font-weight: bold;
    background: rgba(255, 152, 0, 0.15) !important;
}

.nav-admin:hover {
    background: rgba(255, 152, 0, 0.3) !important;
}

/* Mobile nav chat and admin styles */
@media (max-width: 768px) {
    .nav-menu .nav-chat,
    .nav-menu .nav-admin {
        display: flex !important;
        width: 100% !important;
        color: white !important;
    }
    .nav-menu .nav-chat {
        color: #4CAF50 !important;
    }
    .nav-menu .online-badge {
        background: #4CAF50;
        color: white;
        font-size: 0.7rem;
        padding: 2px 8px;
        border-radius: 10px;
        margin-left: 8px;
    }
    .nav-menu .nav-admin {
        color: #ff9800 !important;
        background: rgba(255, 152, 0, 0.15) !important;
    }
}
