@import url('shared.css.php');

/**
 * Personal Wiki - Site-specific CSS
 * Shared styles provided by shared-css.css
 */

/* ============================================
   WIKI BODY OVERRIDES
   ============================================ */
.wiki-body {
    font-size: 0.875rem;
    line-height: 1.6;
}

/* ============================================
   SITE-SPECIFIC VARIABLES
   ============================================ */
:root {
    --sidebar-width: 220px;
}

/* ============================================
   HEADER: Search form (site-specific)
   ============================================ */
.search-form {
    display: flex;
    max-width: 300px;
    flex-grow: 1;
}

.search-form input {
    flex-grow: 1;
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: 2px 0 0 2px;
    font-size: 0.875rem;
}

.search-form input:focus {
    outline: none;
    border-color: var(--color-link);
}

.search-form button {
    padding: 6px 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 0 2px 2px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.search-form button:hover {
    background: var(--color-border-light);
}

/* ============================================
   MAIN LAYOUT
   ============================================ */
.site-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 30px;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.sidebar-section {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.sidebar-section h3 {
    font-size: 0.875rem;
    font-weight: bold;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border-light);
}

.sidebar-section ul {
    list-style: none;
}

.sidebar-section li {
    padding: 3px 0;
}

.sidebar-section .count {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 3px;
    font-size: 0.8rem;
}

.tag:hover {
    background: var(--color-border-light);
    text-decoration: none;
}

.recent-pages li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.recent-pages .date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* Content area */
.content {
    flex-grow: 1;
    min-width: 0;
}

/* ============================================
   ARTICLE STYLES
   ============================================ */
.wiki-article {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 20px 30px;
}

.article-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.article-header h1 {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: normal;
    line-height: 1.3;
    margin-bottom: 5px;
}

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

.article-meta .category {
    margin-right: 15px;
}

.article-actions {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
}

/* Article content - jerz.us style */
.article-content {
    font-family: var(--font-serif);
    line-height: 1.65;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    font-family: var(--font-sans);
    font-weight: normal;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.article-content h1 { font-size: 1.8rem; }
.article-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 5px;
}
.article-content h3 { font-size: 1.2rem; font-weight: bold; }
.article-content h4 { font-size: 1rem; font-weight: bold; }

.article-content p {
    margin-bottom: 1em;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1em;
    padding-left: 2em;
}

.article-content li {
    margin-bottom: 0.25em;
}

.article-content blockquote {
    margin: 1em 0;
    padding: 10px 20px;
    border-left: 4px solid var(--color-border);
    background: var(--color-bg);
}

.article-content pre {
    margin: 1em 0;
    padding: 0.5714em 1.1429em;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border-light);
    border-radius: 0.2857em;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
}

.article-content code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    padding: 1px 0.21429em;
    background: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border-light);
    border-radius: 0.2857em;
}

.article-content pre code {
    padding: 0;
    background: none;
    border: none;
    color: inherit;
}

.article-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--color-border);
    padding: 5px;
    background: var(--color-surface);
}

.article-content table {
    border-collapse: collapse;
    margin: 1em 0;
    width: 100%;
}

.article-content th,
.article-content td {
    border: 1px solid var(--color-border);
    padding: 8px 12px;
    text-align: left;
}

.article-content th {
    background: var(--color-bg);
    font-weight: bold;
}

.article-content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2em 0;
}

.article-tags {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
}

.tags-label {
    font-weight: bold;
    margin-right: 10px;
}

/* ============================================
   PAGE LIST
   ============================================ */
.page-list {
    list-style: none;
}

.page-list li {
    padding: 15px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.page-list li:last-child {
    border-bottom: none;
}

.page-list a.page-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.page-list .meta {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-left: 10px;
}

.page-list .excerpt {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-top: 5px;
}

.page-list .date {
    color: var(--color-text-muted);
    font-size: 0.8rem;
    margin-left: 10px;
}

/* ============================================
   FORMS (site-specific pieces)
   ============================================ */
.slug-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.slug-input-wrapper .slug-prefix {
    padding: 10px 0 10px 12px;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    user-select: none;
}

.slug-input-wrapper input[type="text"] {
    border: none !important;
    box-shadow: none !important;
    padding-left: 4px;
}

.slug-input-wrapper:focus-within {
    border-color: var(--color-link);
    box-shadow: 0 0 0 1px var(--color-link);
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 30px;
}

.login-box h1 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    text-align: center;
}

/* ============================================
   SEARCH PAGE
   ============================================ */
