@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #d4af37;
    /* Metin2 Gold */
    --primary-glow: rgba(212, 175, 55, 0.4);
    --accent: #ffbf00;
    /* Amber */
    --bg-dark: #0a0a0a;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-thick: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --text-dim: #b0b0b0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* Enhanced Liquid Background */
.background-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1a1a1a 0%, #050505 100%);
    overflow: hidden;
}

.liquid-blob {
    position: absolute;
    width: 600px;
    height: 600px;
    background: linear-gradient(45deg, var(--primary-glow), transparent);
    filter: blur(80px);
    border-radius: 50%;
    animation: move 20s infinite alternate;
    opacity: 0.3;
}

.liquid-blob:nth-child(2) {
    background: linear-gradient(-45deg, #4a3300, transparent);
    width: 800px;
    height: 800px;
    right: -200px;
    bottom: -200px;
    animation-delay: -5s;
    opacity: 0.2;
}

@keyframes move {
    from {
        transform: translate(-10%, -10%) rotate(0deg);
    }

    to {
        transform: translate(20%, 20%) rotate(360deg);
    }
}

/* Premium Glass Container */
.glass-panel {
    background: var(--glass);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* Modern Navigation */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    margin-bottom: 40px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary);
    position: relative;
}

.logo span::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.search-container {
    padding: 10px 20px;
    position: relative;
}

.search-input {
    background: transparent;
    border: none;
    color: white;
    width: 250px;
    outline: none;
    font-size: 16px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    margin-top: 10px;
    z-index: 1000;
    overflow: hidden;
    display: none;
}

.search-item {
    padding: 12px 20px;
    color: #fff;
    text-decoration: none;
    display: block;
    transition: 0.2s;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background: var(--primary);
    color: #000;
    font-weight: 600;
}

/* Breadcrumbs */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
    font-size: 13px;
    color: var(--text-dim);
}

.breadcrumb a {
    color: var(--text-dim);
    text-decoration: none;
    transition: 0.3s;
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb span.separator {
    opacity: 0.3;
    font-size: 10px;
}

.breadcrumb span.current {
    color: var(--primary);
    font-weight: 600;
}

/* Wiki Content */
.main-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Full-Width Wiki Layout & Inline TOC */
.wiki-container {
    display: block;
    width: 100%;
}

.content-panel {
    width: 100%;
    padding: 50px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
}

.inline-toc {
    margin: 30px 0;
    padding: 10px 0;
    border-radius: 0;
    background: transparent;
    border: none;
    display: none;
    max-width: 400px;
}

.toc-title {
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 20px;
    opacity: 0.7;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    border-left: 2px solid rgba(255, 255, 255, 0.05);
}

.toc-item {
    position: relative;
}

.toc-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s ease;
    display: block;
    padding: 6px 0 6px 12px;
    line-height: 1.4;
    border-left: 3px solid transparent;
    margin-left: -2px;
}

.toc-link:hover {
    color: #fff;
    padding-left: 18px;
}

.toc-link.active {
    color: var(--primary);
    font-weight: 700;
    border-left-color: var(--primary);
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.08), transparent);
    border-radius: 0 10px 10px 0;
}

.toc-h3 {
    padding-left: 28px;
    font-size: 13px;
}

.toc-h4 {
    padding-left: 44px;
    font-size: 12px;
}

.wiki-sidebar {
    display: none !important;
}

@media (max-width: 1200px) {
    .wiki-container {
        flex-direction: column;
    }

    .wiki-sidebar {
        width: 100%;
        position: static;
        order: -1;
        /* Show before content on mobile */
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Portal UI Components */
.hero-section {
    text-align: center;
    margin-bottom: 60px;
}

.hero-section p {
    font-size: 20px;
    color: var(--text-dim);
    max-width: 700px;
    margin: 0 auto;
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.portal-card {
    padding: 35px;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.portal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-glow), transparent);
    opacity: 0;
    transition: 0.4s;
}

.portal-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 20px var(--primary-glow);
}

.portal-card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 40px;
    background: var(--glass-thick);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
}

.card-body h3 {
    color: var(--primary);
    font-size: 22px;
    margin-bottom: 8px;
    transition: 0.3s;
}

