/*
 * Modern monochrome glass theme.
 * Keeps the original markup and business logic intact while replacing the
 * saturated anime/neon styling with flat black-white surfaces.
 */
:root {
    color-scheme: light;
    --theme-overlay: rgba(255, 255, 255, 0.38);
    --theme-bg: #f1f3f5;
    --theme-bg-soft: #ffffff;
    --theme-surface: rgba(255, 255, 255, 0.38);
    --theme-glass-edge: rgba(255, 255, 255, 0.92);
    --theme-surface-solid: #ffffff;
    --theme-surface-muted: rgba(255, 255, 255, 0.26);
    --theme-text: #111111;
    --theme-text-muted: #666666;
    --theme-text-faint: #8a8a8a;
    --theme-border: rgba(17, 17, 17, 0.09);
    --theme-border-strong: rgba(17, 17, 17, 0.22);
    --theme-accent: #111111;
    --theme-accent-soft: rgba(17, 17, 17, 0.08);
    --theme-shadow: inset 0 1px 0 var(--theme-glass-edge), 0 12px 32px rgba(17, 17, 17, 0.06);
    --theme-shadow-soft: inset 0 1px 0 var(--theme-glass-edge), 0 4px 18px rgba(17, 17, 17, 0.035);
    --theme-radius: 8px;
}

:root[data-theme="dark"] {
        color-scheme: dark;
        --theme-overlay: rgba(0, 0, 0, 0.38);
        --theme-bg: #121214;
        --theme-bg-soft: #222225;
        --theme-surface: rgba(255, 255, 255, 0.065);
        --theme-glass-edge: rgba(255, 255, 255, 0.22);
        --theme-surface-solid: #151517;
        --theme-surface-muted: rgba(255, 255, 255, 0.045);
        --theme-text: #f6f6f6;
        --theme-text-muted: #b8b8b8;
        --theme-text-faint: #858585;
        --theme-border: rgba(255, 255, 255, 0.14);
        --theme-border-strong: rgba(255, 255, 255, 0.24);
        --theme-accent: #ffffff;
        --theme-accent-soft: rgba(255, 255, 255, 0.10);
        --theme-shadow: inset 0 1px 0 var(--theme-glass-edge), 0 12px 32px rgba(0, 0, 0, 0.20);
        --theme-shadow-soft: inset 0 1px 0 var(--theme-glass-edge), 0 4px 18px rgba(0, 0, 0, 0.12);
}

html {
    background: var(--theme-bg);
}

body {
    min-height: 100vh;
    background: linear-gradient(180deg, var(--theme-bg-soft) 0%, var(--theme-bg) 100%) !important;
    background-image: linear-gradient(180deg, var(--theme-bg-soft) 0%, var(--theme-bg) 100%) !important;
    color: var(--theme-text) !important;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif !important;
    letter-spacing: 0;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(17, 17, 17, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(17, 17, 17, 0.035) 1px, transparent 1px);
    background-size: 28px 28px;
    opacity: 0.5;
}

@media (prefers-color-scheme: dark) {
    body::before {
        background-image:
            linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
            linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
        opacity: 0.32;
    }
}

.navbar,
.header,
.footer {
    background: rgba(255, 255, 255, 0.74) !important;
    border-color: var(--theme-border) !important;
    box-shadow: 0 1px 0 var(--theme-border), 0 16px 44px rgba(17, 17, 17, 0.06) !important;
    backdrop-filter: blur(18px) saturate(150%);
    -webkit-backdrop-filter: blur(18px) saturate(150%);
}

@media (prefers-color-scheme: dark) {
    .navbar,
    .header,
    .footer {
        background: rgba(15, 15, 17, 0.72) !important;
        box-shadow: 0 1px 0 var(--theme-border), 0 16px 44px rgba(0, 0, 0, 0.34) !important;
    }
}

.ui-card,
.card,
.product-card,
.modal,
.pay-card,
.skeleton-card,
.result-section,
.toast {
    background: var(--theme-surface) !important;
    border: 1px solid var(--theme-border) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: var(--theme-shadow-soft) !important;
    backdrop-filter: blur(14px) saturate(120%);
    -webkit-backdrop-filter: blur(14px) saturate(120%);
}

