/* ============================================
   Metin2 Wiki Styles
   ============================================ */

/* Wiki layout: dynamic container, col-2 takes remaining space */
.container.wiki-layout {
    width: 90%;
    max-width: 1400px;
}

.container.wiki-layout .col-2 {
    width: calc(100% - 380px);
}

.wiki-frame {
    position: relative;
    margin-bottom: 10px;
    border: 20px solid transparent;
    border-image: url('/assets/main/img/wiki_frame.png') 20 stretch;
}

.wiki-frame-bg {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    background-color: #f0ece4;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(210, 200, 180, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(210, 200, 180, 0.3) 0%, transparent 50%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 2px,
            rgba(200, 190, 170, 0.08) 2px,
            rgba(200, 190, 170, 0.08) 4px
        );
    z-index: 0;
}

.wiki-frame-content {
    position: relative;
    z-index: 2;
    padding: 24px 28px;
    min-height: 400px;
}

.wiki-frame h2 {
    color: #35215f;
    margin: 0 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #35215f;
    font-size: 16px;
}

.wiki-frame h2 a {
    color: #35215f;
}

.wiki-content {
    padding: 0 10px 10px;
    color: #3a2a18;
}

/* --- Search --- */
.wiki-search-wrapper {
    margin-bottom: 20px;
}

.wiki-search {
    position: relative;
}

.wiki-search input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #b8a88a;
    background: #fff;
    color: #3a2a18;
    font-size: 13px;
    border-radius: 3px;
    outline: none;
    box-sizing: border-box;
}

.wiki-search input:focus {
    border-color: #35215f;
    box-shadow: 0 0 4px rgba(53, 33, 95, 0.3);
}

.wiki-search input::placeholder {
    color: #999;
}

.wiki-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #b8a88a;
    border-top: none;
    border-radius: 0 0 3px 3px;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
}

.wiki-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    color: #3a2a18;
    text-decoration: none;
    border-bottom: 1px solid #e8e0d0;
    cursor: pointer;
    font-size: 12px;
}

.wiki-search-item:hover {
    background: #f0e8d8;
    color: #35215f;
}

.wiki-search-item:last-child {
    border-bottom: none;
}

.wiki-search-empty {
    color: #999;
    font-style: italic;
    cursor: default;
}

.wiki-search-item-name {
    flex: 1;
}

.wiki-search-item-vnum {
    color: #999;
    font-size: 11px;
    margin-left: 10px;
}

/* --- Category Grid (Main Page) --- */
.wiki-categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.wiki-category-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #f0e8d8;
    border: 1px solid #b8a88a;
    border-radius: 4px;
    text-decoration: none;
    color: #3a2a18;
    transition: border-color 0.2s, background 0.2s;
}

.wiki-category-card:hover {
    border-color: #35215f;
    background: #e8e0d0;
}

.wiki-category-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-category-icon img {
    max-width: 40px;
    max-height: 40px;
    image-rendering: pixelated;
}

.wiki-category-icon-placeholder {
    width: 40px;
    height: 40px;
    background: #e0d8c8;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #35215f;
    font-weight: bold;
}

.wiki-category-info {
    flex: 1;
    min-width: 0;
}

.wiki-category-info h3 {
    margin: 0;
    font-size: 13px;
    color: #35215f;
    font-weight: bold;
}

.wiki-category-count {
    font-size: 11px;
    color: #8a7a6a;
}

.wiki-category-samples {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.wiki-category-samples img {
    width: 24px;
    height: 24px;
    image-rendering: pixelated;
    opacity: 0.7;
}

/* --- Filters (Category Page) --- */
.wiki-filters {
    margin-bottom: 15px;
}

.wiki-filter-form {
    margin: 0;
}

.wiki-filter-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.wiki-filter-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    border: 1px solid #b8a88a;
    background: #fff;
    color: #3a2a18;
    font-size: 12px;
    border-radius: 3px;
    outline: none;
}

.wiki-filter-input:focus {
    border-color: #35215f;
}

.wiki-filter-input::placeholder {
    color: #999;
}

.wiki-filter-select {
    padding: 6px 10px;
    border: 1px solid #b8a88a;
    background: #fff;
    color: #3a2a18;
    font-size: 12px;
    border-radius: 3px;
    outline: none;
}

.wiki-filter-btn {
    padding: 6px 16px;
    background: #35215f;
    border: 1px solid #2a1a4f;
    color: #fff;
    font-size: 12px;
    border-radius: 3px;
    cursor: pointer;
}

.wiki-filter-btn:hover {
    background: #452970;
}