.search-form-large {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.search-form-large input {
    flex-grow: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.search-results {
    margin-top: 20px;
}

.results-count {
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.no-results {
    color: var(--color-text-muted);
    font-style: italic;
}

/* ============================================
   EDITOR PAGE
   ============================================ */
.editor-page {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 20px 30px;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.editor-header h1 {
    font-size: 1.5rem;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 10px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: 2px 2px 0 0;
}

.editor-toolbar button {
    padding: 5px 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    cursor: pointer;
    font-size: 0.875rem;
}

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

.toolbar-separator {
    width: 1px;
    background: var(--color-border);
    margin: 0 5px;
}

.editor-form textarea#content {
    border-radius: 0 0 2px 2px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    min-height: 400px;
}

.preview-panel {
    margin-top: 20px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.preview-content {
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-surface);
    border-radius: 2px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.modal-body {
    padding: 20px;
}

.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: 2px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--color-link);
    background: var(--color-bg);
}

.upload-area p {
    margin: 0;
    color: var(--color-text-muted);
}

.progress-bar {
    height: 4px;
    background: var(--color-bg);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    background: var(--color-link);
    width: 0;
    transition: width 0.3s;
}

/* ============================================
   ADMIN STYLES
   ============================================ */
.admin-page {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 20px 30px;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.admin-header h1 {
    font-size: 1.5rem;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border-light);
}

.admin-nav a {
    padding: 8px 15px;
    border-radius: 2px;
    transition: background 0.15s;
}

.admin-nav a:hover {
    background: var(--color-bg);
    text-decoration: none;
}

.admin-nav a.active {
    background: var(--color-link);
    color: #fff;
}

.admin-nav a.active:hover {
    background: var(--color-accent-hover);
}

.admin-nav a.active:visited {
    color: #fff;
}

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

.stat-card {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 2px;
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--color-link);
}

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

.admin-section {
    margin-bottom: 30px;
}

.admin-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border-light);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

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

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

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

.admin-table tr:hover {
    background: var(--color-bg);
}

.admin-table .actions {
    white-space: nowrap;
}

.admin-table .actions a,
.admin-table .actions button {
    margin-right: 10px;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.admin-form {
    max-width: 500px;
}

.text-muted {
    color: var(--color-text-muted);
}

.text-danger {
    color: var(--color-error);
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    border-radius: 10px;
}

.badge-success {
    background: var(--color-success-bg);
    color: var(--color-success);
}

.badge-danger {
    background: var(--color-error-bg);
    color: var(--color-error);
}

/* ============================================
   MEDIA LIBRARY
   ============================================ */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.media-item {
    border: 1px solid var(--color-border);
    border-radius: 2px;
    overflow: hidden;
}

.media-preview {
    aspect-ratio: 1;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.media-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border: none;
    padding: 0;
}

.media-info {
    padding: 10px;
    background: var(--color-surface);
}

.media-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.media-meta {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.media-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.upload-zone {
    margin-bottom: 20px;
}

.upload-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: var(--color-bg);
    margin-top: 10px;
    border-radius: 2px;
}

.upload-item.success .upload-status {
    color: var(--color-success);
}

.upload-item.error .upload-status {
    color: var(--color-error);
}

/* ============================================
   VERSION HISTORY
   ============================================ */
.version-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

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

.version-table th {
    background: var(--color-bg);
}

.version-view {
    margin-top: 20px;
}

.version-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.version-header h2 {
    margin-bottom: 5px;
}

.version-header p {
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.version-content {
    padding: 20px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 2px;
}

/* ============================================
   HOME SECTIONS
   ============================================ */
.home-section {
    margin-top: 30px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 2px;
    padding: 20px 30px;
}

.home-section h2 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

/* Settings */
.settings-sections {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .site-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }

    .sidebar-section {
        flex: 1;
        min-width: 200px;
        margin-bottom: 0;
    }

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

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

@media (max-width: 600px) {
    .search-form {
        max-width: none;
    }

    .wiki-article,
    .editor-page,
    .admin-page {
        padding: 15px;
    }

    .sidebar-section {
        min-width: 100%;
    }

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

    .admin-nav {
        flex-direction: column;
    }

    .admin-nav a {
        text-align: center;
    }
}

/* ============================================
   SHORTCODE EMBEDS
   ============================================ */
.wiki-embed {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-link);
    border-radius: 3px;
    margin: 1.5em 0;
    background: var(--color-surface);
    overflow: hidden;
}

.wiki-embed-header {
    background: var(--color-border-light);
    padding: 0.45em 0.85em;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--color-text);
}