#wxBtn, #zfbBtn {
    background: var(--theme-surface-muted) !important;
    border-color: var(--theme-border-strong) !important;
    color: var(--theme-text) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: none !important;
}
#wxBtn[aria-pressed="true"], #zfbBtn[aria-pressed="true"] {
    background: var(--theme-accent) !important;
    border-color: var(--theme-accent) !important;
    color: var(--theme-bg-soft) !important;
}
#wxBtn span, #zfbBtn span { color: inherit !important; }
#wxBtn[aria-pressed="true"] svg path, #zfbBtn[aria-pressed="true"] svg path { fill: currentColor; }

.toast,
.toast .toast-message,
.toast .toast-close {
    color: var(--theme-text) !important;
}

.product-card:hover,
.card:hover,
.ui-card:hover {
    border-color: var(--theme-border-strong) !important;
    box-shadow: var(--theme-shadow) !important;
    transform: translateY(-2px);
}

.btn,
.btn-buy,
.btn-primary,
.back-merchant-btn {
    background: var(--theme-accent) !important;
    border: 1px solid var(--theme-accent) !important;
    color: var(--theme-bg-soft) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: none !important;
    font-weight: 600;
}

.btn:hover,
.btn-buy:hover,
.btn-primary:hover,
.back-merchant-btn:hover {
    filter: brightness(0.88);
    transform: translateY(-1px);
}

.btn-outline,
.btn-login,
.btn-cancel,
.cate-btn {
    background: var(--theme-surface-muted) !important;
    border: 1px solid var(--theme-border-strong) !important;
    color: var(--theme-text) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: none !important;
}

.btn-outline:hover,
.btn-login:hover,
.btn-cancel:hover,
.cate-btn:hover,
.cate-btn.active,
.nav-item.active {
    background: var(--theme-accent-soft) !important;
    border-color: var(--theme-accent) !important;
    color: var(--theme-text) !important;
    box-shadow: none !important;
}

.ui-input,
.form-input,
input,
textarea,
select,
select.ui-input {
    background: var(--theme-surface-muted) !important;
    border: 1px solid var(--theme-border) !important;
    color: var(--theme-text) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: none !important;
}

.ui-input:focus,
.form-input:focus,
input:focus,
textarea:focus,
select:focus,
select.ui-input:focus {
    outline: none !important;
    border-color: var(--theme-accent) !important;
    box-shadow: 0 0 0 3px var(--theme-accent-soft) !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--theme-text-faint) !important;
}

select option,
select.ui-input option {
    background: var(--theme-surface-solid) !important;
    color: var(--theme-text) !important;
}

table {
    color: var(--theme-text) !important;
}

thead tr,
tbody tr,
.step-item,
[class*="border-orange-"],
[class*="border-yellow-"],
[class*="border-blue-"] {
    border-color: var(--theme-border) !important;
}

tbody tr:hover,
.nav-item:hover,
[class*="hover:bg-white"] {
    background: var(--theme-accent-soft) !important;
}

.logo,
.logo i,
.logo h1,
.price-text,
#money,
[class*="text-orange-"],
[class*="text-yellow-"],
[class*="text-blue-"],
[class*="text-indigo-"],
[class*="text-purple-"],
[class*="text-pink-"] {
    color: var(--theme-text) !important;
}

[class*="text-gray-300"],
[class*="text-gray-400"],
[class*="text-gray-500"],
.product-desc,
.form-label,
.step-msg,
.order-info,
.detail,
.foot,
.footer,
.loading-text,
.tip-text,
.lang-switch {
    color: var(--theme-text-muted) !important;
}

[class*="bg-orange-"],
[class*="bg-yellow-"],
[class*="bg-blue-"],
[class*="bg-indigo-"],
[class*="bg-purple-"],
[class*="bg-pink-"],
[class*="bg-gray-700"],
[class*="bg-gray-800"],
[class*="bg-black"] {
    background-color: var(--theme-accent-soft) !important;
}

.tag-auto,
.tag-recommend,
.time-item strong {
    background: var(--theme-accent) !important;
    color: var(--theme-bg-soft) !important;
    border-radius: 6px !important;
    box-shadow: none !important;
}

