/* Forum Styles */
* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.forum-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
}

.forum-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.forum-header h1 {
    margin: 0 0 10px 0;
    font-size: 2em;
}

.forum-header p {
    margin: 0;
    font-size: 1em;
}

.forum-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.forum-nav-buttons {
    display: flex;
    gap: 10px;
}

.forum-nav .btn {
    margin-bottom: 0;
}

.btn {
    padding: 10px 20px;
    margin-bottom: 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px; /* Better touch target */
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Category Header Section */
.category-header-section {
    margin-bottom: 25px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    border-left: 5px solid #5568d3;
}

.category-header-section h2 {
    margin: 0;
    color: white;
    font-size: 32px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.5px;
}

/* Groups/Sections */
.group-section {
    margin-bottom: 30px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px 20px;
    border: 1px solid #e0e0e0;
}

.group-header {
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.group-header h2 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 1.3em;
    font-weight: 600;
}

.group-description {
    margin: 0;
    color: #666;
    font-size: 13px;
}

/* Categories */
.categories-list {
    display: grid;
    gap: 12px;
    margin-bottom: 20px;
}

.category-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px 15px;
    transition: box-shadow 0.3s;
}

.category-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.category-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 14px;
}

.category-table td {
    padding: 0;
    vertical-align: top;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.category-main {
    width: 40%;
    padding-right: 15px;
}

.category-stats-cell {
    width: 15%;
    text-align: center;
    padding: 0 10px;
}

.category-activity-cell {
    width: 30%;
    padding-left: 10px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.category-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

.category-header h3 a {
    text-decoration: none;
    color: #333;
}

.category-header h3 a:hover {
    color: #667eea;
}

.category-description {
    margin: 6px 0 0 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.stat-item-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.stat-item-inline .stat-icon {
    font-size: 16px;
}

.stat-item-inline strong {
    color: #333;
    font-weight: 600;
    font-size: 16px;
}

.stat-label-small {
    font-size: 11px;
    color: #999;
}

.latest-activity-inline {
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}

.latest-activity-inline .latest-topic-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 12px;
    display: inline;
}

.latest-activity-inline .latest-topic-link:hover {
    text-decoration: underline;
    color: #5568d3;
}

.stat-author-inline {
    color: #777;
    font-size: 10px;
    display: inline;
    margin-left: 6px;
}

.stat-author-inline strong {
    color: #667eea;
    font-weight: 600;
}

.latest-activity-inline .stat-time {
    color: #999;
    font-size: 10px;
    display: block;
    margin-top: 3px;
}

.stat-label-inline {
    color: #999;
    font-style: italic;
}

.category-stats {
    color: #666;
    font-size: 14px;
}

/* Category Information & Statistics */
.category-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}

.category-stats-info {
    flex: 1;
    min-width: 250px;
}

.stats-row {
    display: flex;
    gap: 15px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #666;
}

.stat-item strong {
    color: #333;
    font-weight: 600;
}

.stat-icon {
    font-size: 14px;
}

.stat-note {
    font-size: 11px;
    color: #999;
    font-style: italic;
}

.latest-activity-info {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #f5f5f5;
    font-size: 11px;
    color: #666;
    line-height: 1.5;
}

.latest-activity-info .stat-label {
    font-weight: 600;
    color: #555;
    margin-right: 8px;
    font-size: 12px;
}

.latest-topic-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    margin: 0 5px;
}

.latest-topic-link:hover {
    text-decoration: underline;
    color: #5568d3;
}

.stat-details {
    margin-left: 8px;
    color: #777;
}

.stat-details strong {
    color: #667eea;
    font-weight: 600;
}

.stat-time {
    margin-left: 8px;
    color: #999;
    font-size: 11px;
}


/* Topics List */
.topics-list {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.topic-item {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background 0.2s;
}

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

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

.topic-item.pinned {
    background: #fff9e6;
}

.topic-item.locked {
    opacity: 0.7;
}

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

.topic-content {
    flex: 1;
    min-width: 0; /* Allows text truncation */
    overflow: hidden;
}

.topic-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin: 0 0 5px 0;
    text-decoration: none;
}

.topic-title:hover {
    color: #667eea;
}