.portal-card:hover .card-body h3 {
    color: #fff;
    text-shadow: 0 0 10px var(--primary);
}

.card-body p {
    font-size: 15px;
    color: var(--text-dim);
}

.card-footer {
    margin-top: auto;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.empty-state {
    padding: 60px;
    text-align: center;
    border: 2px dashed var(--glass-border);
}

.empty-state p {
    margin-bottom: 30px;
    color: var(--text-dim);
    font-size: 18px;
}

/* Admin Specific */
.admin-sidebar {
    width: 280px;
}

.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-box {
    background: var(--glass-thick);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px 20px;
    color: white;
    font-size: 16px;
    width: 100%;
    outline: none;
    transition: 0.3s;
}

.input-box:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    color: #000;
    font-weight: 800;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px var(--primary-glow);
}

#scrape-result {
    margin-top: 20px;
    padding: 20px;
    border-radius: 12px;
    display: none;
}

.badge {
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-published {
    background: rgba(0, 255, 0, 0.1);
    color: #00ff00;
    border: 1px solid rgba(0, 255, 0, 0.2);
}

.badge-pending {
    background: rgba(255, 191, 0, 0.1);
    color: #ffbf00;
    border: 1px solid rgba(255, 191, 0, 0.2);
}

/* --- COMPACT & MINIMAL WIKI CONTENT --- */

.main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
    width: 100%;
}

/* --- PREMIUM MODAL SYSTEM --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    width: 90%;
    max-width: 600px;
    padding: 40px;
    position: relative;
    animation: modalIn 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--glass-thick);
    border: 1px solid var(--glass-border);
    color: #fff;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: 0.3s;
}

.modal-close:hover {
    background: #ff0000;
    transform: rotate(90deg);
}

.modal-body {
    color: var(--text);
    font-size: 16px;
    word-break: break-all;
}

.modal-title {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 20px;
    font-weight: 800;
}

.modal-text-area {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 15px;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    color: #00ff00;
    /* Terminal green for errors */
}

.content-panel {
    padding: 30px 40px;
    /* Reduced from 60px */
    margin-top: 15px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
}

