/* ============================================================
   AI高考产品原型 - 设计系统
   ============================================================ */

/* ===== CSS 变量 ===== */
:root {
    --primary: #3B82F6;
    --primary-dark: #2563EB;
    --primary-light: #DBEAFE;
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --purple: #8B5CF6;
    --cyan: #06B6D4;

    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --bg-page: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1E293B;
    --border: #E5E7EB;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ===== Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', 'DejaVu Sans', 'Segoe UI Symbol', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif; background: var(--bg-page); color: var(--text-primary); overflow: hidden; height: 100vh; }

/* ===== 顶部导航栏 ===== */
.proto-header {
    height: 56px;
    background: var(--bg-sidebar);
    color: white;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 20px;
    z-index: 9999;
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.proto-header-left { display: flex; align-items: center; gap: 12px; }
.proto-logo { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.proto-logo i { color: var(--primary); }
.proto-page-count { font-size: 12px; background: rgba(255,255,255,0.15); padding: 3px 10px; border-radius: 12px; }
.proto-header-center { flex: 1; max-width: 400px; }
.proto-search {
    width: 100%; padding: 8px 14px; border: none; border-radius: 20px;
    background: rgba(255,255,255,0.1); color: white; font-size: 13px; outline: none;
}
.proto-search::placeholder { color: rgba(255,255,255,0.5); }
.proto-header-right { display: flex; gap: 6px; position: relative; z-index: 10000; }
.proto-device-btn {
    padding: 6px 12px; border: 1px solid rgba(255,255,255,0.2); border-radius: 8px;
    background: transparent; color: rgba(255,255,255,0.7); font-size: 12px; cursor: pointer; transition: all 0.2s;
    position: relative; z-index: 10001;
}
.proto-device-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.proto-device-btn:hover { color: white; }

/* ===== 主体布局 ===== */
.proto-body { display: flex; height: calc(100vh - 56px); }

/* ===== 左侧导航 ===== */
.proto-sidebar {
    width: 260px; background: var(--bg-sidebar); color: rgba(255,255,255,0.8);
    overflow-y: auto; padding: 12px 0; flex-shrink: 0;
}
.proto-sidebar::-webkit-scrollbar { width: 4px; }
.proto-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }
.nav-group { margin-bottom: 4px; }
.nav-group-title {
    font-size: 11px; font-weight: 700; color: rgba(255,255,255,0.4);
    padding: 12px 20px 6px; text-transform: uppercase; letter-spacing: 1px;
    display: flex; align-items: center; gap: 6px;
}
.nav-group-title .count { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 8px; font-size: 10px; }
.nav-item {
    padding: 9px 20px 9px 44px; font-size: 13px; color: rgba(255,255,255,0.7);
    cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 8px;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-item.active { background: rgba(59,130,246,0.15); color: white; border-left-color: var(--primary); }
.nav-item i { width: 16px; text-align: center; font-size: 12px; }

/* ===== 右侧预览区 ===== */
.proto-preview {
    flex: 1; display: flex; align-items: flex-start; justify-content: center;
    background: #E5E7EB; overflow: auto; padding: 10px;
    min-width: 0;
    position: relative;
    z-index: 1;
}
.proto-preview-inner {
    transform-origin: top center;
    width: max-content;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 10px 0;
}

/* ===== 设备外框 ===== */
.device-frame {
    background: #1a1a1a; border-radius: 32px; padding: 12px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.3); transition: all 0.3s;
    position: relative;
}
.device-frame.mobile { width: 390px; height: 780px; }
.device-frame.tablet { width: 820px; height: 1100px; border-radius: 24px; }
.device-frame.desktop { width: 1280px; height: 800px; border-radius: 12px; }

.device-screen {
    width: 100%; height: 100%; background: white; border-radius: 20px;
    overflow-y: auto; position: relative;
}
.device-frame.tablet .device-screen { border-radius: 12px; }
.device-frame.desktop .device-screen { border-radius: 8px; }
.device-screen::-webkit-scrollbar { width: 4px; }
.device-screen::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 2px; }

/* ============================================================
   ===== 模拟手机内部页面样式 =====
   ============================================================ */

/* 手机状态栏 */
.phone-statusbar {
    height: 44px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px; font-size: 14px; font-weight: 600; background: white;
    position: sticky; top: 0; z-index: 50;
}
.phone-statusbar .right { display: flex; gap: 6px; align-items: center; font-size: 12px; }

/* App导航栏 */
.app-navbar {
    height: 48px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; background: white; border-bottom: 1px solid var(--border);
    position: sticky; top: 44px; z-index: 49;
}
.app-navbar .title { font-size: 17px; font-weight: 700; }
.app-navbar .back { font-size: 18px; color: var(--text-primary); cursor: pointer; }
.app-navbar .right-action { font-size: 14px; color: var(--primary); cursor: pointer; }

/* 底部Tab栏 */
.app-tabbar {
    height: 60px; display: flex; background: white; border-top: 1px solid var(--border);
    position: sticky; bottom: 0; z-index: 50;
}
.app-tabbar .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 2px; font-size: 10px; color: var(--text-tertiary); cursor: pointer;
}
.app-tabbar .tab.active { color: var(--primary); }
.app-tabbar .tab i { font-size: 20px; }

/* 页面内容区 */
.app-content { padding: 12px 16px; min-height: calc(100% - 44px - 48px); }

/* ===== 通用组件 ===== */

/* 卡片 */
.proto-card {
    background: white; border-radius: var(--radius-md); padding: 16px;
    box-shadow: var(--shadow-sm); margin-bottom: 12px;
}

/* 渐变卡片 */
.gradient-card {
    border-radius: var(--radius-lg); padding: 20px; color: white;
    margin-bottom: 12px; position: relative; overflow: hidden;
}
.gradient-blue { background: linear-gradient(135deg, #3B82F6, #1D4ED8); }
.gradient-green { background: linear-gradient(135deg, #10B981, #059669); }
.gradient-purple { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.gradient-orange { background: linear-gradient(135deg, #F59E0B, #D97706); }
.gradient-pink { background: linear-gradient(135deg, #EC4899, #BE185D); }
.gradient-cyan { background: linear-gradient(135deg, #06B6D4, #0891B2); }

/* 按钮 */
.proto-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 12px 24px; border-radius: var(--radius-sm); border: none;
    font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.proto-btn-primary { background: var(--primary); color: white; width: 100%; }
.proto-btn-primary:hover { background: var(--primary-dark); }
.proto-btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-primary); width: 100%; }
.proto-btn-success { background: var(--success); color: white; width: 100%; }

/* 输入框 */
.proto-input {
    width: 100%; padding: 14px 16px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: 15px; outline: none; transition: border-color 0.2s;
    background: #F9FAFB;
    position: relative; z-index: 5;
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}
.proto-input:focus { border-color: var(--primary); background: white; z-index: 6; }

/* 输入框父容器确保可点击 */
.device-screen input, #proto-modal-overlay input {
    pointer-events: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* 标签 */
.proto-tag {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600;
}
.tag-blue { background: var(--primary-light); color: var(--primary-dark); }
.tag-green { background: #D1FAE5; color: #065F46; }
.tag-orange { background: #FEF3C7; color: #92400E; }
.tag-red { background: #FEE2E2; color: #991B1B; }
.tag-purple { background: #EDE9FE; color: #5B21B6; }

/* 列表项 */
.proto-list-item {
    display: flex; align-items: center; padding: 14px 16px; background: white;
    border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.15s;
}
.proto-list-item:hover { background: #F9FAFB; }
.proto-list-item .icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-right: 12px; font-size: 18px; color: white; }
.proto-list-item .text { flex: 1; }
.proto-list-item .text .title { font-size: 14px; font-weight: 600; }
.proto-list-item .text .desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.proto-list-item .arrow { color: var(--text-tertiary); font-size: 14px; }

/* 进度条 */
.proto-progress { height: 8px; background: #E5E7EB; border-radius: 4px; overflow: hidden; }
.proto-progress-fill { height: 100%; border-radius: 4px; transition: width 0.5s; }

/* 网格 */
.proto-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proto-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.proto-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 10px; }

/* 快捷入口方块 */
.quick-tile {
    background: white; border-radius: var(--radius-md); padding: 16px 8px;
    text-align: center; cursor: pointer; transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
.quick-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.quick-tile .icon { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: white; }
.quick-tile .label { font-size: 12px; font-weight: 600; color: var(--text-primary); }

/* 圆环 */
.proto-ring { width: 80px; height: 80px; position: relative; display: inline-flex; align-items: center; justify-content: center; }
.proto-ring svg { transform: rotate(-90deg); }
.proto-ring .ring-text { position: absolute; font-size: 18px; font-weight: 700; }

/* 图表占位 */
.chart-placeholder {
    background: linear-gradient(180deg, #F0F4FF 0%, #E0E7FF 100%);
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    color: var(--text-tertiary); font-size: 12px; min-height: 120px;
}

/* 分段控制器 */
.proto-segment { display: flex; background: #F3F4F6; border-radius: 8px; padding: 3px; margin-bottom: 12px; }
.proto-segment-item { flex: 1; text-align: center; padding: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); border-radius: 6px; cursor: pointer; transition: all 0.2s; }
.proto-segment-item.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); }

/* 标题 */
.section-title { font-size: 16px; font-weight: 700; margin: 16px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.section-title .more { font-size: 12px; color: var(--primary); font-weight: 400; cursor: pointer; }

/* 原型标记 */
.proto-badge {
    position: absolute; top: 8px; right: 8px; background: var(--danger);
    color: white; font-size: 10px; padding: 2px 8px; border-radius: 10px; z-index: 60;
}

/* 后台管理表格 */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { background: #F9FAFB; padding: 10px 12px; text-align: left; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.admin-table tr:hover td { background: #F9FAFB; }

/* 后台侧边菜单 */
.admin-sidebar { width: 200px; background: #1E293B; color: rgba(255,255,255,0.7); min-height: 100%; padding: 12px 0; }
.admin-sidebar .menu-item { padding: 10px 20px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; border-left: 3px solid transparent; }
.admin-sidebar .menu-item:hover { background: rgba(255,255,255,0.05); color: white; }
.admin-sidebar .menu-item.active { background: rgba(59,130,246,0.15); color: white; border-left-color: var(--primary); }

/* 协议勾选框 */
.agree-box {
    display: inline-flex;
    width: 16px; height: 16px;
    border-radius: 50%;
    border: 1.5px solid #D1D5DB;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s;
    flex-shrink: 0;
}
.agree-box.checked,
.proto-agree-box.checked {
    background: #3B82F6;
    border-color: #3B82F6;
    color: white !important;
}
/* 协议勾选容器：提升移动端 tap 响应，防止 300ms 延迟 */
div[onclick*="agree-box"].cursor-pointer,
div[onclick*="proto-agree-box"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

/* 输入框容器内的图标不拦截点击事件 */
.device-screen i[style*="position:absolute"],
#proto-modal-overlay i[style*="position:absolute"] {
    pointer-events: none !important;
}
/* 输入框始终可交互 */
.device-screen .proto-input,
#proto-modal-overlay .proto-input {
    position: relative;
    z-index: 1;
}
