/* =====================================================
   宿宿遊樂園 Bot - 指令總覽  |  style.css
   ===================================================== */

/* Prevent x-overflow on mobile */
html, body { max-width: 100%; overflow-x: hidden; }

/* ---- Variables ---- */
:root {
    --bg-dark:       #080810;
    --bg-card:       rgba(18, 18, 30, 0.55);
    --bg-card-hover: rgba(25, 25, 42, 0.75);
    --border:        rgba(255,255,255,0.08);
    --border-hover:  rgba(255,255,255,0.18);
    --text-main:     #f0f4ff;
    --text-muted:    #8892aa;
    --text-sub:      #b0bad0;

    /* Category accent colours */
    --c-blue:   #3b82f6;
    --c-purple: #8b5cf6;
    --c-pink:   #ec4899;
    --c-green:  #10b981;
    --c-yellow: #f59e0b;
    --c-red:    #ef4444;
    --c-cyan:   #06b6d4;
    --c-orange: #f97316;
    --c-violet: #a78bfa;

    --font: 'Outfit', 'Noto Sans TC', sans-serif;
    --sidebar-w: 260px;
    --r-card: 20px;
    --r-sm:   10px;
    --r-xs:   8px;
}

/* ---- Reset ---- */
html { scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    display: flex;
}

/* =====================================================
   ANIMATED BG ORBS
   ===================================================== */
.orb {
    position: fixed; border-radius: 50%;
    filter: blur(130px); z-index: -1; pointer-events: none;
    animation: orbFloat 22s infinite alternate ease-in-out;
}
.orb-1 { width: 500px; height: 500px; background: var(--c-blue);   top:-15%;  left:-10%; opacity:.35; animation-delay:0s; }
.orb-2 { width: 600px; height: 600px; background: var(--c-purple); bottom:-20%; right:-10%; opacity:.30; animation-delay:-7s; }
.orb-3 { width: 350px; height: 350px; background: var(--c-pink);   top:45%;   left:38%;  opacity:.18; animation-delay:-14s; }

/* Dot grid overlay */
body::before {
    content: '';
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: radial-gradient(circle, rgba(255,255,255,0.045) 1px, transparent 1px);
    background-size: 28px 28px;
}
@keyframes orbFloat {
    0%   { transform: translate(0,0) scale(1); }
    50%  { transform: translate(40px,60px) scale(1.08); }
    100% { transform: translate(-30px,80px) scale(0.92); }
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed; left: 0; top: 0;
    background: rgba(8,8,16,0.9);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    z-index: 200;
    display: flex; flex-direction: column;
    transition: transform 0.35s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-logo {
    text-align: center;
    padding: 1.5rem 1.5rem 1.2rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-logo .logo-emoji { font-size: 2rem; display: block; margin-bottom: 0.25rem; }
.sidebar-logo .logo-name {
    font-size: 1.05rem; font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar-logo .logo-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

/* Stats bar */
.sidebar-stats {
    display: flex; justify-content: space-around;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.03);
    margin: 0.8rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    flex-shrink: 0;
}
.stat-item { text-align: center; }
.stat-num  { font-size: 1.05rem; font-weight: 700; }
.stat-lbl  { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* Nav */
.nav-section-title {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px;
    text-transform: uppercase; color: var(--text-muted);
    padding: 0.4rem 1.5rem;
    flex-shrink: 0;
}
.nav-list { list-style: none; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.nav-link {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.65rem 1.5rem;
    color: var(--text-muted); text-decoration: none;
    font-weight: 500; font-size: 0.9rem;
    border-left: 3px solid transparent;
    border-radius: 0 8px 8px 0;
    transition: all 0.2s ease;
    cursor: pointer;
}
.nav-link:hover  { color: var(--text-main); background: rgba(255,255,255,0.05); }
.nav-link.active {
    color: #fff; background: rgba(255,255,255,0.08);
    border-left-color: var(--cat-color, var(--c-blue));
    text-shadow: 0 0 12px var(--cat-color, var(--c-blue));
}
.nav-link .nav-icon  { width: 16px; text-align: center; font-size: 0.85rem; flex-shrink: 0; }
.nav-link .nav-count {
    margin-left: auto;
    background: rgba(255,255,255,0.08);
    padding: 1px 6px; border-radius: 20px;
    font-size: 0.68rem; color: var(--text-muted);
}

/* =====================================================
   MAIN WRAPPER
   ===================================================== */
.main-wrapper { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; min-width: 0; }

/* =====================================================
   HEADER
   ===================================================== */
header { text-align: center; padding: 4.5rem 1.5rem 2rem; }

.badge {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.35rem 1rem; border-radius: 50px;
    background: rgba(59,130,246,0.12); border: 1px solid rgba(59,130,246,0.3);
    font-size: 0.78rem; font-weight: 600; letter-spacing: 1.5px;
    text-transform: uppercase; margin-bottom: 1rem; color: #93c5fd;
}
.badge-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
    animation: pingPulse 2s infinite;
}
@keyframes pingPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.6); }
    70%  { box-shadow: 0 0 0 8px rgba(34,197,94,0); }
    100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.5} }