.title {
    font-size: clamp(24px, 3vw, 40px);
    /* Reduced size */
    font-weight: 800;
    margin-bottom: 20px;
    /* Reduced from 40px */
    letter-spacing: -1px;
    background: linear-gradient(to right, #ffffff, var(--primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.wiki-body {
    display: block;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    /* Reduced from 18px */
    line-height: 1.6;
    width: 100%;
}

/* Responsive Table Container (Wrapper approach is safer) */
/* Compact Tables */
.wiki-body table {
    width: 100% !important;
    max-width: 100% !important;
    margin: 20px 0;
    /* Reduced margin */
    border-collapse: collapse;
    /* Better alignment with collapse */
    border-spacing: 0;
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    table-layout: auto;
    overflow: hidden;
}

/* Ensure table internal parts behave like a table despite display:block on parent */


.wiki-body th {
    background: rgba(139, 0, 0, 0.4) !important;
    /* Dark Red Accent */
    color: #fff !important;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
    letter-spacing: 1px;
    padding: 12px 15px;
    /* Reduced from 20px */
    border: 1px solid var(--glass-border);
    text-align: center !important;
    /* Center headers */
}

.wiki-body td {
    padding: 10px 15px;
    /* Reduced from 20px */
    border: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    text-align: center;
    /* Generally center Metin2 table data */
    background: rgba(255, 255, 255, 0.01);
    font-size: 14px;
}

.wiki-body tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* Fix for overlapping cards and nested stat boxes (the green tables) */
.wiki-body .wikitable,
.wiki-body table[style*="color:#89b88d"],
.wiki-body table[style*="color: #89b88d"] {
    display: inline-block !important;
    margin: 15px !important;
    vertical-align: top !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    float: none !important;
    /* Force stop floating */
    clear: none !important;
    background: rgba(0, 0, 0, 0.7) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 12px !important;
    padding: 10px !important;
    color: #89b88d !important;
    /* Preserve the green identity */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
    width: auto !important;
}

/* Ensure the main container wraps these inline-blocks correctly */
.wiki-body .wikitable>tbody,
.wiki-body .wikitable>tr,
.wiki-body .wikitable>td {
    display: inline !important;
    /* Reset the previously forced blocks */
    background: transparent !important;
    border: none !important;
}

/* Specific fix for the 'image over text' overlap seen in the screenshot */
.wiki-body table table td {
    position: relative !important;
    padding: 12px !important;
    display: table-cell !important;
    /* Back to normal table cell behavior for internal content */
}

/* Re-apply the flex container for the PARENT wikitable only if it's a layout table */
.wiki-body div>.wikitable,
.wiki-body .mw-parser-output>.wikitable {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* --- METIN2 SPECIFIC ITEM & UPGRADE BOXES --- */
/* Handle nested tables often used for upgrade paths */
.wiki-body table table {
    margin: 10px;
    width: auto !important;
    display: inline-table;
    /* Prevent full width takeover */
    vertical-align: top;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

/* Item boxes / tooltips from wiki */
.wiki-body .metin2-item-box,
.wiki-body .item-box,
.wiki-body .upgrade-box {
    background: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 15px !important;
    padding: 15px !important;
    margin: 10px !important;
    display: inline-block !important;
    vertical-align: top;
    min-width: 180px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

/* Align values (like +5, +6) similar to the requested minimal look */
.wiki-body .metin2-item-box b,
.wiki-body .item-box b {
    color: #ffcc00;
    display: block;
    margin-bottom: 5px;
}

/* Advanced Infobox (Responsive) */
/* Compact Infobox */
.wiki-body .infobox,
.wiki-body .item-info {
    float: right;
    width: 300px;
    /* Reduced from 380px */
    max-width: 100%;
    margin: 0 0 25px 30px;
    /* Reduced margin */
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    padding: 20px;
    /* Reduced padding */
}

@media (max-width: 992px) {

    .wiki-body .infobox,
    .wiki-body .item-info {
        float: none;
        width: 100%;
        margin: 0 0 30px 0;
    }

    .content-panel {
        padding: 30px;
    }
}

/* Section Headers */
.wiki-body h2 {
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 800;
    color: #fff;
    margin: 40px 0 20px;
    /* Reduced from 80px */
    padding-left: 15px;
    border-left: 3px solid var(--primary);
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.06), transparent);
}

.wiki-body h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
    margin: 25px 0 12px;
}

/* Minimal Modern Lists */
/* Minimal Lists */
.wiki-body ul,
.wiki-body ol {
    margin: 15px 0;
    padding: 0;
    list-style: none;
    /* Removed bullets as requested */
}

.wiki-body li {
    margin-bottom: 6px;
    /* Reduced from 15px */
    padding: 6px 15px;
    /* Reduced padding */
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Yellow Links, No Underline */
.wiki-body a {
    color: #ffcc00 !important;
    /* Vivid Yellow */
    text-decoration: none !important;
    font-weight: 700;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wiki-body a:hover {
    color: #fff !important;
    text-shadow: 0 0 15px #ffcc00;
    transform: scale(1.02);
    display: inline-block;
}

/* Image Layout Fixes */
.wiki-body img {
    max-width: 100%;
    height: auto !important;
    border-radius: 8px;
    display: inline-block;
    /* Allow horizontal alignment */
    vertical-align: middle;
    filter: drop-shadow(0 5px 15px rgba(0, 0, 0, 0.3));
    transition: 0.3s;
}

.wiki-body .thumb {
    margin: 20px 0;
    clear: both;
}

.wiki-body .tright {
    float: right;
    margin-left: 20px;
    clear: right;
}

.wiki-body .tleft {
    float: left;
    margin-right: 20px;
    clear: left;
}

.wiki-body .thumbinner {
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    display: inline-block;
    text-align: center;
}

.wiki-body .thumbcaption {
    font-size: 13px;
    color: var(--text-dim);
    margin-top: 8px;
    text-align: left;
}

/* Gallery Support */
.wiki-body .gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin: 20px 0;
    justify-content: center;
}

.wiki-body .gallerybox {
    width: 150px;
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 10px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.wiki-body .gallerybox img {
    max-height: 120px;
    width: auto;
}

.wiki-body .gallerytext {
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-dim);
}

/* Lightbox System */
.wiki-body img {
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.lightbox-overlay img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 10px;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
}

.wiki-body::after {
    content: "";
    display: table;
    clear: both;
}