/* ============================================================
   Toka 商品表 · 主题样式 v2
   顶部导航 / 公告 / 搜索 / 左侧分类表 / 右侧商品表
   配色与字号可通过插件配置覆盖（--tk-primary / --tk-radius / --tk-font-size）
   ============================================================ */

@font-face {
    font-family: "TokaInter";
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url("./fonts/inter/inter-v11-latin-300.woff2") format("woff2");
}

@font-face {
    font-family: "TokaInter";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("./fonts/inter/inter-v11-latin-regular.woff2") format("woff2");
}

@font-face {
    font-family: "TokaInter";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("./fonts/inter/inter-v11-latin-500.woff2") format("woff2");
}

@font-face {
    font-family: "TokaInter";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("./fonts/inter/inter-v11-latin-600.woff2") format("woff2");
}

@font-face {
    font-family: "TokaInter";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("./fonts/inter/inter-v11-latin-700.woff2") format("woff2");
}

:root {
    --tk-primary: #4f46e5;
    --tk-primary-dark: #4338ca;
    --tk-primary-soft: #eef0ff;
    --tk-success: #10b981;
    --tk-success-dark: #059669;
    --tk-danger: #ef4444;
    --tk-radius: 12px;
    --tk-font-size: 14px;
    --tk-text: #1f2937;
    --tk-text-soft: #6b7280;
    --tk-text-mute: #9ca3af;
    --tk-line: #e8eaf0;
    --tk-line-soft: #f1f3f8;
    --tk-bg: #f4f5fa;
    --tk-card: #ffffff;
    --tk-shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 6px 20px -10px rgba(17, 24, 39, .12);
}

.tk-body {
    margin: 0;
    padding: 0;
    background: var(--tk-bg);
    color: var(--tk-text);
    font-family: "TokaInter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
    font-size: var(--tk-font-size);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.tk-body *,
.tk-body *::before,
.tk-body *::after {
    box-sizing: border-box;
}

.tk-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ---------------- 顶部导航 ---------------- */
.tk-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--tk-line);
    box-shadow: 0 1px 2px rgba(17, 24, 39, .03);
}

.tk-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 66px;
    gap: 12px;
}

.tk-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--tk-text);
    min-width: 0;
}

.tk-brand:hover {
    color: var(--tk-primary);
    text-decoration: none;
}

.tk-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 10px;
    background: var(--tk-primary-soft);
    flex: 0 0 auto;
}

.tk-shop-title {
    font-size: calc(var(--tk-font-size) + 5px);
    font-weight: 700;
    letter-spacing: .4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tk-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.tk-nav > a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 9px;
    color: var(--tk-text-soft);
    text-decoration: none;
    font-size: calc(var(--tk-font-size) - 0.5px);
    white-space: nowrap;
    transition: background .16s, color .16s;
}

.tk-nav > a:hover {
    background: var(--tk-primary-soft);
    color: var(--tk-primary);
    text-decoration: none;
}

.tk-nav > a i {
    color: var(--tk-text-mute);
    transition: color .16s;
}

.tk-nav > a:hover i {
    color: var(--tk-primary);
}

/* ---------------- 语言切换 ---------------- */
.tk-lang {
    position: relative;
    margin-left: 4px;
}

.tk-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--tk-line);
    border-radius: 9px;
    background: #fff;
    color: var(--tk-text-soft);
    font-size: calc(var(--tk-font-size) - 0.5px);
    font-family: inherit;
    cursor: pointer;
    transition: border-color .16s, color .16s, background .16s;
}

.tk-lang-btn:hover {
    border-color: var(--tk-primary);
    color: var(--tk-primary);
    background: var(--tk-primary-soft);
}

.tk-lang-btn i:first-child {
    font-size: 15px;
    color: var(--tk-primary);
}

.tk-lang-arrow {
    font-size: 12px;
    opacity: .7;
    transition: transform .18s;
}

.tk-lang.tk-open .tk-lang-arrow {
    transform: rotate(180deg);
}

.tk-lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 1200;
    display: none;
    min-width: 168px;
    max-height: 60vh;
    overflow-y: auto;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border: 1px solid var(--tk-line);
    border-radius: 12px;
    box-shadow: 0 18px 40px -16px rgba(17, 24, 39, .28);
}

.tk-lang.tk-open .tk-lang-menu {
    display: block;
}

.tk-lang-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tk-lang-menu li a {
    display: block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--tk-text-soft);
    font-size: calc(var(--tk-font-size) - 0.5px);
    text-decoration: none;
    white-space: nowrap;
    transition: background .14s, color .14s;
}