.topic-meta {
    font-size: 12px;
    color: #666;
}

.topic-stats {
    text-align: right;
    font-size: 14px;
    color: #666;
    min-width: 100px;
}

/* Topic View */
.topic-view {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

.topic-header {
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.topic-header h2 {
    margin: 0 0 10px 0;
    color: #333;
}

.topic-header-meta {
    display: flex;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.topic-content-body {
    line-height: 1.6;
    color: #444;
    margin-bottom: 20px;
}

/* Posts */
.posts-list {
    margin-top: 20px;
}

.post-item {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 15px;
}

.post-author {
    font-weight: 600;
    color: #667eea;
}

.post-date {
    font-size: 12px;
    color: #999;
}

.post-content {
    line-height: 1.6;
    color: #444;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Forms */
.forum-form {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea {
    -webkit-appearance: none;
    border-radius: 5px;
}

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

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

.close-modal:hover {
    color: #333;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* Messages */
.message {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* Search */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* Admin Styles */
.admin-controls {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.admin-link {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.2s;
}

.admin-link:hover {
    text-decoration: underline;
    color: #495057;
}

.admin-link[data-action="delete-category"] {
    color: #dc3545;
}

.admin-link[data-action="delete-category"]:hover {
    color: #c82333;
}

.admin-controls-inline {
    display: inline-flex;
    gap: 5px;
    margin-left: 10px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 12px;
    min-height: 28px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    min-height: 36px;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.admin-panel {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
}

.admin-tab {
    padding: 10px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s;
}

.admin-tab:hover {
    color: #667eea;
}

.admin-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    font-weight: 600;
}

.admin-section {
    padding: 20px 0;
}

.admin-section h3 {
    margin: 0 0 20px 0;
    color: #333;
}

.admin-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.admin-item > div:first-child {
    flex: 1;
}

.admin-item strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.admin-item p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.admin-item small {
    color: #999;
    font-size: 12px;
}

.admin-item-actions {
    display: flex;
    gap: 5px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background: #dc3545;
    color: white;
}

.badge-warning {
    background: #ffc107;
    color: #000;
}

.badge-danger {
    background: #dc3545;
    color: white;
}

.badge-secondary {
    background: #6c757d;
    color: white;
}

/* Admin Dashboard */
.admin-dashboard {
    padding: 20px 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: box-shadow 0.3s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 20px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-card .stat-label {
    font-size: 14px;
    color: #666;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-sub {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-section {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.dashboard-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.activity-icon {
    font-size: 16px;
}

/* Responsive - Large tablets and small desktops */
@media (max-width: 1200px) {
    .btn {
        padding: 9.5px 19px;
        font-size: 13.75px;
    }
}

/* Responsive - Tablets */
@media (max-width: 992px) {
    .btn {
        padding: 9px 18px;
        font-size: 13.5px;
        min-height: 42px;
    }
    
    .btn-sm {
        padding: 5.5px 11px;
        font-size: 12.5px;
        min-height: 34px;
    }
    
    .btn-xs {
        padding: 3.5px 7px;
        font-size: 11.5px;
        min-height: 30px;
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .forum-container {
        padding: 10px;
    }
    
    .forum-header {
        padding: 20px;
        margin-bottom: 20px;
    }
    
    .forum-header h1 {
        font-size: 1.5em;
    }
    
    .forum-header p {
        font-size: 0.9em;
    }
    
    .forum-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 10px;
        margin-bottom: 12px;
    }
    
    .forum-nav .btn {
        flex: 1 1 auto;
        min-width: 120px;
        padding: 10px 12px;
        margin-bottom: 0;
    }
    
    #auth-section {
        display: flex;
        flex-direction: row;
        gap: 6px;
        align-items: center;
    }
    
    #auth-section .btn {
        padding: 6px 12px;
        font-size: 12px;
        min-height: 32px;
        margin-bottom: 0;
        flex: 0 0 auto;
    }
    
    .forum-nav-buttons {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .forum-nav-buttons .btn {
        flex: 1 1 auto;
        min-width: 120px;
    }
    
    .btn {
        width: auto;
        margin-bottom: 8px;
        padding: 10px 16px;
        font-size: 14px;
        min-height: 40px;
        white-space: nowrap;
    }
    
    /* Full width buttons in specific contexts */
    .forum-form .btn,
    .modal-content .btn,
    .search-box .btn {
        width: 100%;
        font-size: 16px; /* Prevent zoom on iOS for form buttons */
        white-space: normal;
    }
    
    /* Inline buttons stay inline and wrap if needed */
    .forum-nav .btn,
    #auth-section .btn,
    .admin-controls .btn,
    .admin-controls-inline .btn,
    .post-header .btn,
    .topic-header .btn {
        width: auto;
        flex-shrink: 0;
    }
    
    /* Button groups that should wrap */
    .admin-controls,
    .admin-controls-inline,
    .forum-nav-buttons {
        flex-wrap: wrap;
    }
    
    .topic-item {
        flex-direction: row;
        align-items: center;
        padding: 8px 10px;
        gap: 8px;
    }
    
    .topic-icon {
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .topic-content {
        flex: 1;
        min-width: 0; /* Allows text truncation */
    }
    
    .topic-title {
        font-size: 13px;
        margin: 0 0 3px 0;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        word-break: break-word;
    }
    
    .topic-meta {
        font-size: 10px;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 1;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .topic-stats {
        text-align: right;
        font-size: 10px;
        color: #666;
        min-width: 70px;
        flex-shrink: 0;
        line-height: 1.4;
    }
    
    .topic-stats div {
        margin-bottom: 2px;
    }
    
    .admin-controls-inline {
        margin-top: 4px;
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .admin-controls-inline .btn-xs {
        padding: 2px 5px;
        font-size: 9px;
        min-height: auto;
    }
    
    .topic-view {
        padding: 10px 12px;
        margin-bottom: 15px;
    }
    
    .topic-header {
        border-bottom: 1px solid #f0f0f0;
        padding-bottom: 10px;
        margin-bottom: 10px;
    }
    
    .topic-header h2 {
        font-size: 1.1em;
        margin: 0 0 6px 0;
        line-height: 1.3;
    }
    
    .topic-header-meta {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 10px;
        line-height: 1.4;
    }
    
    .topic-header-meta span {
        white-space: nowrap;
    }
    
    .topic-content-body {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 0;
    }
    
    .admin-controls {
        margin-top: 8px;
        gap: 5px;
    }
    
    .admin-controls .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
        min-height: auto;
    }
    
    .posts-list {
        margin-top: 15px;
    }
    
    .posts-list h3 {
        font-size: 1.1em;
        margin: 0 0 10px 0;
        padding: 0 2px;
    }
    
    .post-item {
        padding: 10px 12px;
        margin-bottom: 10px;
        border-radius: 6px;
    }
    
    .post-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 8px;
        margin-bottom: 8px;
        border-bottom: 1px solid #f5f5f5;
    }
    
    .post-author {
        font-size: 13px;
        margin-right: 8px;
    }
    
    .post-date {
        font-size: 10px;
    }
    
    .post-content {
        font-size: 14px;
        line-height: 1.5;
    }
    
    .post-header .admin-controls {
        margin-top: 0;
    }
    
    .post-header .admin-controls .btn-xs {
        padding: 3px 6px;
        font-size: 10px;
        min-height: auto;
    }
    
    .forum-form {
        padding: 15px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .form-group textarea {
        min-height: 120px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
        margin: 10px;
        max-height: 95vh;
    }
    
    .modal-header h3 {
        font-size: 1.2em;
    }
    
    .close-modal {
        font-size: 28px;
        padding: 0;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .admin-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }
    
    .admin-item-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .admin-item-actions .btn {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .admin-tabs {
        flex-wrap: wrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-tab {
        padding: 10px 15px;
        font-size: 14px;
        white-space: nowrap;
    }
    
    .category-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .category-stats-info {
        min-width: 100%;
    }
    
    .stats-row {
        flex-direction: column;
        gap: 8px;
    }
    
    .latest-activity-info {
        font-size: 11px;
    }
    
    .latest-topic-link {
        display: block;
        margin: 4px 0;
        word-break: break-word;
    }
    
    .stat-details {
        display: block;
        margin-left: 0;
        margin-top: 4px;
    }
    
    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .dashboard-sections {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .category-table {
        display: table;
        font-size: 12px;
    }
    
    .category-table tr {
        display: table-row;
    }
    
    .category-table td {
        display: table-cell;
        padding: 4px 6px !important;
        vertical-align: middle !important;
    }
    
    .category-main {
        width: 45% !important;
        padding-right: 8px !important;
    }
    
    .category-stats-cell {
        width: 12% !important;
        padding: 0 4px !important;
        text-align: center !important;
    }
    
    .category-activity-cell {
        width: 31% !important;
        padding-left: 6px !important;
    }
    
    .category-card {
        padding: 8px 10px;
    }
    
    .category-header {
        margin-bottom: 3px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .category-header h3 {
        font-size: 13px;
        line-height: 1.3;
        margin: 0;
    }
    
    .category-header h3 a {
        word-break: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .category-description {
        font-size: 10px;
        line-height: 1.3;
        margin: 2px 0 0 0;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: #666;
    }
    
    .stat-item-inline {
        font-size: 9px;
        gap: 2px;
    }
    
    .stat-item-inline strong {
        font-size: 12px;
        display: block;
    }
    
    .stat-label-small {
        font-size: 8px;
    }
    
    .latest-activity-inline {
        font-size: 9px;
        line-height: 1.3;
    }
    
    .latest-activity-inline .latest-topic-link {
        font-size: 10px;
        margin-bottom: 2px;
        word-break: break-word;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .stat-author-inline {
        font-size: 8px;
        display: block;
        margin: 2px 0;
    }
    
    .stat-author-inline strong {
        font-size: 9px;
    }
    
    .latest-activity-inline .stat-time {
        font-size: 8px;
        margin-top: 2px;
    }
    
    .stat-label-inline {
        font-size: 9px;
    }
    
    .admin-controls {
        margin-top: 4px;
    }
    
    .admin-controls .btn-sm {
        padding: 3px 6px;
        font-size: 10px;
        min-height: auto;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .search-box input {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-box .btn {
        width: 100%;
    }
    
    .user-info {
        flex-wrap: wrap;
    }
    
    .admin-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .admin-controls .btn {
        flex: 1 1 auto;
        min-width: 80px;
    }
    
    .admin-controls-inline {
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .topic-content-body,
    .post-content {
        font-size: 15px;
        line-height: 1.6;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .group-section {
        padding: 12px 15px;
    }
    
    .group-header h2 {
        font-size: 1.1em;
    }
    
    .group-description {
        font-size: 12px;
    }
    
    .categories-list {
        gap: 10px;
    }
    
    .topics-list {
        border-radius: 6px;
    }
    
    .topic-view {
        padding: 8px 10px;
        margin-bottom: 12px;
    }
    
    .topic-header {
        padding-bottom: 8px;
        margin-bottom: 8px;
    }
    
    .topic-header h2 {
        font-size: 1em;
        margin: 0 0 4px 0;
    }
    
    .topic-header-meta {
        font-size: 9px;
        gap: 6px;
    }
    
    .topic-content-body {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .admin-controls .btn-sm {
        padding: 3px 6px;
        font-size: 10px;
    }
    
    .posts-list {
        margin-top: 12px;
    }
    
    .posts-list h3 {
        font-size: 1em;
        margin: 0 0 8px 0;
    }
    
    .post-item {
        padding: 8px 10px;
        margin-bottom: 8px;
    }
    
    .post-header {
        padding-bottom: 6px;
        margin-bottom: 6px;
    }
    
    .post-author {
        font-size: 12px;
    }
    
    .post-date {
        font-size: 9px;
    }
    
    .post-content {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .post-header .admin-controls .btn-xs {
        padding: 2px 5px;
        font-size: 9px;
    }
    
    #auth-section {
        gap: 5px;
    }
    
    #auth-section .btn {
        padding: 5px 10px;
        font-size: 11px;
        min-height: 30px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 13px;
        min-height: 36px;
    }
    
    .forum-form .btn,
    .modal-content .btn {
        padding: 10px 16px;
        font-size: 15px;
    }
    
    .btn-sm {
        padding: 5px 10px;
        font-size: 12px;
        min-height: 32px;
    }
    
    .btn-xs {
        padding: 3px 8px;
        font-size: 11px;
        min-height: 28px;
    }
    
    .topic-item {
        padding: 6px 8px;
        gap: 6px;
    }
    
    .topic-icon {
        font-size: 14px;
    }
    
    .topic-title {
        font-size: 12px;
    }
    
    .topic-meta {
        font-size: 9px;
    }
    
    .topic-stats {
        font-size: 9px;
        min-width: 60px;
    }
    
    .admin-controls-inline .btn-xs {
        padding: 2px 4px;
        font-size: 8px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-value {
        font-size: 24px;
    }
    
    .dashboard-section {
        padding: 15px;
    }
    
    .activity-list {
        gap: 10px;
    }
    
    .activity-item {
        padding: 8px;
    }
    
    /* hCaptcha mobile adjustments */
    .h-captcha {
        transform: scale(0.85);
        transform-origin: 0 0;
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .category-header-section {
        padding: 18px 20px;
        margin-bottom: 20px;
    }
    
    .category-header-section h2 {
        font-size: 24px;
        letter-spacing: 0.3px;
    }
    .forum-container {
        padding: 8px;
    }
    
    .forum-header {
        padding: 15px;
    }
    
    .forum-header h1 {
        font-size: 1.3em;
    }
    
    .modal-content {
        padding: 15px;
        width: 98%;
        margin: 5px;
    }
    
    .category-card {
        padding: 6px 8px;
    }
    
    .category-table {
        font-size: 11px;
    }
    
    .category-header h3 {
        font-size: 12px;
    }
    
    .category-description {
        font-size: 9px;
    }
    
    .stat-item-inline {
        font-size: 8px;
    }
    
    .stat-item-inline strong {
        font-size: 11px;
    }
    
    .latest-activity-inline {
        font-size: 8px;
    }
    
    .latest-activity-inline .latest-topic-link {
        font-size: 9px;
    }
    
    .category-table td {
        padding: 3px 4px !important;
    }
    
    .category-main {
        width: 50% !important;
        padding-right: 6px !important;
    }
    
    .category-stats-cell {
        width: 11% !important;
        padding: 0 3px !important;
    }
    
    .category-activity-cell {
        width: 28% !important;
        padding-left: 4px !important;
    }
    
    .topic-item {
        padding: 10px 12px;
    }
    
    .post-item {
        padding: 12px;
    }
    
    .forum-form {
        padding: 12px;
    }
    
    .admin-panel {
        padding: 15px;
    }
    
    .btn-xs {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .btn-sm {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    .h-captcha {
        transform: scale(0.77);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn:hover {
        opacity: 1;
    }
    
    .btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
    
    .category-card:hover {
        box-shadow: none;
    }
    
    .category-card:active {
        background: #f0f0f0;
    }
    
    .topic-item:hover {
        background: transparent;
    }
    
    .topic-item:active {
        background: #f8f9fa;
    }
}

/* Landscape mobile optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-content {
        max-height: 85vh;
    }
    
    .forum-header {
        padding: 15px 20px;
    }
    
    .forum-header h1 {
        font-size: 1.4em;
        margin-bottom: 5px;
    }
}

/* Accordion Styles */
.accordion {
    border: 1px solid #1e2838;
    border-radius: 5px;
    margin-bottom: 10px;
    background: var(--panel, #0f1625);
}

.accordion-header {
    padding: 15px 20px;
    background: var(--panel-2, #151f35);
    border-bottom: 1px solid #1e2838;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    user-select: none;
}

.accordion-header:hover {
    background: #1a2332;
}

.accordion-header.active {
    background: #1a2332;
    border-bottom: 1px solid #242d42;
}

.accordion-title {
    font-weight: 600;
    color: var(--text, #e8eaf6);
    font-size: 16px;
}

.accordion-icon {
    transition: transform 0.3s;
    font-size: 18px;
    color: var(--muted, #9fa8da);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: var(--panel, #0f1625);
}

.accordion-content.active {
    max-height: 5000px;
    transition: max-height 0.5s ease-in;
}

.accordion-body {
    background: var(--panel, #0f1625);
}

.accordion-body {
    padding: 15px 20px;
}

