/* =============================================
   TemplateSelector Weapp 插件样式
   搬运工-小秋手笔 QQ:5793302
   https://www.qiuhai.com
   ============================================= */

/* 遮罩层 */
.tpl-switcher-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, .65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: tplFadeIn .25s ease-out;
}
@keyframes tplFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tplSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* 弹窗主体 */
.tpl-switcher-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 880px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    animation: tplSlideUp .3s ease-out;
}

/* 头部 */
.tpl-switcher-header {
    padding: 24px 32px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.tpl-switcher-header h3 {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}
.tpl-switcher-header h3::before {
    content: "\f0c9";
    font-family: FontAwesome;
    margin-right: 10px;
    color: #ff6f06;
    font-weight: 400;
}
.tpl-switcher-close {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    color: #999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all .2s;
    padding: 0;
}
.tpl-switcher-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* 卡片网格区域 */
.tpl-switcher-grid {
    padding: 24px 32px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 单个风格卡片 */
.tpl-switcher-card {
    border: 2px solid #eee;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all .25s;
    background: #fafafa;
    position: relative;
}
.tpl-switcher-card:hover {
    border-color: #ff6f06;
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(255, 111, 6, .2);
}
.tpl-switcher-card.active {
    border-color: #ff6f06;
    background: #fff7f0;
}
.tpl-switcher-card.active::after {
    content: "\f00c";
    font-family: FontAwesome;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: #ff6f06;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 2;
}

/* 卡片缩略图 */
.tpl-switcher-thumb {
    width: 100%;
    height: 160px;
    background-size: cover;
    background-position: center;
    background-color: #e8e8e8;
    position: relative;
}
.tpl-switcher-card.disabled .tpl-switcher-thumb::after {
    content: "即将上线";
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
}

/* 卡片信息 */
.tpl-switcher-info {
    padding: 14px 18px;
}
.tpl-switcher-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 4px;
}
.tpl-switcher-desc {
    font-size: 13px;
    color: #888;
    line-height: 1.5;
}

/* 底部 */
.tpl-switcher-footer {
    padding: 16px 32px;
    border-top: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: #fafafa;
}
.tpl-switcher-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    user-select: none;
}
.tpl-switcher-remember input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ff6f06;
    cursor: pointer;
}
.tpl-switcher-tip {
    font-size: 12px;
    color: #aaa;
}
.tpl-switcher-tip i {
    color: #ff6f06;
    margin-right: 4px;
}

