/**
 * app.css - 主样式表
 * 从原 index.html 提取的布局与组件样式
 */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', Tahoma, Arial, sans-serif;
}

/* ===== 三栏布局（flex 自适应） ===== */
.layui-container {
    width: 100%;
    height: calc(100% - 40px);
    overflow: hidden;
}

.layui-row {
    height: 100%;
    margin: 0;
}

/* 仅顶层三栏行使用 flex，不影响 widgetList 内部 layui 网格 */
.layui-container > .layui-row {
    display: flex;
}

.column {
    height: 100%;
    flex-shrink: 0;
}

.column1 {
    width: 270px;
    min-width: 200px;
    background-color: #f2f2f2;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.column3 {
    width: 300px;
    min-width: 200px;
    background-color: #f2f2f2;
    overflow-y: auto;
    border-left: 1px solid #e6e6e6;
}

.column2 {
    flex: 1;
    min-width: 0;
    overflow: auto;
    background-color: #aeadac;
    position: relative;
}

/* ===== 顶部导航 ===== */
.layui-nav {
    position: relative;
    padding: 0 15px;
    background-color: #ffffff;
    color: #000000;
    font-size: 0;
    box-sizing: border-box;
}

.layui-nav .layui-nav-item {
    position: relative;
    display: inline-block;
    margin-top: 0;
    list-style: none;
    vertical-align: middle;
    line-height: 40px;
}

/* ===== 顶部品牌（PulseFrame 脉搏帧帧）===== */
/* 注：.layui-nav 是 font-size:0，所以每个文字项都必须自己声明字号 */
.layui-nav .nav-brand {
    white-space: nowrap;
}

/* 副标题（Slogan）：任何屏宽都保留 */
.layui-nav .nav-slogan {
    margin-right: 20px;
    font-size: 13px;
    font-style: italic;
    color: rgba(255, 255, 255, .85);
    white-space: nowrap;
}

/* 更新提示（版本号 + 本版改动） */
.layui-nav .nav-sub {
    font-size: 12px;
    color: rgba(255, 255, 255, .78);
    letter-spacing: .3px;
    white-space: nowrap;
}

/* 能力口号 */
.layui-nav .nav-tag {
    font-size: 11px;
    color: rgba(255, 255, 255, .62);
    white-space: nowrap;
}

/* 右侧按钮组为绝对定位（最近的一个在 right:240px）：窄屏逐级折叠附加文字，品牌与副标题始终保留 */
@media (max-width: 1280px) {
    .layui-nav .nav-tag { display: none; }
}

@media (max-width: 1050px) {
    .layui-nav .nav-sub { display: none; }
}

/* ===== 左侧组件选择器 ===== */
.tt {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    display: flex;
    flex-direction: row;
    padding-top: 5px;
}

#tabBodyWrap {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    height: 100%;
    overflow: hidden;
}

#widgetList {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

#shopContainer {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ===== 面板切换（原生 / 本地 / 共享），位于 DashB 与分类列表之上 ===== */
.panel-tabs {
    flex: none;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 4px 0 6px;
}

.panel-tabs .tab {
    min-width: 52px;
    padding: 4px 12px;
    font-size: 13px;
    border: 1px solid #CCC;
    background: #f7f7f7;
    text-align: center;
}

.panel-tabs .tab:hover {
    background: #e8e8e8;
}

.panel-tabs .tab.layui-this {
    background: #5FB878;
    border-color: #5FB878;
    color: #fff;
    font-weight: 600;
}

/* ===== 本地 / 共享 自定义组件卡片 ===== */
#localContainer,
#sharedContainer {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

.custom-comp-head {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 10px 6px;
    font-size: 12px;
    color: #888;
}

.custom-comp-head .cch-count {
    display: inline-block;
    min-width: 16px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 9px;
    background: #5FB878;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.custom-comp-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 8px 10px;
}

.custom-comp-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #DDD;
    border-left: 4px solid #5FB878;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: box-shadow .15s, border-color .15s, background .15s, transform .08s;
}

.custom-comp-card.src-shared {
    border-left-color: #1E9FFF;
}

.custom-comp-card:hover {
    background: #F5FFFA;
    border-color: #5FB878;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.custom-comp-card.src-shared:hover {
    background: #F2F9FF;
    border-color: #1E9FFF;
}

.custom-comp-card:active {
    transform: scale(.99);
}

.custom-comp-card.on-canvas {
    border-color: #5FB878;
    background: #EFFFB5;
}