.modal-backdrop,
#buyModal,
#payModal,
#orderModal,
#kfModal,
#addProductModal,
#addCardsModal,
#viewCardsModal,
#orderDetailModal {
    background: var(--theme-overlay) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.video-container {
    background: var(--theme-surface-muted) !important;
    border: 1px solid var(--theme-border) !important;
    border-radius: var(--theme-radius) !important;
    box-shadow: none !important;
}

.video-placeholder {
    background: rgba(0, 0, 0, 0.28) !important;
}

.play-icon {
    color: var(--theme-accent) !important;
}

.skeleton {
    background: linear-gradient(90deg, rgba(127, 127, 127, 0.08) 25%, rgba(127, 127, 127, 0.18) 50%, rgba(127, 127, 127, 0.08) 75%) !important;
    background-size: 200% 100% !important;
}

.custom-checkbox .checkmark {
    background: var(--theme-surface-muted) !important;
    border-color: var(--theme-border-strong) !important;
}

.custom-checkbox input[type="checkbox"]:checked ~ .checkmark {
    background: var(--theme-accent) !important;
    border-color: var(--theme-accent) !important;
}

::-webkit-scrollbar-track {
    background: transparent !important;
}

::-webkit-scrollbar-thumb {
    background: rgba(127, 127, 127, 0.45) !important;
    border: 0 !important;
    box-shadow: none !important;
}

body {
    scrollbar-color: rgba(127, 127, 127, 0.45) transparent !important;
}

.qr-code-area img {
    background: #ffffff !important;
    border: 1px solid var(--theme-border) !important;
    border-radius: 8px !important;
    padding: 10px;
}

.placeholder-art {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 9rem;
    background: var(--theme-surface-muted);
    border: 1px solid var(--theme-border);
    color: var(--theme-text-muted);
}

.home-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 32px;
    padding: 24px 0 28px;
    border-bottom: 1px solid var(--theme-border);
}
.home-notice, .home-service { min-width: 0; }
.home-service { border-left: 1px solid var(--theme-border); padding-left: 32px; }
.intro-heading {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--theme-text);
    overflow-wrap: anywhere;
}
.intro-heading i { color: var(--theme-text-muted); font-size: 14px; flex-shrink: 0; }
#announcementContent {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 12px;
    font-size: 14px;
    line-height: 1.9;
    color: var(--theme-text-muted);
    scrollbar-width: thin;
}
#announcementContent:focus-visible { outline: 2px solid var(--theme-border-strong); outline-offset: 4px; }
.service-summary { font-size: 14px; line-height: 1.9; color: var(--theme-text-muted); overflow-wrap: anywhere; margin: 0 0 16px; }
.service-summary:empty { display: none; }
.home-service .video-container { height: auto; aspect-ratio: 16 / 9; max-height: 320px; box-shadow: none !important; }
.home-service .video-container[hidden] { display: none; }
.home-service .video-container img, .home-service .video-container video {
    position: static;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
@media (max-width: 767px) {
    .home-intro { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 16px; }
    .home-service { border-left: 0; padding-left: 0; border-top: 1px solid var(--theme-border); padding-top: 24px; }
    #announcementContent { max-height: 220px; }
}

#cateBox {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: flex-start;
    gap: 4px 8px;
    padding: 4px 0 8px;
    border-bottom: 1px solid var(--theme-border);
}
#cateBox:empty { display: none; }
#cateBox .cate-btn {
    position: relative;
    min-height: 44px;
    max-width: 100%;
    padding: 10px 16px;
    background: transparent !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    color: var(--theme-text-muted) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 24px;
    text-align: center;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}
#cateBox .cate-btn::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    border-radius: 1px;
    background: transparent;
}
#cateBox .cate-btn:hover {
    background: var(--theme-accent-soft) !important;
    color: var(--theme-text) !important;
}
#cateBox .cate-btn.active { color: var(--theme-text) !important; }
#cateBox .cate-btn.active::after { background: var(--theme-text); }
@media (max-width: 767px) {
    #cateBox { gap: 4px; }
    #cateBox .cate-btn { padding: 10px 12px; }
    #cateBox .cate-btn::after { left: 12px; right: 12px; }
}