.wiki-filter-clear {
    color: #35215f;
    font-size: 12px;
    text-decoration: none;
}

.wiki-filter-clear:hover {
    color: #6040a0;
}

/* --- Items Grid (Category Page, non-upgradeable) --- */
.wiki-items-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}

.wiki-item-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: #1e1810;
    border: 1px solid #2a2218;
    border-radius: 3px;
    text-decoration: none;
    color: #d4c4a0;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.wiki-item-card:hover {
    border-color: #8b7355;
    background: #2a2218;
}

.wiki-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.wiki-item-icon img {
    max-width: 32px;
    max-height: 32px;
    image-rendering: pixelated;
}

.wiki-item-icon-placeholder {
    width: 32px;
    height: 32px;
    background: #2a2218;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #5a4a3a;
    font-size: 14px;
}

.wiki-item-name {
    font-size: 10px;
    line-height: 1.2;
    word-break: break-word;
    max-height: 26px;
    overflow: hidden;
}

.wiki-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #7a6a5a;
    font-style: italic;
}

/* --- Pagination --- */
.wiki-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #d4c8b0;
}

.wiki-page-link {
    padding: 5px 12px;
    background: #35215f;
    border: 1px solid #2a1a4f;
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    border-radius: 3px;
}

.wiki-page-link:hover {
    background: #452970;
    color: #fff;
}

.wiki-page-disabled {
    opacity: 0.4;
    cursor: default;
}

.wiki-page-disabled:hover {
    background: #35215f;
    color: #fff;
}

.wiki-page-info {
    color: #8a7a6a;
    font-size: 12px;
}

/* --- Item Detail Page --- */
.wiki-breadcrumb {
    color: #35215f;
    text-decoration: none;
    font-size: 12px;
}

.wiki-breadcrumb:hover {
    color: #6040a0;
}

.wiki-item-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #1e1810 0%, #2a2018 100%);
    border: 1px solid #3a3028;
    border-radius: 4px;
}

.wiki-item-header-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-item-header-icon img {
    max-width: 48px;
    max-height: 48px;
    image-rendering: pixelated;
}

.wiki-item-header-info h3 {
    margin: 0 0 5px;
    font-size: 16px;
    color: #f0dca0;
}

.wiki-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wiki-item-type-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #3a3028;
    border: 1px solid #5a4a3a;
    border-radius: 3px;
    font-size: 11px;
    color: #d4c4a0;
}

.wiki-item-vnum {
    font-size: 11px;
    color: #7a6a5a;
}

/* --- Detail Sections --- */
.wiki-detail-section {
    margin-bottom: 15px;
}

.wiki-detail-section h4 {
    margin: 0 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #3a3028;
    font-size: 13px;
    color: #f0dca0;
}

.wiki-item-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* --- Stats Table --- */
.wiki-stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.wiki-stats-table th {
    text-align: left;
    padding: 5px 8px;
    background: #2a2218;
    border: 1px solid #3a3028;
    color: #d4c4a0;
    font-weight: normal;
}

.wiki-stats-table td {
    padding: 5px 8px;
    border: 1px solid #2a2218;
}

.wiki-stat-label {
    color: #a09080;
}

.wiki-stat-value {
    color: #80d080;
    text-align: right;
    font-weight: bold;
}

/* --- Back Link --- */
.wiki-back-link {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid #d4c8b0;
}

.wiki-back-link a {
    color: #35215f;
    text-decoration: none;
    font-size: 12px;
}

.wiki-back-link a:hover {
    color: #6040a0;
}

/* ============================================
   Upgrade Table (Official Wiki Style)
   ============================================ */

/* --- Item Section (Category Page, upgradeable) --- */
.wiki-item-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #d4c8b0;
}

.wiki-item-section:last-of-type {
    border-bottom: none;
}

.wiki-item-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 10px 12px;
    background: #35215f;
    border: 1px solid #2a1a4f;
    border-radius: 4px;
}

.wiki-item-heading-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-item-heading-icon img {
    max-width: 40px;
    max-height: 40px;
    image-rendering: pixelated;
}

.wiki-item-heading-info {
    flex: 1;
    min-width: 0;
}

.wiki-item-heading-info h3 {
    margin: 0;
    font-size: 14px;
    color: #e8e0f0;
}

.wiki-item-heading-info h3 a {
    color: #e8e0f0;
    text-decoration: none;
}

.wiki-item-heading-info h3 a:hover {
    color: #fff;
    text-decoration: underline;
}

.wiki-item-level {
    display: inline-block;
    font-size: 11px;
    color: #c0b8d0;
    margin-right: 10px;
}