.cc-thumb {
    flex: none;
    width: 40px;
    height: 40px;
    border-radius: 5px;
    background: linear-gradient(135deg, #3B3B4D, #5A5A75);
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Shared 卡片：上下结构 —— 1:1 通栏概览图在上，信息在下 */
.custom-comp-card.src-shared {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.cc-media {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    border-radius: 5px;
    background: linear-gradient(135deg, #3B3B4D, #5A5A75);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cc-media.cc-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cc-media-fallback {
    font-size: 42px;
    font-weight: 700;
}

.cc-body {
    min-width: 0;
}

.cc-author {
    margin-top: 2px;
    font-size: 12px;
    font-weight: 600;
    color: #1E9FFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.custom-comp-card.src-shared .cc-actions {
    margin-top: 6px;
    justify-content: flex-end;
}

.cc-desc {
    margin-top: 2px;
    font-size: 11px;
    color: #888;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 分页加载提示（Shared 面板滚动到底续拉） */
.cc-loadmore {
    padding: 8px 0 4px;
    text-align: center;
    font-size: 11px;
    color: #999;
}

/* Shared 面板搜索条（名称/作者/描述） */
.cc-search {
    position: relative;
    margin: 0 8px 8px;
    flex: none;
}

.cc-search-input {
    width: 100%;
    height: 28px;
    padding: 0 26px 0 10px;
    border: 1px solid #DDD;
    border-radius: 14px;
    font-size: 12px;
    background: #FAFAFA;
    box-sizing: border-box;
    outline: none;
    transition: border-color .12s, background .12s;
}

.cc-search-input:focus {
    border-color: #1E9FFF;
    background: #fff;
}

.cc-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border: none;
    border-radius: 50%;
    background: #DDD;
    color: #666;
    font-size: 13px;
    cursor: pointer;
}

.cc-search-clear:hover {
    background: #FF5722;
    color: #fff;
}

.cc-info {
    flex: 1;
    min-width: 0;
}

.cc-name {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-meta {
    margin-top: 2px;
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-add {
    flex: none;
    width: 22px;
    height: 22px;
    line-height: 20px;
    text-align: center;
    border: 1px solid #DDD;
    border-radius: 50%;
    color: #5FB878;
    font-size: 15px;
}

.custom-comp-card:hover .cc-add {
    background: #5FB878;
    border-color: #5FB878;
    color: #fff;
}

.custom-comp-card.src-shared:hover .cc-add {
    background: #1E9FFF;
    border-color: #1E9FFF;
}

/* 卡片右侧动作区：+ 加入 / ✎ 到 Studio 编辑 / ✕ 删除本地 */
.cc-actions {
    flex: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cc-btn {
    width: 22px;
    height: 22px;
    line-height: 20px;
    padding: 0;
    text-align: center;
    border: 1px solid #DDD;
    border-radius: 50%;
    background: transparent;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
    transition: background .12s, color .12s, border-color .12s;
}

.cc-btn.cc-add { color: #5FB878; }
.custom-comp-card:hover .cc-btn.cc-add,
.cc-btn.cc-add:hover { background: #5FB878; border-color: #5FB878; color: #fff; }
.custom-comp-card.src-shared .cc-btn.cc-add { color: #1E9FFF; }
.custom-comp-card.src-shared:hover .cc-btn.cc-add,
.cc-btn.cc-add:hover { background: #1E9FFF; border-color: #1E9FFF; color: #fff; }

.cc-btn.cc-edit { color: #1E9FFF; border-color: #cfe6ff; }
.cc-btn.cc-edit:hover { background: #1E9FFF; border-color: #1E9FFF; color: #fff; }

.cc-btn.cc-del { color: #FF5722; border-color: #ffbe99; }
.cc-btn.cc-del:hover { background: #FF5722; border-color: #FF5722; color: #fff; }

.custom-comp-empty {
    padding: 26px 16px;
    text-align: center;
    color: #999;
    font-size: 12px;
    line-height: 1.9;
}

.grid-demo-bg1 {
    border: 1px solid #CCC;
    height: 100%;
    box-sizing: border-box;
    text-align: center;
}

.grid-demo-bg1 .tab {
    text-align: center;
    display: block;
}

.grid-demo-bg2 {
    border-top: 1px solid #CCC;
    border-right: 1px solid #CCC;
    border-bottom: 1px solid #CCC;
    box-sizing: border-box;
}

.ws-docs-anim > div > div {
    padding: 5px;
    text-align: center;
    cursor: pointer;
}

.ws-docs-anim > div > div:hover {
    background-color: #e8e8e8;
    border-radius: 5%;
}

.ws-docs-anim > div .layui-anim {
    width: 125px;
    height: 125px;
    line-height: 125px;
    margin: 10px auto 10px;
    text-align: center;
    cursor: pointer;
    color: #fff;
    border-radius: 5%;
    user-select: none;
}

.ws-docs-anim > div .layui-anim img {
    border-radius: 5%;
}

.ws-docs-anim > div > div {
    text-align: center;
    white-space: nowrap;
}

/* ===== 中间预览区域 ===== */
#appv {
    max-width: 960px;
    max-height: 960px;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    margin: 10px auto;
}

#videoCanvas,
#tempLeaferContainer {
    display: none;
}

#canv {
    width: 1920px;
    height: 1080px;
    display: none;
}

/* ===== 视频状态 ===== */
.video-status {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border-radius: 4px;
    z-index: 20;
    font-size: 14px;
    display: none;
}

/* ===== 进度条 + 播放按钮（与画布同宽、吸底居中） ===== */
#progressWrap {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 20px;
    width: 100%;
    max-width: 960px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    box-sizing: border-box;
}

#playBtn {
    flex: 0 0 auto;
    width: 34px;
    height: 28px;
    line-height: 1;
    padding: 0;
    font-size: 14px;
    color: #fff;
    background: #1e9fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#playBtn:hover {
    background: #0d8aee;
}

#progressBar {
    flex: 1;
    min-width: 0;
    width: auto;
}

/* ===== 设置面板 ===== */
.b169 {
    background: #fff;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid black;
    width: 90px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 10px;
}

.b196 {
    background: #fff;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid black;
    width: 90px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 10px;
}

/* ===== Tab 切换 ===== */
.tab {
    display: inline-block;
    padding: 3px 8px;
    margin: 2px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
}

.tab.layui-this {
    background-color: #5FB878;
    color: #fff;
}

.iconcc {
    font-size: 20px !important;
}

.docs-icon-name {
    font-size: 11px;
    line-height: 16px;
}

/* ===== 模板商店 ===== */
.shop-root {
    padding: 5px;
}

.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.shop-title {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
}

.shop-search {
    margin-bottom: 8px;
}

.shop-search-input {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    box-sizing: border-box;
}

.shop-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.shop-cat-tag {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    border-radius: 3px;
    cursor: pointer;
    background: #e8e8e8;
    color: #666;
    transition: all 0.2s;
}

.shop-cat-tag.active,
.shop-cat-tag:hover {
    background: #5FB878;
    color: #fff;
}

.shop-list {
    max-height: 500px;
    overflow-y: auto;
}

.shop-card {
    display: flex;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: box-shadow 0.2s;
    overflow: hidden;
    background: #fff;
}

.shop-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.shop-card-thumb {
    width: 80px;
    height: 60px;
    background: #f5f5f5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.shop-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.shop-no-thumb {
    font-size: 10px;
    color: #ccc;
}

.shop-card-info {
    padding: 4px 8px;
    flex: 1;
    min-width: 0;
}

.shop-card-title {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.shop-card-meta {
    font-size: 10px;
    color: #999;
    margin-top: 2px;
}

.shop-card-author {
    margin-right: 6px;
}

.shop-card-cat {
    background: #f0f0f0;
    padding: 0 4px;
    border-radius: 2px;
}

.shop-loading,
.shop-empty {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 12px;
}

/* ===== 商店预览弹窗 ===== */
.shop-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.shop-modal.show {
    display: flex;
}

.shop-modal-content {
    background: #fff;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.shop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.shop-modal-title {
    margin: 0;
    font-size: 16px;
}

.shop-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #999;
}

.shop-modal-body {
    padding: 20px;
}

.shop-preview-area {
    text-align: center;
    margin-bottom: 15px;
    background: #f5f5f5;
    border-radius: 4px;
    padding: 10px;
}

.shop-detail-info p {
    margin: 6px 0;
    font-size: 13px;
    color: #666;
}

.shop-modal-footer {
    padding: 12px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== 响应式：小屏隐藏右侧面板 ===== */
@media (max-width: 1100px) {
    .column3 {
        display: none;
    }
    .column1 {
        width: 220px;
    }
}

@media (max-width: 780px) {
    .column1 {
        width: 180px;
    }
    #appv {
        max-width: 400px;
    }
}