/* 悬浮切换按钮（胶囊形带文字标签） */
.tpl-switcher-fab {
    position: fixed;
    right: 24px;
    bottom: 100px;
    left: auto;
    top: auto;
    height: 48px;
    min-width: 48px;
    padding: 0 18px 0 16px;
    background: linear-gradient(135deg, #ff6f06, #ff9248);
    color: #fff;
    border-radius: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 111, 6, .45), 0 2px 6px rgba(0,0,0,.08);
    z-index: 99998;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    border: 2px solid rgba(255,255,255,.25);
    overflow: hidden;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
.tpl-switcher-fab i {
    font-size: 18px;
    pointer-events: none;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.tpl-switcher-fab-label {
    pointer-events: none;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.tpl-switcher-fab:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 10px 28px rgba(255, 111, 6, .6), 0 4px 10px rgba(0,0,0,.12);
    background: linear-gradient(135deg, #ff7a1a, #ffa55c);
}
.tpl-switcher-fab:active {
    transform: translateY(-1px) scale(.99);
}
/* 闪烁光晕动画 */
.tpl-switcher-fab::before {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: tplFabShine 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes tplFabShine {
    0%, 100% { left: -100%; }
    50% { left: 100%; }
}
/* FAB 位置类（由 conf 配置决定） */
.tpl-switcher-fab.fab-rb { right: 24px; bottom: 100px; left: auto; top: auto; }
.tpl-switcher-fab.fab-lb { left:  24px; bottom: 100px; right: auto; top: auto; }
.tpl-switcher-fab.fab-rt { right: 24px; top: 100px;   left: auto; bottom: auto; }
.tpl-switcher-fab.fab-lt { left:  24px; top: 100px;   right: auto; bottom: auto; }
.tpl-switcher-fab.fab-rm { right: 24px; top: 50%; transform: translateY(-50%); left: auto; bottom: auto; }
.tpl-switcher-fab.fab-lm { left:  24px; top: 50%; transform: translateY(-50%); right: auto; bottom: auto; }
.tpl-switcher-fab.fab-bc { left: 50%; bottom: 24px; transform: translateX(-50%); right: auto; top: auto; }
.tpl-switcher-fab.fab-tc { left: 50%; top: 24px;    transform: translateX(-50%); right: auto; bottom: auto; }
/* 居中位置 hover 时不覆盖 transform */
.tpl-switcher-fab.fab-rm:hover, .tpl-switcher-fab.fab-lm:hover { transform: translateY(-50%) scale(1.03); }
.tpl-switcher-fab.fab-bc:hover, .tpl-switcher-fab.fab-tc:hover { transform: translateX(-50%) scale(1.03); }

/* ====== FAB 皮肤样式（由 conf 的 fab_skin 决定） ====== */

/* 默认：橙色胶囊（图标+文字） —— 即 .tpl-switcher-fab 基础样式，无需额外覆盖 */

/* 橙色圆形（仅图标） */
.tpl-switcher-fab.skin-orange-circle {
    width: 52px; height: 52px;
    min-width: 52px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
}
.tpl-switcher-fab.skin-orange-circle i { font-size: 22px; }
.tpl-switcher-fab.skin-orange-circle .tpl-switcher-fab-label { display: none; }

/* 蓝紫渐变胶囊 */
.tpl-switcher-fab.skin-purple-capsule {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(255,255,255,.25);
    box-shadow: 0 6px 20px rgba(102,126,234,.45), 0 2px 6px rgba(0,0,0,.08);
}
.tpl-switcher-fab.skin-purple-capsule:hover {
    background: linear-gradient(135deg, #7c8ff0 0%, #8659b5 100%);
    box-shadow: 0 10px 28px rgba(102,126,234,.6), 0 4px 10px rgba(0,0,0,.12);
}
.tpl-switcher-fab.skin-purple-capsule::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
}

/* 深色简约胶囊 */
.tpl-switcher-fab.skin-dark-capsule {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
    border-color: rgba(255,255,255,.15);
    box-shadow: 0 6px 20px rgba(31,41,55,.5), 0 2px 6px rgba(0,0,0,.15);
}
.tpl-switcher-fab.skin-dark-capsule:hover {
    background: linear-gradient(135deg, #2d3a4d 0%, #4b5563 100%);
    box-shadow: 0 10px 28px rgba(31,41,55,.65), 0 4px 10px rgba(0,0,0,.2);
}
.tpl-switcher-fab.skin-dark-capsule::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.2), transparent);
}

/* 彩虹渐变胶囊 */
.tpl-switcher-fab.skin-rainbow-capsule {
    background: linear-gradient(135deg, #ff6f06, #ff9248, #667eea, #764ba2, #10b981);
    background-size: 300% 300%;
    border-color: rgba(255,255,255,.3);
    box-shadow: 0 6px 20px rgba(255,111,6,.4), 0 2px 12px rgba(102,126,234,.3);
    animation: tplFabRainbow 6s ease infinite;
}
.tpl-switcher-fab.skin-rainbow-capsule:hover {
    box-shadow: 0 10px 28px rgba(255,111,6,.5), 0 4px 16px rgba(102,126,234,.4);
}
.tpl-switcher-fab.skin-rainbow-capsule::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.4), transparent);
}
@keyframes tplFabRainbow {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 翠绿圆形（仅图标） */
.tpl-switcher-fab.skin-green-circle {
    width: 52px; height: 52px;
    min-width: 52px;
    padding: 0;
    border-radius: 50%;
    font-size: 0;
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    border-color: rgba(255,255,255,.25);
    box-shadow: 0 6px 20px rgba(16,185,129,.45), 0 2px 6px rgba(0,0,0,.08);
}
.tpl-switcher-fab.skin-green-circle i { font-size: 22px; }
.tpl-switcher-fab.skin-green-circle .tpl-switcher-fab-label { display: none; }
.tpl-switcher-fab.skin-green-circle:hover {
    background: linear-gradient(135deg, #14c896 0%, #3ee0b0 100%);
    box-shadow: 0 10px 28px rgba(16,185,129,.6), 0 4px 10px rgba(0,0,0,.12);
}
.tpl-switcher-fab.skin-green-circle::before {
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
}

/* 加载提示 */
.tpl-switcher-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, .8);
    color: #fff;
    padding: 16px 28px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 100000;
    display: none;
}
.tpl-switcher-loading.show { display: block; }
.tpl-switcher-loading i {
    margin-right: 8px;
}

/* ========== 模板标签样式 ========== */

/* CSS 变量 — 可通过内联 style 覆盖 */
.tpl-sel-inline,
.tpl-sel-navbar,
.tpl-sel-dropdown,
.tpl-sel-select,
.tpl-sel-single {
    --tps-primary: #667eea;
    --tps-primary-hover: #764ba2;
    --tps-font-size: 13px;
    --tps-radius: 10px;
    --tps-bg: #ffffff;
    --tps-text: #374151;
}

/* 通用 */
.tpl-sel-empty {
    padding: 10px 16px;
    color: #9ca3af;
    font-size: var(--tps-font-size);
}

/* 单风格展示 */
.tpl-sel-single {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: var(--tps-bg);
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: var(--tps-font-size);
    color: var(--tps-text);
}
.tpl-sel-single-thumb {
    width: 24px; height: 24px;
    border-radius: 6px;
    background: #e5e7eb center/cover no-repeat;
}