.wiki-item-sockets {
    display: inline-block;
    font-size: 11px;
    color: #8b7355;
}

/* --- Upgrade Table (wiki-style, lighter readable) --- */
.wiki-upgrade-table-wrapper {
    overflow-x: auto;
    margin-bottom: 5px;
}

.wiki-upgrade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: transparent;
    color: #333;
    border: 1px solid #b8a88a;
}

.wiki-upgrade-table thead th {
    padding: 6px 6px;
    background: #35215f;
    border: 1px solid #2a1a4f;
    color: #e8e0f0;
    font-weight: bold;
    text-align: center;
    font-size: 12px;
    white-space: nowrap;
}

.wiki-upgrade-table thead th.wiki-ut-label {
    text-align: left;
    width: 120px;
    min-width: 100px;
    padding-left: 8px;
    color: #e8e0f0;
}

.wiki-upgrade-table tbody td {
    padding: 5px 6px;
    border: 1px solid #d4c8b0;
    text-align: center;
    vertical-align: middle;
    line-height: 1.4;
    color: #3a2a18;
}

.wiki-upgrade-table tbody tr:nth-child(even) td {
    background: #ede6d8;
}

.wiki-upgrade-table tbody tr:nth-child(odd) td {
    background: #f5f0e8;
}

.wiki-upgrade-table tbody td.wiki-ut-label {
    text-align: left;
    color: #e8e0f0;
    font-weight: bold;
    padding-left: 8px;
    background: #35215f;
    white-space: nowrap;
}

/* Stat value colors */
.wiki-ut-att {
    color: #b04010;
    font-weight: bold;
}

.wiki-ut-matt {
    color: #2060a0;
    font-weight: bold;
}

.wiki-ut-def {
    color: #207020;
    font-weight: bold;
}

.wiki-ut-mdef {
    color: #306090;
    font-weight: bold;
}

.wiki-ut-bonus {
    color: #207020;
}

/* Current item column highlight */
.wiki-ut-current {
    background: #d8d0c0 !important;
}

/* Refine rows */
.wiki-ut-refine-row td {
    border-top-color: #b8a88a;
    font-size: 11px;
}

.wiki-ut-refine-row:first-of-type td {
    border-top: 2px solid #b8a88a;
}

.wiki-ut-cost {
    color: #8a6a20;
}

.wiki-ut-mat {
    color: #5a4a38;
}

.wiki-ut-mat-item {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    white-space: nowrap;
}

.wiki-ut-mat-icon {
    width: 20px;
    height: 20px;
    image-rendering: pixelated;
    vertical-align: middle;
}

.wiki-ut-prob {
    color: #207020;
}

/* ============================================
   Legacy Upgrade Chain (kept for item detail)
   ============================================ */
.wiki-upgrade-chain {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wiki-upgrade-step {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.wiki-upgrade-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: #1e1810;
    border: 1px solid #2a2218;
    border-radius: 3px;
    text-decoration: none;
    color: #d4c4a0;
    width: 100%;
    transition: border-color 0.2s;
}

.wiki-upgrade-link:hover {
    border-color: #8b7355;
}

.wiki-upgrade-current .wiki-upgrade-link {
    border-color: #8b7355;
    background: #2a2218;
}

.wiki-upgrade-current .wiki-upgrade-name {
    color: #f0dca0;
    font-weight: bold;
}

.wiki-upgrade-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wiki-upgrade-icon img {
    max-width: 24px;
    max-height: 24px;
    image-rendering: pixelated;
}

.wiki-upgrade-name {
    font-size: 12px;
    flex: 1;
}

.wiki-upgrade-stats {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    font-size: 11px;
}

.wiki-upgrade-att {
    color: #d08040;
}

.wiki-upgrade-matt {
    color: #6090d0;
}

.wiki-upgrade-def {
    color: #60b060;
}

.wiki-upgrade-diff {
    color: #80d080;
    font-size: 10px;
}

.wiki-refine-materials {
    padding: 4px 12px 4px 46px;
    font-size: 11px;
    color: #7a6a5a;
    width: 100%;
    box-sizing: border-box;
}

.wiki-refine-cost {
    color: #d4a040;
}

.wiki-refine-material a {
    color: #8b7355;
    text-decoration: none;
}

.wiki-refine-material a:hover {
    color: #f0dca0;
}

.wiki-refine-prob {
    color: #80d080;
}

.wiki-upgrade-arrow {
    color: #5a4a3a;
    font-size: 14px;
    line-height: 1;
}
