/* ======================================================
   Wiki Styles - valakas.ru
   ====================================================== */

/* === Container === */
.wiki-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

/* === Header === */
.wiki-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 15px;
    border: 1px solid #444;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.wiki-logo-icon {
    font-size: 64px;
    line-height: 1;
}

.wiki-title h1 {
    color: #FF6600;
    font-size: 30px;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.wiki-subtitle {
    color: #E7E0C2;
    font-size: 16px;
    opacity: 0.8;
}

/* === Search === */
.wiki-search-box {
    margin: 0 0 25px 0;
}

.wiki-search-input {
    width: 100%;
    padding: 14px 20px;
    background: #1e1e1e;
    border: 2px solid #3a3a3a;
    border-radius: 12px;
    color: #E7E0C2;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.wiki-search-input:focus {
    border-color: #FF6600;
}

/* === Section Title === */
.section-title {
    font-size: 22px;
    color: #FF6600;
    font-weight: bold;
    text-align: center;
    margin: 30px 0 25px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* === Cards Grid === */
.wiki-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-bottom: 40px;
}

.wiki-link-card {
    background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #3a3a3a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.wiki-link-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(255, 102, 0, 0.15);
    border-color: #FF6600;
}

.wiki-link-card a {
    color: #E7E0C2;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: bold;
    transition: color 0.3s;
}

.wiki-link-card a:hover {
    color: #FF6600;
}

.wiki-card-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.wiki-card-date {
    margin-top: 10px;
    font-size: 12px;
    color: #777;
}

/* === Empty/Not Found === */
.wiki-empty,
.wiki-not-found {
    text-align: center;
    padding: 60px 20px;
}

.wiki-empty-icon,
.wiki-not-found-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.wiki-empty h2,
.wiki-not-found h2 {
    color: #FF6600;
    margin-bottom: 10px;
}

.wiki-empty p,
.wiki-not-found p {
    color: #999;
}

/* === Breadcrumbs === */
.wiki-breadcrumbs {
    margin-bottom: 20px;
    font-size: 14px;
    color: #999;
}

.wiki-breadcrumbs a {
    color: #FF6600;
    text-decoration: none;
}

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

.wiki-bc-sep {
    margin: 0 8px;
    color: #555;
}

/* === Article Layout === */
.wiki-article-layout {
    display: flex;
    align-items: flex-start;
    position: relative;
    overflow: visible;
}

/* === TOC === */
.wiki-toc {
    width: 250px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    background: linear-gradient(145deg, #2a2a2a, #1e1e1e);
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 18px;
    z-index: 10;
}

.wiki-toc-title {
    color: #FF6600;
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #3a3a3a;
}

.wiki-toc-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-toc-item {
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    display: block;
}

.wiki-toc-item:hover {
    color: #FF6600;
    background: rgba(255, 102, 0, 0.1);
}

.wiki-toc-level-3 {
    padding-left: 20px;
    font-size: 12px;
}

/* === Article Content === */
.wiki-article-content {
    flex: 1;
    min-width: 0;
}

.wiki-article-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #3a3a3a;
}

.wiki-article-header h1 {
    color: #FF6600;
    font-size: 32px;
    margin: 0 0 12px 0;
}

.wiki-article-meta {
    display: flex;
    gap: 20px;
    color: #888;
    font-size: 14px;
}

.wiki-meta-icon {
    margin-right: 4px;
}

/* === Article Body Elements === */
.wiki-article-body {
    color: #E7E0C2;
    font-size: 15px;
    line-height: 1.7;
}

.wiki-article-body .wiki-heading {
    color: #FF6600;
    margin: 30px 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #3a3a3a;
}

.wiki-article-body .wiki-h2 {
    font-size: 24px;
}

.wiki-article-body .wiki-h3 {
    font-size: 20px;
    border-bottom: none;
}

.wiki-article-body .wiki-link {
    color: #FF6600;
    text-decoration: none;
    border-bottom: 1px dashed #FF6600;
    transition: all 0.2s;
}

.wiki-article-body .wiki-link:hover {
    color: #FF9944;
    border-bottom-style: solid;
}

.wiki-article-body .wiki-link-missing {
    color: #cc3333;
    border-bottom-color: #cc3333;
}

.wiki-article-body .wiki-image {
    margin: 20px 0;
    text-align: center;
}

.wiki-article-body .wiki-image img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.wiki-article-body .wiki-image figcaption {
    margin-top: 8px;
    font-size: 13px;
    color: #999;
    font-style: italic;
}

.wiki-article-body .wiki-hr {
    border: none;
    border-top: 1px solid #3a3a3a;
    margin: 25px 0;
}

.wiki-article-body .wiki-quote {
    margin: 15px 0;
    padding: 15px 20px;
    background: rgba(255, 102, 0, 0.05);
    border-left: 4px solid #FF6600;
    border-radius: 0 8px 8px 0;
    color: #ccc;
    font-style: italic;
}

.wiki-article-body .wiki-list {
    margin: 10px 0;
    padding-left: 25px;
}

.wiki-article-body .wiki-list li {
    margin-bottom: 5px;
}

.wiki-article-body strong {
    color: #FF6600;
}

/* === Button === */
.wiki-btn {
    display: inline-block;
    padding: 10px 22px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
}

.wiki-btn-primary {
    background: linear-gradient(145deg, #FF6600, #e55a00);
    color: #fff;
}

.wiki-btn-primary:hover {
    background: linear-gradient(145deg, #ff7722, #FF6600);
    box-shadow: 0 4px 15px rgba(255, 102, 0, 0.3);
}

.wiki-btn-secondary {
    background: #2a2a2a;
    color: #E7E0C2;
    border: 1px solid #444;
}

.wiki-btn-secondary:hover {
    background: #333;
    border-color: #FF6600;
}

/* ======================================================
   ADMIN STYLES
   ====================================================== */

.wiki-admin-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.wiki-admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px 25px;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    border-radius: 12px;
    border: 1px solid #444;
}

.wiki-admin-header h1 {
    color: #FF6600;
    font-size: 24px;
    margin: 0;
}

.wiki-admin-actions {
    display: flex;
    gap: 10px;
}

/* === Admin Table === */
.wiki-admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #3a3a3a;
}

.wiki-admin-table thead tr {
    background: linear-gradient(145deg, #2a2a2a, #222);
}

.wiki-admin-table th {
    color: #FF6600;
    font-size: 13px;
    text-transform: uppercase;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid #FF6600;
}

.wiki-admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    color: #E7E0C2;
    font-size: 14px;
}

.wiki-admin-table tbody tr:hover {
    background: rgba(255, 102, 0, 0.05);
}

.wiki-td-title a {
    color: #E7E0C2;
    text-decoration: none;
    font-weight: bold;
}

.wiki-td-title a:hover {
    color: #FF6600;
}

.wiki-td-slug code {
    background: #2a2a2a;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #aaa;
}

.wiki-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.wiki-status-pub {
    background: rgba(0, 180, 0, 0.15);
    color: #4caf50;
}

.wiki-status-draft {
    background: rgba(255, 165, 0, 0.15);
    color: #ffa500;
}

.wiki-btn-sm {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #E7E0C2;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    margin-right: 4px;
}

.wiki-btn-edit:hover {
    border-color: #FF6600;
    color: #FF6600;
}

.wiki-btn-del:hover {
    border-color: #cc3333;
    color: #cc3333;
}

.wiki-admin-total {
    text-align: right;
    padding: 12px 16px;
    color: #777;
    font-size: 13px;
}

/* === Editor Overlay === */
.wiki-editor-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    overflow-y: auto;
    box-sizing: border-box;
}

