/* ============================================================================
   หน้าแผนที่โลก  —  ใช้ธีมเดียวกับหน้า Monster Database
   ----------------------------------------------------------------------------
   พื้นหลังและโลโก้มาจาก ../css/style.css  (ชุดเดียวกับหน้าแรก)
   ไฟล์นี้ดูแลเฉพาะกล่องเนื้อหาและกระเบื้องแผนที่
========================================================================== */

body.custom {
    font-family: Kanit, sans-serif;
    color: #111827;
}

/* กล่องเนื้อหา : ขนาดและระยะเดียวกับหน้า Monster Database เป๊ะ ๆ
   เว้นหัวไว้ 820px ให้โลโก้ที่วางแบบ absolute จาก style.css */
.page-detail-wrap {
    position: relative;
    min-height: 100vh;
    padding-top: 820px;
    padding-bottom: 150px;
    box-sizing: border-box;
}

.page-detail-box {
    position: relative;
    width: 1200px;
    margin: 0 auto;
    padding: 34px 40px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
}

.page-title-box {
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 30px;
    font-weight: 600;
}

/* ============================================================ แถบเครื่องมือ */

.wm-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;

    margin-bottom: 14px;
}

.wm-stats {
    display: flex;
    gap: 10px;
}

.wm-stat {
    padding: 9px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;

    background: #f9fafb;
    color: #6b7280;

    font-size: 12px;
    font-weight: 300;
    text-align: center;
}

.wm-stat span {
    display: block;
    color: #0b3c5d;
    font-size: 20px;
    font-weight: 600;
}

.wm-find {
    display: flex;
    gap: 6px;
}

.wm-find input {
    width: 300px;
    height: 34px;
    padding: 0 12px;

    border: 1px solid #d1d5db;
    border-radius: 8px;

    font-family: Kanit, sans-serif;
    font-size: 13px;
}

.wm-find input:focus {
    outline: none;
    border-color: #0b76bd;
    box-shadow: 0 0 0 3px rgba(11, 118, 189, .15);
}

.wm-find button {
    height: 34px;
    padding: 0 16px;

    border: 0;
    border-radius: 8px;

    background: #e5e7eb;
    color: #374151;

    font-family: Kanit, sans-serif;
    font-size: 13px;
    cursor: pointer;
}

.wm-find button:hover {
    background: #d1d5db;
}

.wm-hint {
    margin-bottom: 22px;
    padding: 10px 14px;

    border-left: 3px solid #0b76bd;
    border-radius: 8px;

    background: #f1f7fc;
    color: #4b5563;

    font-size: 12.5px;
    font-weight: 300;
    line-height: 1.9;
}

.wm-hint a {
    color: #0b76bd;
    text-decoration: none;
    font-weight: 400;
}

.wm-hint a:hover {
    text-decoration: underline;
}

/* ================================================================ หัวข้อส่วน */

.wm-section {
    margin: 26px 0 14px;
    padding-bottom: 8px;

    border-bottom: 1px solid #e5e7eb;

    color: #0b3c5d;
    font-size: 19px;
    font-weight: 600;
}

/* ========================================================== ผังแผนที่โลกใหญ่ */

/* ผังออกแบบไว้ที่ 940 x 770 px  จอแคบให้เลื่อนในกล่องตัวเอง ไม่ดันหน้าเว็บ */
.wm-canvas-wrap {
    overflow-x: auto;
    padding: 10px 0 4px;
}

