/* ============================================
   Memory RO Wiki - CSS
   Dark theme (default) + Light theme
   Blue & Purple accent colors
   ============================================ */

/* --- CSS Variables --- */
:root {
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    --sidebar-w: 260px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-soft: rgba(99, 102, 241, 0.12);
    --purple: #a78bfa;
    --purple-soft: rgba(167, 139, 250, 0.12);
}

/* Dark Theme (default) */
[data-theme="dark"] {
    --bg: #0b0b16;
    --bg-sidebar: #0e0e1c;
    --bg-card: #131325;
    --bg-input: #18182e;
    --bg-hover: #1c1c36;
    --border: #222244;
    --border-light: #2a2a50;
    --text: #e8ecf4;
    --text-secondary: #a0aec0;
    --text-muted: #64748b;
    --shadow: 0 8px 32px rgba(0,0,0,0.4);
    --shadow-sm: 0 2px 12px rgba(0,0,0,0.25);
    --table-stripe: rgba(99, 102, 241, 0.04);
}

/* Light Theme */
[data-theme="light"] {
    --bg: #f7f8fc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0f2f8;
    --bg-hover: #eef0f6;
    --border: #e0e4ee;
    --border-light: #cbd5e1;
    --text: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #94a3b8;
    --shadow: 0 4px 20px rgba(99, 102, 241, 0.06);
    --shadow-sm: 0 2px 8px rgba(99, 102, 241, 0.04);
    --table-stripe: rgba(99, 102, 241, 0.03);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }
img { max-width: 100%; height: auto; }
code { font-family: var(--font-mono); }

/* Theme toggle icons */
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo img {
    width: 140px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.15));
    transition: filter var(--transition);
}

.sidebar-logo img:hover {
    filter: drop-shadow(0 2px 12px rgba(99, 102, 241, 0.3));
}

/* Search */
.sidebar-search {
    padding: 0.75rem 1rem;
    position: relative;
}

.sidebar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
    transition: border-color var(--transition);
}

.sidebar-search input:focus {
    border-color: var(--accent);
}

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

.sidebar-search svg {
    position: absolute;
    left: 1.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0.75rem;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.88rem;
    transition: all var(--transition);
}

.sidebar-link:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

.sidebar-link.sub {
    padding-left: 1.5rem;
    font-size: 0.84rem;
}

.sidebar-link.sub img {
    width: 18px;
    height: 18px;
    image-rendering: pixelated;
    border-radius: 2px;
}

/* Groups */
.sidebar-group {
    margin-top: 0.25rem;
}

.sidebar-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.sidebar-group-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sidebar-group-toggle .chevron {
    transition: transform var(--transition);
}

.sidebar-group.collapsed .chevron {
    transform: rotate(-90deg);
}

.sidebar-group.collapsed .sidebar-group-items {
    display: none;
}

.sidebar-group-items {
    padding: 0.15rem 0 0.35rem 0;
}

/* Footer */
.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 0.25rem;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Mobile toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 200;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 2.5rem 3rem;
    max-width: 1060px;
    min-height: 100vh;
    margin-right: auto;
}

/* Center content in the available space after sidebar */
@media (min-width: 1400px) {
    .main-content {
        margin-left: calc(var(--sidebar-w) + (100vw - var(--sidebar-w) - 1060px) / 2);
    }
}

/* ============================================
   PAGE STYLES
   ============================================ */

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { opacity: 0.5; }
.breadcrumb span:last-child { opacity: 1; color: var(--text-secondary); }

/* Page header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.page-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.page-actions {
    flex-shrink: 0;
}

/* ============================================
   WIKI CONTENT (rendered HTML)
   ============================================ */