.wiki-editor-panel {
    width: 100%;
    max-width: 100%;
    background: #1e1e1e;
    border: 1px solid #444;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
}

.wiki-editor-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #333;
}

.wiki-editor-top h2 {
    color: #FF6600;
    margin: 0;
    font-size: 22px;
}

.wiki-btn-close {
    background: none;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

.wiki-btn-close:hover {
    color: #FF6600;
}

/* === Editor Fields === */
.wiki-editor-fields {
    padding: 20px 25px;
}

.wiki-field-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.wiki-field {
    flex: 1;
}

.wiki-field label {
    display: block;
    color: #aaa;
    font-size: 13px;
    margin-bottom: 6px;
    font-weight: bold;
}

.wiki-field input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: #E7E0C2;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.wiki-field input[type="text"]:focus {
    border-color: #FF6600;
}

.wiki-field-check label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #E7E0C2;
}

/* === Toolbar === */
.wiki-editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 10px 25px;
    background: #222;
    border-top: 1px solid #333;
    border-bottom: 1px solid #333;
    align-items: center;
}

.wiki-tb-btn {
    padding: 6px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    color: #E7E0C2;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.wiki-tb-btn:hover {
    border-color: #FF6600;
    color: #FF6600;
    background: #333;
}

.wiki-tb-sep {
    width: 1px;
    height: 20px;
    background: #3a3a3a;
    margin: 0 4px;
}