.tk-lang-menu li a:hover {
    background: var(--tk-primary-soft);
    color: var(--tk-primary);
    text-decoration: none;
}

.tk-lang-menu li.tk-on a {
    background: var(--tk-primary);
    color: #fff;
    font-weight: 600;
}

/* ---------------- 主体 ---------------- */
.tk-main {
    display: block;
    padding: 18px 0 8px;
    min-height: 60vh;
}

.tk-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -8px;
}

.tk-col {
    padding: 0 8px;
    width: 100%;
}

.tk-col-3 {
    width: 25%;
}

.tk-col-9 {
    width: 75%;
}

.tk-col-12 {
    width: 100%;
}

/* ---------------- 卡片 ---------------- */
.tk-card {
    background: var(--tk-card);
    border: 1px solid var(--tk-line);
    border-radius: var(--tk-radius);
    margin-bottom: 16px;
    overflow: hidden;
    box-shadow: var(--tk-shadow);
}

.tk-card-hd {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(180deg, #fbfcfe, #f6f7fb);
    border-bottom: 1px solid var(--tk-line);
    font-size: calc(var(--tk-font-size) + 1px);
    font-weight: 600;
    color: var(--tk-text);
}

.tk-card-hd i {
    color: var(--tk-primary);
    font-size: calc(var(--tk-font-size) + 1px);
}

.tk-card-bd {
    padding: 14px 16px;
}

.tk-notice {
    color: var(--tk-text-soft);
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}

.tk-notice img {
    max-width: 100%;
    height: auto;
    border-radius: calc(var(--tk-radius) - 4px);
}

.tk-notice a {
    color: var(--tk-primary);
}

/* ---------------- 搜索 ---------------- */
.tk-search {
    display: flex;
    gap: 8px;
}

.tk-search input {
    flex: 1 1 auto;
    min-width: 0;
    height: 42px;
    padding: 0 15px;
    border: 1px solid #d9dde8;
    border-radius: 10px;
    font-size: var(--tk-font-size);
    font-family: inherit;
    color: var(--tk-text);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}

.tk-search input::placeholder {
    color: var(--tk-text-mute);
}

.tk-search input:focus {
    border-color: var(--tk-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .13);
}

.tk-search button {
    flex: 0 0 auto;
    height: 42px;
    padding: 0 28px;
    border: 0;
    border-radius: 10px;
    background: var(--tk-success);
    color: #fff;
    font-size: var(--tk-font-size);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, transform .1s, box-shadow .15s;
    box-shadow: 0 6px 14px -8px rgba(16, 185, 129, .9);
}

.tk-search button:hover {
    background: var(--tk-success-dark);
}

.tk-search button:active {
    transform: translateY(1px);
}

/* ---------------- 表格通用 ---------------- */
.tk-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tk-table th,
.tk-table td {
    text-align: left;
    vertical-align: middle;
}

/* ---------------- 左侧分类 ---------------- */
.tk-cat-box {
    padding: 6px;
    max-height: 70vh;
    overflow-y: auto;
}

.tk-cat-table td {
    padding: 0;
    border-bottom: 0;
}

.tk-cat-table tr:last-child td {
    border-bottom: 0;
}

.tk-cat-table a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 9px;
    color: var(--tk-text-soft);
    text-decoration: none;
    font-size: var(--tk-font-size);
    transition: background .15s, color .15s;
}

.tk-cat-table a:hover {
    background: var(--tk-primary-soft);
    color: var(--tk-primary);
    text-decoration: none;
}

.tk-cat-table tr.tk-on a {
    background: var(--tk-primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 18px -12px rgba(79, 70, 229, .95);
}

.tk-cat-table tr.tk-on .tk-count {
    color: rgba(255, 255, 255, .85);
}

.tk-cat-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
    border-radius: 5px;
    flex: 0 0 auto;
}

.tk-cat-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tk-count {
    flex: 0 0 auto;
    color: var(--tk-text-mute);
    font-size: calc(var(--tk-font-size) - 2px);
}

/* ---------------- 商品表 ---------------- */
.tk-shop-box {
    padding: 0;
    overflow-x: auto;
}

.tk-item-table {
    min-width: 560px;
}

.tk-item-table thead th {
    padding: 12px 14px;
    background: #f8f9fc;
    border-bottom: 1px solid var(--tk-line);
    font-size: calc(var(--tk-font-size) - 1px);
    font-weight: 700;
    color: var(--tk-text-soft);
    letter-spacing: .3px;
    white-space: nowrap;
}

.tk-item-table tbody td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--tk-line-soft);
    font-size: var(--tk-font-size);
}

.tk-item-table tbody tr:last-child td {
    border-bottom: 0;
}