.wm-canvas {
    position: relative;

    width: 940px;
    height: 780px;
    margin: 0 auto;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    background:
        radial-gradient(circle at 30% 20%, #eef6fd, transparent 60%),
        radial-gradient(circle at 75% 75%, #f3f0fb, transparent 55%),
        #fbfdff;
}

/* ============================================================== กระเบื้องแมพ */

.wm-tile {
    display: block;
    text-decoration: none;
    cursor: pointer;
}

/* ในผังใหญ่ วางตามพิกัดที่กำหนดใน data/maps.php */
.wm-canvas .wm-tile {
    position: absolute;

    width: 50px;
    height: 50px;

    border-radius: 6px;
    transition: transform .13s ease, box-shadow .13s ease, outline-color .13s ease;
}

.wm-tile .wm-map {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
    border-radius: 6px;

    image-rendering: pixelated;
}

/* แมพที่ยังไม่มีไฟล์รูป วาดเป็นป้ายชื่อแทน */
.wm-noimg {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
    padding: 3px;
    box-sizing: border-box;

    border: 1px dashed #cbd5e1;
    border-radius: 6px;

    background: #f1f5f9;
    color: #64748b;

    font-size: 9px;
    line-height: 1.15;
    text-align: center;
}

/* ---------------------------------------------- รูป MVP / มินิบอส บนแผนที่ */

/*  รูปบอสแปะทับมุมขวาบนของแผนที่ ล้นออกมานอกกรอบนิดหน่อยให้เห็นเด่น
    ตัวไหนมีรูปในโฟลเดอร์ worldmap/img จะถูกเอามาโชว์ (ดู wm_bosses ใน index.php)  */
.wm-boss-row {
    position: absolute;
    top: -14px;
    right: -12px;

    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;

    pointer-events: none;
    z-index: 30;
}

.wm-boss {
    width: auto;
    height: auto;

    max-width: 34px;
    max-height: 34px;

    margin-left: -10px;

    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .55));
}

/* ในกล่องดันเจี้ยน กระเบื้องเล็กกว่า รูปบอสเลยย่อลงตาม */
.wm-floor-list .wm-boss {
    max-width: 30px;
    max-height: 30px;
}

.wm-floor-list .wm-boss-row {
    top: -10px;
    right: -6px;
}

/* ชื่อแมพใต้กระเบื้อง : ในผังใหญ่ซ่อนไว้ เพราะกระเบื้องอยู่ชิดกันมาก */
.wm-canvas .wm-label {
    display: none;
}

.wm-tile:hover {
    transform: scale(1.22);
    z-index: 50;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.wm-canvas .wm-tile {
    outline: 2px solid transparent;
    outline-offset: 0;
}

.wm-canvas .wm-tile:hover {
    outline-color: #0b76bd;
}

/* แผนที่ที่ไม่มีมอนสเตอร์เกิด : หน้าตาปกติเหมือนแมพอื่น แค่กดไม่ได้ */
.wm-tile.is-empty {
    cursor: default;
}

.wm-tile.is-empty:hover {
    transform: none;
    box-shadow: none;
    outline-color: transparent;
}

/* ตอนค้นหา : ตัวที่ไม่ตรงจะจางลง ตัวที่ตรงจะเด้งขึ้นมา */
.wm-tile.is-dim {
    opacity: .12;
    filter: grayscale(1);
    pointer-events: none;
}

.wm-tile.is-hit {
    outline: 2px solid #f59e0b !important;
    box-shadow: 0 0 0 4px rgba(245, 158, 11, .3);
    z-index: 40;
}

/* ================================================================ ดันเจี้ยน */

.wm-dungeons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.wm-dungeon {
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fbfaff;
}

.wm-dungeon-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;

    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e5e7eb;
}

.wm-dungeon-name {
    color: #4c2f96;
    font-size: 15px;
    font-weight: 600;
}

.wm-dungeon-sub {
    color: #9ca3af;
    font-size: 11.5px;
    font-weight: 300;
    white-space: nowrap;
}

.wm-floor-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ในกล่องดันเจี้ยน กระเบื้องเรียงต่อกันและมีชื่อกำกับใต้รูป */
.wm-floor-list .wm-tile {
    position: relative;

    width: 74px;
    padding: 5px;
    box-sizing: border-box;

    border: 1px solid #e9e4f6;
    border-radius: 10px;

    background: #fff;
    transition: .15s;
}