h1 {
    font-size: clamp(2rem, 5vw, 3.8rem);
    font-weight: 800; line-height: 1.1; margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 55%, #ec4899 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}
.subtitle {
    color: var(--text-muted); font-size: 1rem;
    max-width: 540px; margin: 0 auto 0.5rem; font-weight: 300;
}
.cmd-ticker {
    display: inline-flex; align-items: center; gap: 0.5rem;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    border-radius: 50px; padding: 0.3rem 0.9rem; font-size: 0.82rem;
    color: var(--text-sub); margin-top: 0.5rem;
}
.cmd-ticker strong { color: var(--c-blue); font-weight: 700; }

/* =====================================================
   SEARCH
   ===================================================== */
.search-wrap { max-width: 620px; margin: 1.5rem auto 0; position: relative; }
.search-input {
    width: 100%; padding: 0.95rem 3rem 0.95rem 3rem;
    border-radius: 50px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    color: #fff; font-size: 0.98rem; font-family: var(--font); outline: none;
    backdrop-filter: blur(12px);
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus {
    background: rgba(255,255,255,0.07); border-color: var(--c-blue);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15), 0 8px 30px rgba(0,0,0,0.25);
}
.search-icon {
    position: absolute; left: 1.1rem; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); pointer-events: none;
}
.search-clear {
    position: absolute; right: 1rem; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    display: none; font-size: 0.9rem; padding: 4px; border-radius: 50%;
    transition: color 0.2s, background 0.2s;
}
.search-clear:hover { color: #fff; background: rgba(255,255,255,0.1); }
.search-results-count { text-align: center; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; min-height: 1.2rem; }

/* =====================================================
   FILTER PILLS
   ===================================================== */
.filter-pills {
    display: flex;
    flex-wrap: nowrap;          /* 永遠不換行 */
    gap: 0.45rem;
    justify-content: flex-start;
    padding: 1rem 1.5rem 0.5rem;
    overflow-x: auto;           /* 橪向捧動 */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;      /* Firefox */
    /* 左右漸層淡出 */
    -webkit-mask: linear-gradient(
        to right,
        transparent 0,
        black 1.2rem,
        black calc(100% - 1.2rem),
        transparent 100%
    );
    mask: linear-gradient(
        to right,
        transparent 0,
        black 1.2rem,
        black calc(100% - 1.2rem),
        transparent 100%
    );
}
.filter-pills::-webkit-scrollbar { display: none; }


.pill {
    padding: 0.38rem 0.9rem; border-radius: 50px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.8rem; font-weight: 500;
    cursor: pointer; transition: all 0.2s ease; white-space: nowrap;
    font-family: var(--font); flex-shrink: 0;
}
.pill:hover  { background: rgba(255,255,255,0.08); color: var(--text-main); }
.pill.active {
    background: var(--pill-bg, rgba(59,130,246,0.2));
    border-color: var(--pill-bd, rgba(59,130,246,0.5));
    color: #fff;
    box-shadow: 0 0 12px var(--pill-bd, rgba(59,130,246,0.3));
}

/* =====================================================
   CARDS GRID
   ===================================================== */
.container {
    max-width: 1300px; margin: 0 auto;
    padding: 1.8rem 1.5rem 6rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 1.6rem;
}

/* ---- Card base ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    padding: 1.8rem;
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    transition: transform 0.3s ease, border-color 0.3s, background 0.3s, box-shadow 0.3s;
    position: relative; overflow: hidden;
    display: flex; flex-direction: column;
    scroll-margin-top: 80px;
}
/* Ambient corner glow */
.card::after {
    content: '';
    position: absolute; inset: 0; border-radius: var(--r-card);
    background: radial-gradient(ellipse at 0% 0%, rgba(255,255,255,0.025) 0%, transparent 55%);
    pointer-events: none;
}
.card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, transparent, var(--cat-color, var(--c-blue)), transparent);
    opacity: 0; transition: opacity 0.3s;
    z-index: 1;
}
.card:hover {
    border-color: color-mix(in srgb, var(--cat-color, var(--c-blue)) 40%, transparent);
    background: var(--bg-card-hover);
    box-shadow:
        0 24px 48px rgba(0,0,0,0.45),
        0 0 0 1px color-mix(in srgb, var(--cat-color, var(--c-blue)) 30%, transparent),
        0 0 40px -8px color-mix(in srgb, var(--cat-color, var(--c-blue)) 25%, transparent);
    transform: translateY(-3px);
}
.card:hover::before { opacity: 1; }
.card.wide { grid-column: 1 / -1; }

