/* ==========================================================================
   SIAMDIY Toolkit - Application Specific Styles
   ========================================================================== */

/* Main Container */
/* คุมความกว้าง Container หลักของหน้า Toolkit */
.wrap {
    flex: 1;
    position: relative;
    z-index: 1;
    max-width: 800px; /* ปรับให้เท่ากับ Container หน้า about.html */
    width: 100%;
    margin: 20px auto 40px;
    padding: 0 20px;
}

.page-head { text-align: center; margin-bottom: 20px; }
.page-title {
    font-size: clamp(1.8rem, 4vw, 2.3rem);
    color: var(--text-white);
    margin-bottom: 5px;
    font-weight: 500;
}
.text-orange { color: var(--accent-orange); }

.tagline {
    color: var(--sub-text);
    font-weight: 300;
    font-size: 0.95rem;
    margin-bottom: 15px;
}

/* Hero Banner */
/* แก้ไขรูป Banner ให้เข้ารูป สวยงาม ไม่ล้นขอบ */
.hero {
    margin-top: 15px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--secondary-dark);
    overflow: hidden; /* บังคับตัดขอบรูปที่ล้น */
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}
.hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: cover;
    object-position: center;
    cursor: zoom-in;
}
.hero figcaption { display: none; padding: 20px; text-align: center; color: var(--sub-text); font-size: 14px; }
.hero.empty img { display: none; }
.hero.empty figcaption { display: block; }

/* Control Bar (Search, Meter, Chips) */
.bar {
    position: sticky;
    top: 70px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(10px);
    padding: 14px 16px;
    margin-top: 20px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.meter { flex: 1 1 220px; min-width: 200px; }
.meter .track { height: 10px; background: rgba(255, 255, 255, 0.1); border-radius: 5px; overflow: hidden; }
.meter .fill { height: 100%; background: #10b981; width: 0; transition: width .3s; }
.meter small { color: var(--sub-text); font-size: 12px; }

.bar input[type=search] {
    font: inherit;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-white);
    flex: 1 1 160px;
}
.bar input[type=search]:focus { outline: 2px solid var(--accent-orange); border-color: transparent; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.bar button {
    font: inherit;
    font-size: 13px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-white);
    cursor: pointer;
    transition: all 0.2s ease;
}
.bar button[aria-pressed=true] {
    background: var(--accent-orange);
    color: #ffffff;
    border-color: var(--accent-orange);
    font-weight: 500;
}
.bar button:hover:not([aria-pressed=true]) { border-color: var(--accent-orange); color: var(--accent-orange); }

.updated { color: var(--sub-text); font-size: 13px; margin: 12px 0 0; text-align: right; }

/* Item Catalog List */
.info-section { margin-top: 32px; }
.tape {
    display: inline-block;
    background: var(--accent-orange);
    color: #ffffff;
    font-weight: 500;
    font-size: 15px;
    padding: 4px 14px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}

.items {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(5px);
}
.items li {
    display: grid;
    grid-template-columns: 28px 60px 1fr auto;
    gap: 4px 14px;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--line);
    transition: background 0.2s;
}
.items li:first-child { border-top: 0; }
.items li:hover { background: rgba(255, 255, 255, 0.02); }
.items li.hidden { display: none; }

.no { color: var(--sub-text); font-size: 13px; text-align: right; }
.thumb {
    grid-row: 1/4;
    width: 60px; height: 60px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.name { font-weight: 400; font-size: 15px; color: var(--text-white); }
.rec {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid var(--accent-orange);
    color: var(--accent-orange);
}

.right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; grid-row: 1/3; grid-column: 4; }
.qty { font-weight: 500; font-size: 14px; color: var(--text-white); }
.st { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 12px; white-space: nowrap; }
.st.y { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.st.p { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); border: 1px solid rgba(249, 115, 22, 0.3); }
.st.o { background: rgba(168, 85, 247, 0.15); color: #a855f7; border: 1px solid rgba(168, 85, 247, 0.3); }
.st.n { background: rgba(244, 63, 94, 0.15); color: #f43f5e; border: 1px solid rgba(244, 63, 94, 0.3); }

.note { grid-column: 3; color: var(--sub-text); font-size: 13px; font-weight: 300; }
.buy { grid-column: 3; font-size: 12px; margin-top: 2px; }
.buy a { color: var(--accent-orange); margin-right: 12px; text-decoration: none; font-weight: 400; }
.buy a:hover { text-decoration: underline; }

.soft { background: rgba(30, 41, 59, 0.6); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; margin-top: 14px; backdrop-filter: blur(5px); }
.soft a { color: var(--accent-orange); text-decoration: none; }
.soft a:hover { text-decoration: underline; }
.soft ul { margin: 0; padding-left: 20px; font-size: 14px; }
.soft li { padding: 4px 0; color: var(--sub-text); font-weight: 300; }

.cta-section { text-align: center; margin-top: 50px; }

/* Lightbox Modal */
dialog { border: 0; border-radius: 12px; padding: 16px; max-width: min(92vw, 850px); background: #1e293b; color: var(--text-white); border: 1px solid var(--line); }
dialog::backdrop { background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(4px); }
dialog img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; border-radius: 8px; }
dialog p { margin: 12px 0 8px; text-align: center; color: var(--sub-text); font-size: 14px; }
dialog button { margin: 0 auto; display: block; }

@media (max-width: 560px) {
    .items li { grid-template-columns: 20px 48px 1fr auto; gap: 2px 10px; padding: 10px 12px; }
    .thumb { width: 48px; height: 48px; }
    .bar { top: 60px; }
}