/* Shared controls and explicit theme selection across every entry page. */
body::before { display: none; }
.navbar, .header, .footer {
    background: var(--theme-surface) !important;
    box-shadow: 0 1px 0 var(--theme-border) !important;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    background: var(--theme-surface);
    color: var(--theme-text);
    cursor: pointer;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
}
.theme-toggle:hover { background: var(--theme-accent-soft); }
.theme-toggle-floating { position: fixed; top: 16px; right: 16px; z-index: 60; }
button:focus-visible, a:focus-visible, .theme-toggle:focus-visible {
    outline: 2px solid var(--theme-text);
    outline-offset: 3px;
}
.ui-card, .card, .product-card {
    box-shadow: var(--theme-shadow-soft) !important;
    transition: border-color .18s ease, box-shadow .18s ease;
    min-width: 0;
}
.ui-card:hover, .card:hover { transform: none; box-shadow: var(--theme-shadow-soft) !important; }
.product-card:hover { transform: none; box-shadow: var(--theme-shadow-soft) !important; }
.product-card img { border-radius: 6px; }
.product-card h3, .navbar a, .navbar .font-bold { overflow-wrap: anywhere; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select {
    min-height: 40px;
    padding: 8px 12px;
    max-width: 100%;
}
input, textarea, select { transition: border-color .15s ease, box-shadow .15s ease; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--theme-accent); }
.search-field {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border);
    min-height: 40px;
    border-radius: 8px;
}
.search-field:focus-within {
    border-color: var(--theme-text);
    box-shadow: 0 0 0 3px var(--theme-accent-soft);
}
.search-field input, .search-field input:focus {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    min-height: 28px !important;
    padding: 0 !important;
}
.btn, .btn-buy, .btn-outline, .btn-login { min-height: 36px; }
.btn:disabled, .btn-buy:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.admin-sidebar { position: sticky; top: 84px; border-right: 1px solid var(--theme-border); }
.admin-sidebar .nav-item { min-height: 44px; display: flex; align-items: center; border: 1px solid transparent; border-radius: 6px; }
.admin-sidebar .nav-item.active { font-weight: 600; border-color: var(--theme-border) !important; }
.admin-page #content > .content-wrapper > .ui-card {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none;
    padding: 8px 0;
}
.admin-page #content .flex.justify-between { flex-wrap: wrap; gap: 12px; }
.admin-page #content .flex.items-center.gap-2 { flex-wrap: wrap; }
.admin-page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-page th { background: var(--theme-accent-soft); color: var(--theme-text-muted); font-weight: 500; white-space: nowrap; }
.admin-page th, .admin-page td { padding: 14px 16px; border-bottom: 1px solid var(--theme-border); }
.admin-page td { max-width: 320px; overflow-wrap: anywhere; }
.admin-page tbody tr { transition: background-color .15s ease; }
.admin-page .text-white:not(button) { color: var(--theme-text) !important; }
.admin-page button.bg-orange-500 { color: var(--theme-text) !important; }
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.step-title { color: var(--theme-text) !important; }
.result-desc { color: var(--theme-text-muted) !important; }
@media (max-width: 767px) {
    .navbar { position: sticky !important; top: 0; }
    .navbar ~ .pt-20 { padding-top: 16px; }
    .navbar > .container { height: auto; min-height: 64px; flex-wrap: wrap; gap: 8px; padding-top: 10px; padding-bottom: 10px; }
    .navbar > .container > div { gap: 8px; min-width: 0; }
    .navbar .text-xl { font-size: 16px; }
    .navbar .btn-login, .navbar .btn-outline { padding: 6px 8px; font-size: 12px; }
    .admin-sidebar { position: static; border-right: 0; border-bottom: 1px solid var(--theme-border); padding: 0 0 12px; }
    .admin-sidebar > div { display: flex; flex-wrap: wrap; gap: 4px; }
    .admin-sidebar .nav-item { margin: 0 !important; font-size: 13px; min-height: 38px; }
    .admin-page th, .admin-page td { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