/* Category colour vars */
.card.economy  { --cat-color: var(--c-blue); }
.card.fun      { --cat-color: var(--c-pink); }
.card.rpg      { --cat-color: var(--c-yellow); }
.card.music    { --cat-color: var(--c-purple); }
.card.fishing  { --cat-color: var(--c-cyan); }
.card.gaming   { --cat-color: var(--c-orange); }
.card.social   { --cat-color: var(--c-pink); }
.card.level    { --cat-color: var(--c-violet); }
.card.utils    { --cat-color: var(--c-green); }
.card.admin    { --cat-color: var(--c-red); background: rgba(20,8,8,0.6); }

/* ---- Card header ---- */
.card-header { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.4rem; }
.icon-box {
    width: 42px; height: 42px; border-radius: 11px;
    background: rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: var(--cat-color);
    border: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.card-title-wrap { flex: 1; min-width: 0; }
h2 { font-size: 1.15rem; font-weight: 700; }
.card-cmd-count { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ---- Command list ---- */
.cmd-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.cmd-item {
    display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--r-sm);
    background: rgba(255,255,255,0.02); border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    cursor: pointer;
}
.cmd-item:hover {
    background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.08);
    transform: translateX(4px);
}
/* Touch devices: skip translateX (feels sluggish) */
@media (hover: none) {
    .cmd-item:hover { transform: none; background: rgba(255,255,255,0.08); }
}
.cmd-name {
    background: rgba(0,0,0,0.35); color: var(--cat-color);
    padding: 0.18rem 0.6rem; border-radius: 6px;
    font-family: 'Courier New', monospace; font-weight: 700; font-size: 0.85rem;
    white-space: nowrap; flex-shrink: 0;
}
.cmd-desc { color: var(--text-sub); font-size: 0.85rem; flex: 1; min-width: 0; }
.cmd-badge {
    font-size: 0.62rem; padding: 1px 6px; border-radius: 4px;
    font-weight: 600; letter-spacing: 0.3px; flex-shrink: 0;
}
.cmd-badge.admin { background: rgba(239,68,68,0.15); color: #fca5a5; }
.cmd-badge.new   { background: rgba(34,197,94,0.15); color: #86efac; }

/* ---- Admin sub-grid ---- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.4rem; }
.admin-section h3 {
    color: #fca5a5; font-size: 0.85rem; margin-bottom: 0.9rem;
    border-bottom: 1px dashed rgba(252,165,165,0.2); padding-bottom: 0.4rem;
    display: flex; align-items: center; gap: 0.4rem;
}

.hidden { display: none !important; }

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.65); backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; opacity: 0; visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    padding: 1rem;
}
.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-box {
    background: rgba(14,14,24,0.97);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 22px; width: 100%; max-width: 500px;
    padding: 2rem;
    transform: translateY(20px) scale(0.96);
    transition: transform 0.35s cubic-bezier(.175,.885,.32,1.275);
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    position: relative;
}
.modal-overlay.active .modal-box { transform: translateY(0) scale(1); }

.modal-stripe {
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(90deg, transparent, var(--modal-color, var(--c-blue)), transparent);
}
.close-btn {
    position: absolute; top: 1rem; right: 1rem;
    background: rgba(255,255,255,0.07); border: 1px solid var(--border); color: var(--text-muted);
    width: 30px; height: 30px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: background 0.2s, color 0.2s; font-size: 0.9rem;
}
.close-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

#modalTitle {
    font-size: 1.5rem; font-weight: 700; margin-bottom: 0.4rem;
    color: var(--modal-color, #fff); font-family: 'Courier New', monospace;
    word-break: break-all;
}
#modalDesc { color: var(--text-sub); margin-bottom: 1rem; font-size: 0.92rem; }
.usage-box {
    background: rgba(0,0,0,0.4); padding: 0.8rem 1rem; border-radius: var(--r-sm);
    font-family: monospace; color: #c4b5fd; margin-bottom: 0.9rem;
    border: 1px solid rgba(255,255,255,0.05); font-size: 0.88rem; white-space: pre-wrap;
}
.modal-tips {
    font-size: 0.85rem; color: #fde68a;
    background: rgba(251,191,36,0.08); padding: 0.75rem 1rem;
    border-radius: var(--r-sm); display: none;
    border: 1px solid rgba(251,191,36,0.15); margin-bottom: 0.9rem;
}
.modal-tips i { margin-right: 0.4rem; }

.copy-btn {
    width: 100%; padding: 0.8rem; border-radius: var(--r-sm);
    background: linear-gradient(135deg, var(--modal-color, var(--c-blue)), color-mix(in srgb, var(--modal-color, var(--c-blue)) 60%, #000));
    color: #fff; border: none; font-size: 0.98rem; font-weight: 600;
    cursor: pointer; transition: filter 0.2s, transform 0.15s;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: 0.5rem; font-family: var(--font);
}
.copy-btn:hover  { filter: brightness(1.12); transform: translateY(-2px); }
.copy-btn:active { transform: translateY(0); }

/* =====================================================
   FOOTER
   ===================================================== */
footer {
    text-align: center; padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(8,8,16,0.6); backdrop-filter: blur(10px);
}
.footer-text {
    color: var(--text-muted); font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center;
    gap: 0.4rem; flex-wrap: wrap;
}
.footer-text .heart { color: var(--c-pink); animation: blink 2s infinite; }

/* =====================================================
   BACK TO TOP
   ===================================================== */
.back-to-top {
    position: fixed; bottom: 24px; right: 24px;
    width: 44px; height: 44px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem; cursor: pointer; backdrop-filter: blur(10px);
    z-index: 99; opacity: 0; visibility: hidden; transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.back-to-top.visible { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--c-blue); border-color: var(--c-blue); transform: translateY(-3px); }

/* =====================================================
   TOOLTIP
   ===================================================== */
.tooltip {
    position: fixed; background: var(--text-main); color: var(--bg-dark);
    padding: 7px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
    pointer-events: none; opacity: 0; transition: all 0.25s ease; z-index: 2000;
    top: 20px; left: 50%; transform: translateX(-50%) translateY(8px);
}
.tooltip.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* =====================================================
   MOBILE MENU TOGGLE + BACKDROP
   ===================================================== */
.menu-toggle {
    display: none; position: fixed; top: 0.9rem; left: 0.9rem; z-index: 300;
    background: rgba(8,8,16,0.85); border: 1px solid var(--border); color: #fff;
    width: 40px; height: 40px; border-radius: 10px;
    backdrop-filter: blur(10px); cursor: pointer; font-size: 1rem;
    align-items: center; justify-content: center; transition: background 0.2s;
}
.menu-toggle:hover { background: rgba(255,255,255,0.12); }

.sidebar-backdrop {
    display: none; position: fixed; inset: 0; z-index: 199;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(4px);
}
.sidebar-backdrop.active { display: block; }

/* =====================================================
   RESPONSIVE – SMALL DESKTOP / TABLET (≤1366px)
   ===================================================== */
@media (max-width: 1366px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,0.5); }
    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: flex; }
    header { padding-top: 4rem; }
}

/* =====================================================
   RESPONSIVE – MOBILE (≤768px)
   ===================================================== */
@media (max-width: 768px) {
    h1 { font-size: 2rem; }
    .subtitle { font-size: 0.92rem; }

    .container {
        grid-template-columns: 1fr;
        padding: 1.2rem 0.9rem 5rem;
        gap: 1.1rem;
    }
    .card { padding: 1.3rem; border-radius: 16px; }
    .card.wide { grid-column: 1; }

    .admin-grid { grid-template-columns: 1fr; gap: 1.1rem; }

    .pill { font-size: 0.76rem; padding: 0.32rem 0.8rem; }

    .modal-box { padding: 1.5rem; border-radius: 18px; }
    #modalTitle { font-size: 1.25rem; }

    .search-wrap { padding: 0 0.9rem; }

    .back-to-top { bottom: 16px; right: 16px; width: 40px; height: 40px; font-size: 0.9rem; }
}

/* =====================================================
   RESPONSIVE – SMALL MOBILE (≤480px)
   ===================================================== */
@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    .cmd-name { font-size: 0.8rem; }
    .cmd-desc { font-size: 0.8rem; }
    .container { padding: 1rem 0.75rem 5rem; }
}