.wiki-content {
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.wiki-content h1, .wiki-content h2, .wiki-content h3 {
    color: var(--text);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
}

.wiki-content h1 { font-size: 1.5rem; }

.wiki-content h2 {
    font-size: 1.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.wiki-content h3 { font-size: 1.1rem; }

.wiki-content p { margin-bottom: 1rem; }

.wiki-content ul, .wiki-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.wiki-content li { margin-bottom: 0.4rem; }

.wiki-content a { color: var(--accent); }
.wiki-content a:hover { text-decoration: underline; }

.wiki-content img {
    border-radius: var(--radius-md);
    margin: 0.5rem 0;
}

.wiki-content code {
    background: var(--accent-soft);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--purple);
}

.wiki-content pre {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.wiki-content pre code {
    background: none;
    padding: 0;
}

.wiki-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.wiki-content th, .wiki-content td {
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.88rem;
}

.wiki-content tr:last-child td {
    border-bottom: none;
}

.wiki-content tbody tr:nth-child(even) {
    background: var(--table-stripe);
}

.wiki-content th {
    background: var(--accent-soft);
    color: var(--text);
    font-weight: 600;
    font-size: 0.84rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.wiki-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1rem 0;
    padding: 0.6rem 1rem;
    color: var(--text-muted);
    background: var(--accent-soft);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.wiki-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* ============================================
   HOMEPAGE
   ============================================ */
.homepage-hero {
    text-align: center;
    padding: 2rem 1rem 1.5rem;
}

.homepage-logo {
    width: 180px;
    height: auto;
    margin-bottom: 1.25rem;
    filter: drop-shadow(0 4px 20px rgba(99, 102, 241, 0.25));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.homepage-hero h1 {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.homepage-hero p {
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto;
    font-size: 0.92rem;
    line-height: 1.7;
}

/* Info Sections */
.info-section {
    margin-top: 2rem;
}

.info-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.info-section > p {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 0.75rem;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
}

.info-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

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

.info-card td {
    padding: 0.4rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.info-card td:first-child {
    color: var(--text-muted);
}

.info-card td:last-child {
    text-align: right;
    color: var(--text);
}

.info-card tr:last-child td {
    border-bottom: none;
}

/* Homepage Grid */
.homepage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.guides-grid {
    margin-bottom: 2.5rem;
}

.homepage-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.homepage-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--purple));
    opacity: 0;
    transition: opacity 0.25s ease;
}

.homepage-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    color: var(--text);
}

.homepage-card:hover::before {
    opacity: 1;
}

.homepage-card-icon {
    font-size: 1.5rem;
    margin-bottom: 0.4rem;
    display: block;
}

.homepage-card h3 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.homepage-card p {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ============================================
   SEARCH
   ============================================ */
.search-query {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}

.search-results {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.search-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    color: var(--text);
    transition: all var(--transition);
}

.search-card:hover {
    border-color: var(--accent);
    color: var(--text);
}

.search-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.search-card-cat {
    font-size: 0.75rem;
    color: var(--purple);
    background: var(--purple-soft);
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

.search-card p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
    line-height: 1.5;
}

/* ============================================
   AUTH
   ============================================ */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
}

.auth-card h1 {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.auth-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1rem;
    text-align: center;
}

.auth-hint code {
    background: var(--accent-soft);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    color: var(--purple);
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.85rem;
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: border-color var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

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

.form-group textarea {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
    resize: vertical;
}

.form-group select {
    cursor: pointer;
}

.form-group-sm {
    max-width: 120px;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-row .form-group { flex: 1; min-width: 150px; }

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

/* ============================================
   EDITOR
   ============================================ */
.editor-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    flex-wrap: wrap;
}

.editor-toolbar button {
    padding: 0.3rem 0.6rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.editor-toolbar button:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.toolbar-sep {
    width: 1px;
    background: var(--border);
    margin: 0 0.25rem;
}

.editor-form textarea {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

.editor-preview {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 1.25rem;
    min-height: 300px;
}

/* ============================================
   ADMIN TABLE
   ============================================ */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.admin-table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

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

.admin-table th {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-table td a {
    font-weight: 500;
}

.admin-table td code {
    font-size: 0.8rem;
    background: var(--accent-soft);
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    color: var(--purple);
}

.admin-table-actions {
    display: flex;
    gap: 0.35rem;
    white-space: nowrap;
}

.admin-table input[type="text"],
.admin-table input[type="number"] {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.3rem 0.5rem;
    color: var(--text);
    font-size: 0.85rem;
    outline: none;
}

.admin-table input:focus {
    border-color: var(--accent);
}

.badge {
    display: inline-block;
    font-size: 0.68rem;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.category-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

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

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-danger {
    background: #ef4444;
    color: #fff;
    border-color: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.82rem; }
.btn-xs { padding: 0.25rem 0.6rem; font-size: 0.75rem; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: 0.88rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h2 {
    font-size: 1.2rem;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.empty-state p {
    margin-bottom: 1rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
/* Light theme card polish */
[data-theme="light"] .homepage-card,
[data-theme="light"] .info-card,
[data-theme="light"] .search-card,
[data-theme="light"] .auth-card,
[data-theme="light"] .category-form {
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .homepage-card:hover,
[data-theme="light"] .search-card:hover {
    box-shadow: var(--shadow);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 3.5rem 1.25rem 2rem;
    }

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

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

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

    .info-grid {
        grid-template-columns: 1fr;
    }

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

    .form-group-sm {
        max-width: none;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 3.5rem 0.75rem 1.5rem;
    }

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

    .homepage-card {
        padding: 0.85rem 0.6rem;
    }

    .auth-card {
        padding: 1.5rem;
    }

    .wiki-content table {
        font-size: 0.82rem;
    }
}