.tk-item-table tbody tr {
    transition: background .15s;
}

.tk-item-table tbody tr:hover {
    background: #fafbff;
}

.tk-c-name a {
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--tk-text);
    text-decoration: none;
    min-width: 0;
}

.tk-c-name a:hover {
    color: var(--tk-primary);
    text-decoration: none;
}

.tk-thumb {
    width: 46px;
    height: 46px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--tk-line);
    flex: 0 0 auto;
    background: #f5f7fa;
    transition: transform .18s;
}

.tk-c-name a:hover .tk-thumb {
    transform: scale(1.04);
}

.tk-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    font-weight: 500;
}

.tk-tag {
    flex: 0 0 auto;
    padding: 1px 7px;
    border-radius: 6px;
    background: #fff7ed;
    color: #ea580c;
    font-size: calc(var(--tk-font-size) - 3px);
    line-height: 17px;
    border: 1px solid #ffedd5;
}

.tk-c-price {
    width: 116px;
    white-space: nowrap;
}

.tk-price {
    color: var(--tk-danger);
    font-size: calc(var(--tk-font-size) + 4px);
    font-weight: 700;
    letter-spacing: -.2px;
}

.tk-c-stock {
    width: 92px;
    white-space: nowrap;
}

.tk-stock {
    color: var(--tk-success-dark);
    font-weight: 600;
}

.tk-c-sold {
    width: 84px;
    white-space: nowrap;
    color: var(--tk-text-soft);
}

.tk-c-op {
    width: 96px;
    text-align: right;
    white-space: nowrap;
}

.tk-buy {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 9px;
    background: var(--tk-primary);
    color: #fff;
    font-size: calc(var(--tk-font-size) - 1px);
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, box-shadow .15s, transform .1s;
    box-shadow: 0 8px 18px -12px rgba(79, 70, 229, .95);
}

.tk-buy:hover {
    background: var(--tk-primary-dark);
    color: #fff;
    text-decoration: none;
}

.tk-buy:active {
    transform: translateY(1px);
}

.tk-empty {
    padding: 64px 16px;
    text-align: center;
    color: var(--tk-text-mute);
    font-size: calc(var(--tk-font-size) + 1px);
}

/* ---------------- 页脚 ---------------- */
.tk-footer {
    margin-top: 24px;
    padding: 20px 0 28px;
    border-top: 1px solid var(--tk-line);
    background: #fff;
    color: var(--tk-text-mute);
    font-size: calc(var(--tk-font-size) - 1px);
    text-align: center;
}

.tk-footer p {
    margin: 0;
}

.tk-footer a {
    color: var(--tk-text-soft);
    text-decoration: none;
}

.tk-footer a:hover {
    color: var(--tk-primary);
}

/* ---------------- 内页（商品详情/购物车/结算）适配 ---------------- */
.tk-main > .content {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 15px 0;
}

.tk-main .block {
    border-radius: var(--tk-radius);
    border: 1px solid var(--tk-line);
    box-shadow: var(--tk-shadow);
    overflow: hidden;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 991px) {
    .tk-col-3,
    .tk-col-9 {
        width: 100%;
    }

    .tk-cat-box {
        max-height: 320px;
    }
}

@media (max-width: 767px) {
    .tk-header-inner {
        flex-wrap: wrap;
        min-height: 0;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .tk-shop-title {
        font-size: calc(var(--tk-font-size) + 3px);
    }

    .tk-nav {
        width: 100%;
        justify-content: flex-start;
        gap: 2px;
    }

    .tk-nav > a {
        padding: 6px 9px;
        font-size: calc(var(--tk-font-size) - 1.5px);
    }

    .tk-lang {
        margin-left: auto;
    }

    .tk-lang-btn {
        height: 30px;
        padding: 0 9px;
    }

    .tk-lang-menu {
        right: 0;
    }

    .tk-card-hd {
        padding: 10px 13px;
    }

    .tk-card-bd {
        padding: 12px 13px;
    }

    .tk-search button {
        padding: 0 18px;
    }

    .tk-item-table {
        min-width: 0;
    }

    .tk-item-table thead th,
    .tk-item-table tbody td {
        padding: 10px 9px;
    }

    .tk-c-sold,
    .tk-item-table thead th.tk-c-sold {
        display: none;
    }

    .tk-c-price {
        width: 78px;
    }

    .tk-price {
        font-size: calc(var(--tk-font-size) + 2px);
    }

    .tk-c-op {
        width: 72px;
    }

    .tk-buy {
        padding: 6px 12px;
    }

    .tk-thumb {
        width: 38px;
        height: 38px;
    }
}
