/* Theme Variables */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #e0e0e0;
    --shadow: rgba(0,0,0,0.1);
    --shadow-hover: rgba(0,0,0,0.12);
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --border-color: #444;
    --shadow: rgba(0,0,0,0.3);
    --shadow-hover: rgba(0,0,0,0.4);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-img {
    height: 50px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.logo-text {
    font-size: 1.8rem;
    font-weight: bold;
    margin: 0;
}

.nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Main Content */
.main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
}

.screen {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login Screen */
.login-card {
    max-width: 500px;
    margin: 3rem auto;
    background: var(--bg-secondary);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow);
}

.login-card h2 {
    color: var(--gradient-start);
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.test-accounts {
    margin-top: 2rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
    font-size: 0.9rem;
}

.test-accounts ul {
    margin-top: 0.5rem;
    margin-left: 1.5rem;
}

.test-accounts li {
    margin: 0.3rem 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-control:focus {
    outline: none;
    border-color: var(--gradient-start);
}

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

input[type="file"].form-control {
    padding: 0.5rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

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

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

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

.btn-block {
    width: 100%;
}

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

/* Module List */
.module-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.module-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.module-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px var(--shadow-hover);
}

.module-card h3 {
    color: var(--gradient-start);
    margin-bottom: 0.5rem;
}

.module-card .module-code {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Forum Header */
.forum-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.forum-header h2 {
    color: var(--text-primary);
}

.module-code {
    color: var(--gradient-start);
    font-weight: 600;
}

/* Search Bar */
.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.search-bar .form-control {
    flex: 1;
}

/* Composer Guidelines */
.composer-guidelines {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-left: 4px solid #667eea;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Create Post Form */
.create-post-form {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
    margin-bottom: 2rem;
}

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

/* Posts List */
.posts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.post-card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: all 0.3s;
    position: relative;
    cursor: pointer;
}

.post-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 15px var(--shadow-hover);
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.post-title {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    flex: 1;
}

.post-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.post-author {
    font-weight: 500;
}

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

.post-body {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.post-body.truncated {
    max-height: 3.6em;
    overflow: hidden;
    position: relative;
}

.post-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-question {
    background: #e7f3ff;
    color: #0066cc;
}

.badge-attachment {
    background: #fff3e0;
    color: #f57c00;
}

.badge-link {
    background: #e8f5e9;
    color: #388e3c;
}

/* Verification Tick */
.verification-tick {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
}

.tick-grey {
    background: #808080;
    color: white;
}

.tick-blue {
    background: #1DA1F2;
    color: white;
    box-shadow: 0 2px 8px rgba(29, 161, 242, 0.4);
}

/* Post Actions */
.post-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.post-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

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

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

.btn-report {
    background: #ffc107;
    color: #333;
}

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

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

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

.btn-bookmarked {
    background: #0056b3;
}

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

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    width: 90%;
    position: relative;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.close, .close-settings {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-tertiary);
    cursor: pointer;
    line-height: 1;
}

.close:hover, .close-settings:hover {
    color: var(--text-primary);
}

.post-detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.post-detail-title {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.post-detail-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.post-attachments {
    margin: 1.5rem 0;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.attachment-item a {
    color: #667eea;
    text-decoration: none;
    flex: 1;
}

.attachment-item a:hover {
    text-decoration: underline;
}

.post-links {
    margin: 1.5rem 0;
}

.link-item {
    display: block;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    color: #667eea;
    text-decoration: none;
}

.link-item:hover {
    background: #e9ecef;
}

/* Loading */
.loading {
    text-align: center;
    padding: 3rem;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Messages */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid #c3e6cb;
}

/* Footer */
.footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 3rem;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .forum-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .module-list {
        grid-template-columns: 1fr;
    }

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

    .verification-tick {
        position: static;
        margin-bottom: 1rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* Settings Button */
.btn-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    padding: 0.5rem;
    transition: transform 0.2s;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* Settings Modal */
.settings-modal {
    max-width: 600px;
}

.settings-section {
    margin-bottom: 2rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.settings-section label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.settings-section .form-control {
    margin-bottom: 1rem;
}

/* ============================================
   PILOT: Lecturer & Helper Dashboard Styles
   ============================================ */

.lecturer-question-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
    border-left: 4px solid #667eea;
}

.lecturer-question-card h3 {
    margin-top: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.responses-section {
    margin-top: 2rem;
}

.responses-section h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.responses-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-small.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.response-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
}

.response-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.response-card.top-response {
    border-left: 4px solid #fbbf24;
    background: linear-gradient(to right, rgba(251, 191, 36, 0.1), transparent);
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.response-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.reputation-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.top-badge {
    background: #fbbf24;
    color: #1f2937;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.response-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.response-body {
    margin: 1rem 0;
    color: var(--text-primary);
    line-height: 1.6;
}

.helper-rating-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stars {
    color: #fbbf24;
    font-size: 1rem;
}

.helper-instructions {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    margin-bottom: 2rem;
    border-radius: 8px;
}

body.dark-mode .helper-instructions {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #60a5fa;
}

.helper-instructions p {
    margin: 0;
    color: var(--text-primary);
}

.rating-widget {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 8px;
}

.rating-stars {
    display: flex;
    gap: 0.25rem;
}

.star-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #d1d5db;
    transition: color 0.2s, transform 0.2s;
}

.star-btn:hover {
    transform: scale(1.2);
}

.star-btn.filled {
    color: #fbbf24;
}

.rating-widget input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.rating-widget button[type="submit"] {
    padding: 0.5rem 1rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* ============================================
   Module Browser Styles
   ============================================ */

.module-screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.module-screen-header h2 {
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.module-browser-controls {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.search-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-row input {
    flex: 2;
    min-width: 200px;
}

.search-row select {
    flex: 1;
    min-width: 150px;
}

.module-browser-stats {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.module-browser-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.browser-module-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.browser-module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-hover);
}

.browser-module-card.enrolled {
    border-left: 4px solid #10b981;
}

.browser-module-card h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
}

.browser-module-card .module-code {
    color: #667eea;
    font-weight: 600;
    font-size: 0.9rem;
}

.browser-module-card .module-department {
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.browser-module-card .module-actions {
    margin-top: auto;
    padding-top: 0.75rem;
    display: flex;
    gap: 0.5rem;
}

.btn-view {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s;
    flex: 1;
}

.btn-view:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.btn-add {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
}

.btn-remove {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-remove:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #dc2626;
}

.catalogue-link {
    display: block;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    color: #667eea;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.catalogue-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.browser-info-box {
    background: #dbeafe;
    border-left: 4px solid #3b82f6;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

body.dark-mode .browser-info-box {
    background: rgba(59, 130, 246, 0.1);
    border-left-color: #60a5fa;
}

.browser-info-box p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* Read-only banner for module forums */
.read-only-banner {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
}

body.dark-mode .read-only-banner {
    background: rgba(245, 158, 11, 0.15);
    border-left-color: #fbbf24;
}

.read-only-banner p {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.read-only-banner a {
    color: #d97706;
    font-weight: 600;
    text-decoration: underline;
}

.read-only-banner a:hover {
    color: #b45309;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--shadow);
}

#pageInfo {
    color: var(--text-secondary);
    min-width: 100px;
    text-align: center;
}

/* Delete button for posts */
.btn-delete {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-delete:hover {
    background: #dc2626;
    color: white;
}

/* Module card actions in My Modules */
.module-card-actions {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.module-card-actions .btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
}

/* Empty modules message */
.empty-modules-message {
    text-align: center;
    padding: 3rem 1.5rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    color: var(--text-secondary);
}

.empty-modules-message p {
    margin: 0.5rem 0;
}

.empty-modules-message strong {
    color: var(--text-primary);
}

/* ============================================
   Pinned Post Styles
   ============================================ */

.post-pinned {
    border: 2px solid #f59e0b;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, var(--bg-secondary) 100%);
}

body.dark-mode .post-pinned {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, var(--bg-secondary) 100%);
}

.badge-pinned {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

/* Pin/Unpin buttons */
.btn-pin {
    background: transparent;
    color: #f59e0b;
    border: 1px solid #f59e0b;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-pin:hover {
    background: #f59e0b;
    color: white;
}

.btn-unpin {
    background: #f59e0b;
    color: white;
    border: 1px solid #f59e0b;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-unpin:hover {
    background: #d97706;
    border-color: #d97706;
}

/* ============================================
   Author Badge Styles
   ============================================ */

.author-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.author-academic {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.author-admin {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.author-verified {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.author-tokens {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

/* ============================================
   Role Badge in Header
   ============================================ */

.role-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-left: 0.75rem;
}

.role-student {
    background: #dbeafe;
    color: #1d4ed8;
}

.role-academic {
    background: #ede9fe;
    color: #7c3aed;
}

.role-admin {
    background: #fee2e2;
    color: #dc2626;
}

body.dark-mode .role-student {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

body.dark-mode .role-academic {
    background: rgba(124, 58, 237, 0.2);
    color: #a78bfa;
}

body.dark-mode .role-admin {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* ============================================
   Profile & Leaderboard Styles
   ============================================ */

.profile-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px var(--shadow);
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    font-weight: bold;
}

.profile-info h2 {
    margin: 0 0 0.25rem 0;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.leaderboard-table th {
    background: var(--bg-primary);
    font-weight: 600;
}

.leaderboard-table tr:hover {
    background: var(--bg-primary);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: bold;
}

.rank-1 { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); color: white; }
.rank-2 { background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%); color: white; }
.rank-3 { background: linear-gradient(135deg, #d97706 0%, #92400e 100%); color: white; }

@media (max-width: 768px) {
    .module-screen-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .search-row {
        flex-direction: column;
    }

    .search-row input,
    .search-row select {
        width: 100%;
    }

    .module-browser-list {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

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