/* Wiki Modern Styling with Animations */

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

/* Dark Theme (Buildoria Design - Only Theme) */
:root {
    --primary-color: #a855f7;
    --primary-dark: #9333ea;
    --secondary-color: #06b6d4;
    --accent-color: #c084fc;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-tertiary: #808080;
    --background: #0a0a0a;
    --background-secondary: #1a1a1a;
    --border-color: #2a2a2a;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --transition-speed: 0.3s;
}

html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* Header */
.wiki-header {
    background: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    animation: slideDown 0.6s ease-out;
}

.wiki-header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.wiki-header p {
    font-size: 1.2rem;
    opacity: 0.95;
}

/* Search Bar */
.search-container {
    max-width: 600px;
    margin: -2rem auto 3rem;
    padding: 0 2rem;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box input {
    width: 100%;
    padding: 1rem 3rem 1rem 1.5rem;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-speed);
}

.search-box input:focus {
    outline: none;
    box-shadow: 0 12px 48px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.search-box button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: white;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-speed);
    font-weight: 600;
}

.search-box button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Container */
.wiki-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--background-secondary);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: all var(--transition-speed);
    animation: fadeInUp 0.6s ease-out both;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.stat-card .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.stat-card .label {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.category-card {
    background: var(--background-secondary);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    animation: fadeInUp 0.6s ease-out both;
    border: 2px solid transparent;
}

.category-card:nth-child(1) { animation-delay: 0.2s; }
.category-card:nth-child(2) { animation-delay: 0.3s; }
.category-card:nth-child(3) { animation-delay: 0.4s; }
.category-card:nth-child(4) { animation-delay: 0.5s; }

.category-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.1));
    animation: float 3s ease-in-out infinite;
}

.category-card:nth-child(1) .category-icon { animation-delay: 0s; }
.category-card:nth-child(2) .category-icon { animation-delay: 0.5s; }
.category-card:nth-child(3) .category-icon { animation-delay: 1s; }
.category-card:nth-child(4) .category-icon { animation-delay: 1.5s; }