/* ====== Inline 卡片列表 ====== */
.tpl-sel-inline {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tpl-sel-inline-header {
    margin-bottom: 12px;
}
.tpl-sel-inline-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.tpl-sel-inline-title i { color: var(--tps-primary); }
.tpl-sel-inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}
.tpl-sel-inline-item {
    width: 150px;
    border: 2px solid transparent;
    border-radius: var(--tps-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all .2s ease;
    background: var(--tps-bg);
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.tpl-sel-inline-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    border-color: var(--tps-primary);
}
.tpl-sel-inline-item.active {
    border-color: var(--tps-primary);
    box-shadow: 0 4px 16px rgba(102,126,234,.25);
}
.tpl-sel-inline-thumb {
    height: 90px;
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 28px;
}
.tpl-sel-inline-name {
    padding: 8px 10px 4px;
    font-size: var(--tps-font-size);
    font-weight: 500;
    color: var(--tps-text);
}
.tpl-sel-inline-desc {
    padding: 0 10px 10px;
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ====== Navbar Tab ====== */
.tpl-sel-navbar {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    background: var(--tps-bg);
    border-radius: var(--tps-radius);
    border: 1px solid #e5e7eb;
}
.tpl-sel-nav-label {
    color: var(--tps-primary);
    font-size: 16px;
    margin-right: 6px;
    padding-right: 10px;
    border-right: 1px solid #e5e7eb;
}
.tpl-sel-navbar ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2px;
}
.tpl-sel-navbar ul li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--tps-font-size);
    color: var(--tps-text);
    transition: all .15s ease;
    white-space: nowrap;
    user-select: none;
}
.tpl-sel-navbar ul li:hover {
    background: #f3f4f6;
    color: #1f2937;
}
.tpl-sel-navbar ul li.active {
    background: linear-gradient(135deg, var(--tps-primary) 0%, var(--tps-primary-hover) 100%);
    color: #fff;
    font-weight: 500;
}
.tpl-sel-navbar ul li.active:hover {
    background: linear-gradient(135deg, var(--tps-primary) 0%, var(--tps-primary-hover) 100%);
    color: #fff;
}
.tpl-sel-nav-thumb {
    width: 18px; height: 18px;
    border-radius: 4px;
    background: #d1d5db center/cover no-repeat;
}

/* ====== Dropdown 下拉菜单 ====== */
.tpl-sel-dropdown {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tpl-sel-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--tps-bg);
    border: 1px solid #e5e7eb;
    border-radius: var(--tps-radius);
    cursor: pointer;
    font-size: var(--tps-font-size);
    color: var(--tps-text);
    transition: all .15s ease;
    user-select: none;
}
.tpl-sel-dropdown-trigger:hover {
    border-color: var(--tps-primary);
    color: var(--tps-primary);
}
.tpl-sel-dropdown-trigger i { font-size: 14px; }
.tpl-sel-dropdown-arrow { font-size: 10px; transition: transform .2s ease; }
.tpl-sel-dropdown.open .tpl-sel-dropdown-arrow { transform: rotate(180deg); }
.tpl-sel-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: var(--tps-bg);
    border: 1px solid #e5e7eb;
    border-radius: var(--tps-radius);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 6px;
    display: none;
    z-index: 999;
}
.tpl-sel-dropdown.open .tpl-sel-dropdown-menu { display: block; }
.tpl-sel-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: var(--tps-font-size);
    color: var(--tps-text);
    transition: background .12s ease;
}
.tpl-sel-dropdown-item:hover {
    background: #f3f4f6;
}
.tpl-sel-dropdown-item.active {
    background: #eef2ff;
    color: var(--tps-primary);
    font-weight: 500;
}
.tpl-sel-dropdown-thumb {
    width: 24px; height: 24px;
    border-radius: 5px;
    background: #d1d5db center/cover no-repeat;
    flex-shrink: 0;
}
.tpl-sel-dropdown-name { flex: 1; }
.tpl-sel-dropdown-check { color: var(--tps-primary); font-size: 12px; }

/* ====== Select 原生下拉 ====== */
.tpl-sel-select select {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: var(--tps-radius);
    background: var(--tps-bg);
    font-size: var(--tps-font-size);
    color: var(--tps-text);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b7280' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    transition: border-color .15s ease;
}
.tpl-sel-select select:hover,
.tpl-sel-select select:focus {
    border-color: var(--tps-primary);
    outline: none;
}

/* 响应式 */
@media (max-width: 768px) {
    .tpl-sel-inline-item { width: calc(50% - 6px); }
    .tpl-sel-dropdown-menu { min-width: 160px; }
    .tpl-sel-navbar { padding: 0 8px; }
    .tpl-sel-navbar ul li { padding: 4px 8px; font-size: 12px; }
}