.wiki-embed-header a {
    color: inherit;
    text-decoration: none;
}

.wiki-embed-header a:hover {
    text-decoration: underline;
}

.wiki-embed-list {
    list-style: none;
    margin: 0;
    padding: 0.5em 0;
}

.wiki-embed-list li {
    padding: 0.3em 0.85em;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.95em;
}

.wiki-embed-list li:last-child {
    border-bottom: none;
}

.wiki-embed-meta {
    color: var(--color-text-muted);
    font-size: 0.85em;
    margin-left: 0.5em;
}

.wiki-embed-empty {
    padding: 0.6em 0.85em;
    color: var(--color-text-muted);
    font-style: italic;
    font-size: 0.9em;
}

.wiki-embed-error {
    border-left-color: var(--color-error);
    color: var(--color-error);
    padding: 0.6em 0.85em;
    font-size: 0.9em;
}

/* page embed */
.wiki-embed-excerpt {
    padding: 0.6em 0.85em;
    font-size: 0.93em;
    color: var(--color-text);
    line-height: 1.5;
}

.wiki-embed-readmore {
    padding: 0.4em 0.85em 0.65em;
    font-size: 0.88em;
}

/* legend / reference card */
.wiki-embed-legend {
    border-left-color: var(--color-success);
}

.wiki-embed-legend-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.wiki-embed-legend-table th,
.wiki-embed-legend-table td {
    padding: 0.4em 0.85em;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.wiki-embed-legend-table th {
    background: var(--color-border-light);
    font-weight: 600;
}

.wiki-embed-legend-table tr:last-child td {
    border-bottom: none;
}

/* Nested category embed */
.wiki-embed-subcategory {
    border-top: 1px solid var(--color-border-light);
}

.wiki-embed-subheader {
    padding: 0.35em 0.85em 0.35em 1.5em;
    font-size: 0.85em;
    font-weight: 600;
    color: var(--color-text-muted);
}

.wiki-embed-subheader a {
    color: var(--color-text-muted);
    text-decoration: none;
}

.wiki-embed-subheader a:hover {
    color: var(--color-link);
    text-decoration: underline;
}

.wiki-embed-subcategory .wiki-embed-list li {
    padding-left: 2em;
}

.wiki-embed-subcategory .wiki-embed-subcategory .wiki-embed-subheader {
    padding-left: 2.75em;
}

.wiki-embed-subcategory .wiki-embed-subcategory .wiki-embed-list li {
    padding-left: 3.25em;
}

/* ============================================
   CATEGORY PAGE
   ============================================ */
.subcategory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.6em;
    margin-bottom: 1.5em;
}

.subcategory-card {
    display: flex;
    flex-direction: column;
    padding: 0.65em 0.85em;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-link);
    border-radius: 3px;
    background: var(--color-surface);
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.15s;
}

.subcategory-card:hover {
    border-left-color: var(--color-accent-hover);
    background: var(--color-highlight);
}

.subcategory-name {
    font-weight: 600;
    font-size: 0.9em;
}

.subcategory-count {
    font-size: 0.8em;
    color: var(--color-text-muted);
    margin-top: 0.15em;
}

/* Category breadcrumb */
.category-breadcrumb {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-bottom: 0.25em;
}

.category-breadcrumb a {
    color: var(--color-link);
}

/* Sidebar nested subcategories */
.sidebar-subcategories {
    margin-left: 0.85em;
    border-left: 2px solid var(--color-border-light);
    padding-left: 0.5em;
    margin-top: 0.15em;
    margin-bottom: 0.15em;
}

.sidebar-subcategories li {
    font-size: 0.92em;
}

/* ============================================
   EDITOR SHORTCODE HELP
   ============================================ */
.shortcode-help {
    background: var(--color-highlight);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    padding: 0.75em 1em;
    margin-top: 0.75em;
    font-size: 0.875em;
    display: none;
}

.shortcode-help.is-open {
    display: block;
}

.shortcode-help summary,
.shortcode-help-title {
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.5em;
}

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

.shortcode-help td {
    padding: 0.2em 0.5em;
    vertical-align: top;
}

.shortcode-help td:first-child {
    white-space: nowrap;
    color: var(--color-link);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .site-header,
    .sidebar,
    .site-footer,
    .article-actions,
    .admin-nav {
        display: none;
    }

    .site-container {
        display: block;
    }

    .content {
        max-width: none;
    }

    .wiki-article {
        border: none;
        padding: 0;
    }
}