.category-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.category-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.category-count {
    display: inline-block;
    background: linear-gradient(135deg, #a855f7, #06b6d4);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Page List */
.page-list {
    display: grid;
    gap: 1.5rem;
}

.page-item {
    background: var(--background-secondary);
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
    text-decoration: none;
    color: inherit;
    display: block;
    border-left: 4px solid transparent;
    animation: fadeInUp 0.6s ease-out both;
}

.page-item:hover {
    transform: translateX(8px);
    box-shadow: var(--shadow-md);
    border-left-color: var(--primary-color);
}

.page-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.page-meta {
    display: flex;
    gap: 1.5rem;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    margin-top: 0.75rem;
}

.page-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* Page Content */
.page-content {
    background: var(--background-secondary);
    border-radius: 20px;
    padding: 3rem;
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease-out;
}

.page-content h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-content h2 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.page-content h3 {
    font-size: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.page-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.page-content ul,
.page-content ol {
    margin: 1rem 0 1rem 2rem;
    color: var(--text-secondary);
}

.page-content li {
    margin-bottom: 0.5rem;
}

.page-content code {
    background: var(--background);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.page-content pre {
    background: var(--text-primary);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

/* Tags */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tag {
    background: var(--background);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    transition: all var(--transition-speed);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
    animation: fadeIn 0.6s ease-out;
}

.breadcrumbs a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

.breadcrumbs a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Back Button */
.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--background-secondary);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-speed);
    margin-bottom: 2rem;
    font-weight: 600;
}

.back-button:hover {
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 968px) {
    /* Header adjustments for tablets */
    .wiki-header {
        padding: 2.5rem 1.5rem;
    }

    .wiki-header h1 {
        font-size: 2.5rem;
    }

    .wiki-header p {
        font-size: 1.1rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    /* Stats bar */
    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    /* Page content */
    .page-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    /* Prevent iOS zoom on inputs */
    input,
    textarea,
    select {
        font-size: 16px !important;
    }

    /* Header */
    .wiki-header {
        padding: 2rem 1rem;
    }

    .wiki-header h1 {
        font-size: 2rem;
    }

    .wiki-header p {
        font-size: 1rem;
    }

    /* Search container */
    .search-container {
        margin: -1.5rem auto 2rem;
        padding: 0 1rem;
    }

    .search-box input {
        padding: 0.9rem 2.5rem 0.9rem 1rem;
        font-size: 16px;
    }

    .search-box button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    /* Container */
    .wiki-container {
        padding: 1rem;
    }

    /* Stats bar */
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-bottom: 2rem;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card .icon {
        font-size: 2rem;
    }

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

    .stat-card .label {
        font-size: 0.85rem;
    }

    /* Categories grid */
    .categories-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 2rem;
    }

    .category-card {
        padding: 1.5rem;
    }

    .category-icon {
        font-size: 2.5rem;
    }

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

    .category-description {
        font-size: 0.9rem;
    }

    .category-count {
        font-size: 0.8rem;
        padding: 0.3rem 0.8rem;
    }

    /* Page list */
    .page-list {
        gap: 1rem;
    }

    .page-item {
        padding: 1.25rem;
    }

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

    .page-meta {
        flex-direction: column;
        gap: 0.5rem;
        font-size: 0.85rem;
    }

    /* Page content */
    .page-content {
        padding: 1.5rem;
        border-radius: 15px;
    }

    .page-content h1 {
        font-size: 2rem;
    }

    .page-content h2 {
        font-size: 1.5rem;
    }

    .page-content h3 {
        font-size: 1.25rem;
    }

    .page-content p {
        font-size: 0.95rem;
    }

    .page-content ul,
    .page-content ol {
        margin: 0.75rem 0 0.75rem 1.5rem;
    }

    .page-content pre {
        padding: 1.25rem;
        font-size: 0.85rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Tags */
    .tags {
        gap: 0.4rem;
    }

    .tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 0.85rem;
        flex-wrap: wrap;
        margin-bottom: 1.5rem;
    }

    /* Back button */
    .back-button {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }

    /* Toolbar */
    .wiki-toolbar {
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .toolbar-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
        min-width: 35px;
    }

    .toolbar-separator {
        height: 25px;
    }

    /* Code copy button */
    .code-copy-btn {
        opacity: 1;
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    /* Editor */
    textarea.wiki-editor {
        font-size: 16px;
    }

    .editor-help {
        font-size: 0.8rem;
        padding: 0.6rem;
    }
}

@media (max-width: 480px) {
    /* Extra small mobile devices */

    /* Header */
    .wiki-header {
        padding: 1.5rem 0.75rem;
    }

    .wiki-header h1 {
        font-size: 1.75rem;
    }

    .wiki-header p {
        font-size: 0.9rem;
    }

    /* Search container */
    .search-container {
        margin: -1rem auto 1.5rem;
        padding: 0 0.75rem;
    }

    .search-box input {
        padding: 0.8rem 2rem 0.8rem 0.9rem;
        font-size: 16px;
    }

    .search-box button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        right: 6px;
    }

    /* Container */
    .wiki-container {
        padding: 0.75rem;
    }

    /* Stats bar */
    .stats-bar {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .icon {
        font-size: 1.75rem;
    }

    .stat-card .number {
        font-size: 1.25rem;
    }

    .stat-card .label {
        font-size: 0.8rem;
    }

    /* Categories grid */
    .categories-grid {
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .category-card {
        padding: 1.25rem;
        border-radius: 15px;
    }

    .category-icon {
        font-size: 2.25rem;
    }

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

    .category-description {
        font-size: 0.85rem;
    }

    .category-count {
        font-size: 0.75rem;
        padding: 0.3rem 0.7rem;
    }

    /* Page list */
    .page-list {
        gap: 0.75rem;
    }

    .page-item {
        padding: 1rem;
        border-radius: 12px;
    }

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

    .page-meta {
        font-size: 0.8rem;
    }

    /* Page content */
    .page-content {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .page-content h1 {
        font-size: 1.75rem;
    }

    .page-content h2 {
        font-size: 1.4rem;
        margin-top: 1.5rem;
    }

    .page-content h3 {
        font-size: 1.15rem;
        margin-top: 1.25rem;
    }

    .page-content p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .page-content ul,
    .page-content ol {
        margin: 0.5rem 0 0.5rem 1.25rem;
    }

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

    .page-content code {
        font-size: 0.85em;
        padding: 0.15rem 0.4rem;
    }

    .page-content pre {
        padding: 1rem;
        font-size: 0.8rem;
        border-radius: 8px;
        margin: 1rem 0;
    }

    /* Tags */
    .tags {
        gap: 0.3rem;
    }

    .tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
        border-radius: 12px;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        font-size: 0.8rem;
        margin-bottom: 1.25rem;
    }

    /* Back button */
    .back-button {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        margin-bottom: 1.25rem;
        border-radius: 8px;
    }

    /* Toolbar */
    .wiki-toolbar {
        gap: 0.2rem;
        padding: 0.4rem;
        border-radius: 6px 6px 0 0;
    }

    .toolbar-btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-width: 32px;
        border-radius: 4px;
    }

    .toolbar-separator {
        display: none; /* Hide separators on very small screens */
    }

    /* Code copy button */
    .code-copy-btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        top: 0.4rem;
        right: 0.4rem;
    }

    /* Editor */
    textarea.wiki-editor {
        font-size: 16px;
        padding: 0.75rem;
    }

    .editor-help {
        font-size: 0.75rem;
        padding: 0.5rem;
    }

    /* Loading animation */
    .loading::after {
        width: 30px;
        height: 30px;
        border-width: 3px;
    }
}

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

.loading::after {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Theme Toggle - Removed (Dark theme only) */
.theme-toggle,
#wikiThemeToggle,
.theme-toggle-btn {
    display: none !important;
}

/* Wiki Editor Toolbar */
.wiki-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.wiki-toolbar + textarea {
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}

.toolbar-btn {
    padding: 0.5rem 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.2s;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.toolbar-btn:active {
    transform: translateY(0);
}

.toolbar-btn strong,
.toolbar-btn em,
.toolbar-btn u,
.toolbar-btn s {
    font-style: normal;
    text-decoration: none;
}

.toolbar-separator {
    width: 1px;
    height: 30px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

/* Editor textarea styling */
textarea.wiki-editor {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    tab-size: 4;
}

/* Help text below editor */
.editor-help {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

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

.editor-help code {
    background: var(--background-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}


/* Code Copy Button */
.code-block-wrapper {
    position: relative;
    margin: 1.5rem 0;
}

.code-copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
    opacity: 0;
}

.code-block-wrapper:hover .code-copy-btn {
    opacity: 1;
}

.code-copy-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.code-copy-btn:active {
    transform: translateY(0);
}

.code-copy-btn.copied {
    background: #48bb78;
    color: white;
    border-color: #48bb78;
    opacity: 1;
}

/* Ensure code blocks have proper styling */
.code-block-wrapper pre {
    margin: 0;
}

.page-content pre {
    position: relative;
    padding-top: 2.5rem;
}