/* รูปแมพเป็นสี่เหลี่ยมจัตุรัส 50x50 อยู่แล้ว ใช้ aspect-ratio กันรูปยืด */
/* เจาะจง .wm-map เท่านั้น ไม่งั้นจะไปโดนรูปบอสที่แปะทับด้วย */
.wm-floor-list .wm-tile .wm-map,
.wm-floor-list .wm-tile .wm-noimg {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

.wm-floor-list .wm-label {
    display: block;
    margin-top: 5px;

    color: #6b7280;
    font-size: 9.5px;
    font-weight: 300;
    line-height: 1.25;
    text-align: center;

    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.wm-floor-list .wm-tile:hover {
    transform: translateY(-2px);
    border-color: #6d4fc4;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .12);
}

.wm-floor-list .wm-tile.is-hit {
    border-color: #f59e0b;
}

.wm-floor-list .wm-tile.is-dim {
    display: none;
}

/* กล่องดันเจี้ยนที่ไม่มีชั้นไหนตรงคำค้น ให้ซ่อนทั้งกล่อง */
.wm-dungeon.is-dim {
    display: none;
}

/* ================================================= ข้อความตอนค้นหาไม่เจอ */

.wm-empty {
    display: none;

    margin-top: 20px;
    padding: 40px 0;

    border: 1px dashed #e5e7eb;
    border-radius: 12px;

    color: #9ca3af;
    font-size: 14px;
    text-align: center;
}

.wm-empty.is-show {
    display: block;
}

/* ============================================ ป้ายมอนสเตอร์ตอนเอาเมาส์ชี้ */

.wm-tip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;

    display: none;

    width: 320px;
    max-height: 60vh;
    overflow: hidden;

    border: 1px solid #0b3c5d;
    border-radius: 12px;

    background: #ffffff;
    box-shadow: 0 18px 44px rgba(0, 0, 0, .35);

    pointer-events: none;
}

.wm-tip.is-show {
    display: block;
}

.wm-tip-head {
    padding: 10px 14px;

    background: linear-gradient(90deg, #0b3c5d, #0b76bd);
    color: #fff;

    font-size: 13px;
    font-weight: 500;
    line-height: 1.45;
}

.wm-tip-head small {
    display: block;
    margin-top: 2px;
    color: #bfe3ff;
    font-size: 11px;
    font-weight: 300;
}

.wm-tip-body {
    max-height: 42vh;
    overflow-y: auto;
    padding: 6px 0;
}

.wm-tip-row {
    display: grid;
    grid-template-columns: 1fr 42px 86px;
    gap: 6px;
    align-items: center;

    padding: 5px 14px;
    font-size: 12px;
}

.wm-tip-row + .wm-tip-row {
    border-top: 1px solid #f3f4f6;
}

.wm-tip-row.is-head {
    color: #9ca3af;
    font-size: 10.5px;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
}

.wm-tip-name {
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wm-tip-row.is-boss .wm-tip-name {
    color: #dc2626;
    font-weight: 500;
}

.wm-tip-row.is-boss .wm-tip-name::after {
    content: ' [BOSS]';
    font-size: 9.5px;
}

.wm-tip-amount {
    color: #0b5c93;
    font-weight: 500;
    text-align: right;
}

.wm-tip-time {
    color: #6b7280;
    font-size: 11px;
    font-weight: 300;
    text-align: right;
}

.wm-tip-none {
    padding: 22px 14px;
    color: #9ca3af;
    font-size: 12.5px;
    text-align: center;
}

.wm-tip-foot {
    padding: 8px 14px;
    border-top: 1px solid #e5e7eb;

    background: #f9fafb;
    color: #6b7280;

    font-size: 11px;
    text-align: center;
}

/* ================================================================= จอแคบ */

@media (max-width: 1024px) {

    .wm-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .wm-stats {
        justify-content: space-between;
    }

    .wm-stat {
        flex: 1;
        padding: 8px 6px;
    }

    .wm-find input {
        width: 100%;
        flex: 1;
    }

    .wm-dungeons {
        grid-template-columns: 1fr;
    }

    /* ป้ายบนมือถือกว้างเต็มจอ และไม่ต้องบอกให้คลิก เพราะแตะแล้วไปเลย */
    .wm-tip {
        width: calc(100vw - 24px);
        max-width: 340px;
    }
}

@media (max-width: 480px) {

    .wm-stat span {
        font-size: 16px;
    }

    .wm-floor-list .wm-tile {
        width: 66px;
    }

}