.wiki-tb-upload {
    background: linear-gradient(145deg, #2e4a2e, #1e3a1e);
    border-color: #3a5a3a;
    color: #88cc88;
}

.wiki-tb-upload:hover {
    border-color: #4caf50;
    color: #4caf50;
}

/* === Tabs === */
.wiki-editor-tabs {
    display: flex;
    gap: 0;
    padding: 0 25px;
    background: #1a1a1a;
}

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

.wiki-tab:hover {
    color: #E7E0C2;
}

.wiki-tab-active {
    color: #FF6600;
    border-bottom-color: #FF6600;
}

/* === Content Area === */
#wikiEditContent {
    width: 100%;
    min-height: 400px;
    padding: 20px 25px;
    background: #1a1a1a;
    border: none;
    color: #E7E0C2;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}

.wiki-preview-body {
    min-height: 400px;
    padding: 20px 25px;
    background: #1a1a1a;
    color: #E7E0C2;
    font-size: 15px;
    line-height: 1.7;
}

/* Preview inherits article body styles */
.wiki-preview-body .wiki-heading {
    color: #FF6600;
    margin: 20px 0 10px;
}

.wiki-preview-body .wiki-h2 {
    font-size: 24px;
    border-bottom: 1px solid #3a3a3a;
    padding-bottom: 8px;
}

.wiki-preview-body .wiki-h3 {
    font-size: 20px;
}

.wiki-preview-body .wiki-link {
    color: #FF6600;
    text-decoration: none;
    border-bottom: 1px dashed #FF6600;
}

.wiki-preview-body .wiki-link-missing {
    color: #cc3333;
    border-bottom-color: #cc3333;
}

.wiki-preview-body .wiki-image {
    margin: 15px 0;
    text-align: center;
}

.wiki-preview-body .wiki-image img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
}

.wiki-preview-body .wiki-image figcaption {
    font-size: 13px;
    color: #999;
    font-style: italic;
    margin-top: 6px;
}

.wiki-preview-body .wiki-hr {
    border: none;
    border-top: 1px solid #3a3a3a;
    margin: 20px 0;
}

.wiki-preview-body .wiki-quote {
    padding: 12px 18px;
    border-left: 4px solid #FF6600;
    background: rgba(255, 102, 0, 0.05);
    margin: 12px 0;
    border-radius: 0 8px 8px 0;
}

.wiki-preview-body .wiki-list {
    padding-left: 25px;
    margin: 10px 0;
}

.wiki-preview-body strong {
    color: #FF6600;
}

/* === Editor Bottom === */
.wiki-editor-bottom {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 25px;
    border-top: 1px solid #333;
}

/* ======================================================
   RESPONSIVE
   ====================================================== */

@media (max-width: 768px) {
    .wiki-header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 20px;
    }

    .wiki-title h1 {
        font-size: 24px;
    }

    .wiki-links-grid {
        grid-template-columns: 1fr;
    }

    .wiki-article-layout {
        flex-direction: column;
    }

    .wiki-toc {
        width: 100%;
        position: static;
        margin-left: 0;
        margin-bottom: 20px;
    }

    .wiki-article-header h1 {
        font-size: 24px;
    }

    .wiki-admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .wiki-editor-overlay {
        padding: 10px;
    }

    .wiki-field-row {
        flex-direction: column;
    }

    .wiki-editor-toolbar {
        padding: 8px 15px;
    }

    .wiki-admin-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .wiki-admin-list {
        overflow-x: auto;
    }

    .wiki-admin-table {
        font-size: 12px;
    }

    .wiki-admin-table th,
    .wiki-admin-table td {
        padding: 8px 10px;
    }
}