/* app.css - 智能门锁手机 APP 模拟器样式表 */

:root {
    --phone-bg: #12141c;
    --app-primary: #0ea5e9;
    --app-success: #10b981;
    --app-danger: #ef4444;
    --app-warning: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --card-bg: rgba(30, 41, 59, 0.7);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Icons", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

body {
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px 0;
}

/* 主容器布局 - 上下布局，上面是控制面板，下面是手机实体 */
.app-simulator-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    max-width: 360px;
    width: 100%;
    justify-content: center;
}

/* 1. 上侧控制台 */
.config-panel {
    width: 100%;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px;
    backdrop-filter: blur(12px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--app-primary);
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-title::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 14px;
    background: var(--app-primary);
    border-radius: 2px;
}

.config-item {
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-item label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.input-text {
    width: 100%;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
}

.input-text:focus {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
}

.btn-action {
    width: 100%;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    filter: brightness(1.1);
}

.btn-action:active {
    transform: scale(0.98);
}

/* 2. 手机模拟实体 */
.phone-frame {
    width: 360px;
    height: 493px;
    background: #27272a;
    border-radius: 48px;
    padding: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 4px #3f3f46, 0 0 20px rgba(14, 165, 233, 0.15);
    position: relative;
    user-select: none;
}

/* 手机边线反光效果 */
.phone-frame::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 48px;
    border: 2px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

/* 手机圆角显示屏 */
.phone-screen {
    width: 100%;
    height: 100%;
    background: var(--phone-bg);
    border-radius: 38px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* 灵动岛 (Dynamic Island) */
.dynamic-island {
    position: absolute;
    top: 11px;
    left: 50%;
    transform: translateX(-50%);
    width: 90px;
    height: 22px;
    background: #000;
    border-radius: 11px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 手机顶层状态栏 */
.phone-header {
    height: 38px;
    padding: 0 24px;
    padding-top: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-main);
    z-index: 99;
    background-color: transparent;
    pointer-events: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 5px;
}

.battery-icon {
    width: 18px;
    height: 9px;
    border: 1px solid var(--text-main);
    border-radius: 2px;
    position: relative;
    padding: 1px;
}

.battery-level {
    height: 100%;
    background: var(--text-main);
    border-radius: 1px;
    width: 80%;
}

.battery-icon::after {
    content: "";
    position: absolute;
    top: 2px; right: -3px;
    width: 2px; height: 3px;
    background: var(--text-main);
    border-radius: 0 1px 1px 0;
}

/* 底部虚拟返回横条 */
.home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
    z-index: 99;
    pointer-events: none;
}

/* 页面视图层管理 */
.screen-view {
    flex: 1;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0; left: 0;
    padding-top: 38px;
    padding-bottom: 20px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    z-index: 10;
}

.screen-view.hidden-view {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.96);
}

/* ==========================================
   VIEW 1: 主页面 (Home View)
   ========================================== */
.home-view {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: linear-gradient(180deg, #1b2030 0%, #0d0f17 100%);
}

.app-brand {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: linear-gradient(to right, #38bdf8, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 6px;
}

.device-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    backdrop-filter: blur(10px);
}

.device-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.device-name {
    font-size: 14px;
    font-weight: 700;
}

.device-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--app-success);
    font-size: 10px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
}

.device-badge.offline {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-muted);
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.info-row span {
    font-family: monospace;
    font-weight: 600;
    color: var(--text-main);
}

/* 猫眼监控占位画板 */
.peephole-banner {
    flex: 1;
    background: #0f172a;
    border: 1px dashed var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.peephole-banner:hover {
    border-color: var(--app-primary);
    background: rgba(14, 165, 233, 0.04);
}

.peephole-icon-outer {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    font-size: 24px;
}

.peephole-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.peephole-subtext {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    max-width: 80%;
    line-height: 1.4;
}

/* ==========================================
   VIEW 2: 来电/呼叫视图 (Incoming Call View)
   ========================================== */
.incoming-view {
    background: linear-gradient(135deg, #18090f 0%, #09090b 100%);
    padding: 30px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

/* 急促呼吸渐变背景 */
.incoming-view::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.15) 0%, transparent 70%);
    pointer-events: none;
    animation: alertBreath 1.5s ease-in-out infinite alternate;
}

@keyframes alertBreath {
    0% { opacity: 0.3; }
    100% { opacity: 1; }
}

.caller-info {
    text-align: center;
    margin-top: 40px;
    z-index: 10;
}

.caller-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.caller-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.incoming-countdown {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 12px;
    margin-top: 10px;
    display: inline-block;
}

/* 扩散波纹振动器 */
.incoming-wave-container {
    width: 180px;
    height: 180px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.incoming-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.2);
    transform: scale(0.3);
    opacity: 0;
    animation: incomingSpread 2.5s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.incoming-circle:nth-child(2) { animation-delay: 0.8s; }
.incoming-circle:nth-child(3) { animation-delay: 1.6s; }

.incoming-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #991b1b);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 10px 25px rgba(239, 68, 68, 0.4);
    z-index: 12;
    animation: bellShake 0.6s infinite alternate;
}

@keyframes incomingSpread {
    0% { transform: scale(0.3); opacity: 1; }
    100% { transform: scale(1.4); opacity: 0; }
}

@keyframes bellShake {
    0% { transform: rotate(-8deg); }
    100% { transform: rotate(8deg); }
}

/* 来电动作按钮 */
.action-buttons {
    display: flex;
    width: 100%;
    justify-content: space-around;
    padding-bottom: 40px;
    z-index: 10;
}

.action-circle-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    transition: transform 0.2s, filter 0.2s;
}

.action-circle-btn:active {
    transform: scale(0.9);
}

.action-circle-btn.decline {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 8px 20px rgba(239, 68, 68, 0.4);
}

.action-circle-btn.accept {
    background: linear-gradient(135deg, #34d399, #10b981);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    animation: breathLight 1.5s infinite alternate;
}

@keyframes breathLight {
    0% { box-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
    100% { box-shadow: 0 0 25px rgba(16, 185, 129, 0.9); }
}

.btn-tag {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
    font-weight: 600;
}

/* ==========================================
   VIEW 3: 通话/监控画板 (Active View)
   ========================================== */
.active-view {
    background: #09090b;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 顶部的连接状态条 */
.connection-header {
    height: 36px;
    padding: 0 16px;
    background: rgba(18, 18, 24, 0.8);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--text-muted);
    z-index: 5;
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-main);
    font-weight: bold;
}

.live-dot-red {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--app-danger);
    animation: blink 1s infinite alternate;
}

@keyframes blink {
    0% { opacity: 0.2; }
    100% { opacity: 1; }
}

.active-session-label {
    font-family: monospace;
}

/* 视频推流模拟器画面 */
.stream-screen {
    flex: 1;
    background: radial-gradient(circle at center, #1b263b 0%, #070a10 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 模拟网格背景 */
.stream-screen::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(rgba(18, 165, 233, 0.03) 1px, transparent 1px),
                linear-gradient(90deg, rgba(18, 165, 233, 0.03) 1px, transparent 1px);
    background-size: 16px 16px;
    pointer-events: none;
}

/* 模拟摄像头取景框 */
.camera-focus-corners {
    position: absolute;
    width: calc(100% - 40px);
    height: calc(100% - 40px);
    border: 1px solid rgba(255,255,255,0.05);
    pointer-events: none;
}

.camera-focus-corners::before,
.camera-focus-corners::after {
    content: "";
    position: absolute;
    width: 15px; height: 15px;
    border-color: rgba(255, 255, 255, 0.3);
    border-style: solid;
}

.camera-focus-corners::before {
    top: 0; left: 0; border-width: 2px 0 0 2px;
}
.camera-focus-corners::after {
    bottom: 0; right: 0; border-width: 0 2px 2px 0;
}

/* 脉冲雷达协商状态 */
.radar-overlay {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 10;
}

.radar-circle-outer {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(14, 165, 233, 0.3);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.radar-circle-outer::before {
    content: "";
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    border: 2px solid var(--app-primary);
    opacity: 0.8;
    animation: radarSweep 2s linear infinite;
}

.radar-ripple {
    position: absolute;
    width: 100%; height: 100%;
    border-radius: 50%;
    background: rgba(14, 165, 233, 0.08);
    transform: scale(0.1);
    opacity: 0;
    animation: incomingSpread 2s cubic-bezier(0.1, 0.8, 0.3, 1) infinite;
}

.radar-icon {
    font-size: 32px;
    animation: pulseScale 1.5s infinite alternate;
}

@keyframes radarSweep {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulseScale {
    0% { transform: scale(0.9); opacity: 0.7; }
    100% { transform: scale(1.1); opacity: 1; }
}

.radar-status-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--app-primary);
    text-shadow: 0 2px 8px rgba(14, 165, 233, 0.5);
    letter-spacing: 0.5px;
}

/* 声波动画图层 */
.active-wave-overlay {
    position: absolute;
    bottom: 24px;
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    z-index: 5;
}

.active-wave-bar {
    width: 4px;
    height: 6px;
    background-color: var(--app-success);
    border-radius: 2px;
    animation: waveBounce 0.8s ease-in-out infinite alternate;
}
.active-wave-bar:nth-child(2) { animation-delay: 0.1s; background-color: var(--app-primary); }
.active-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.active-wave-bar:nth-child(4) { animation-delay: 0.3s; background-color: var(--app-primary); }
.active-wave-bar:nth-child(5) { animation-delay: 0.4s; }

/* 底部磨砂玻璃操作卡面板 */
.active-control-panel {
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 10;
}

/* 多态药丸选择器 (变声切换) */
.pill-selector {
    display: flex;
    background: #0f172a;
    border: 1px solid var(--border-color);
    padding: 3px;
    border-radius: 20px;
    position: relative;
    width: 100%;
}

.pill-option {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    font-size: 11px;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    z-index: 2;
    transition: color 0.2s;
    user-select: none;
}

.pill-option.active {
    color: #fff;
}

.pill-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: calc(33.33% - 4px);
    height: calc(100% - 6px);
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    border-radius: 17px;
    z-index: 1;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.pill-option-0.active ~ .pill-slider { transform: translateX(0); }
.pill-option-1.active ~ .pill-slider { transform: translateX(100%); }
.pill-option-2.active ~ .pill-slider { transform: translateX(200%); }

/* 快捷回复排列气泡 */
.quick-replies-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reply-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-main);
    padding: 8px 12px;
    font-size: 11px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--app-primary);
}

.reply-btn:active:not(:disabled) {
    transform: scale(0.99);
}

.reply-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 红色挂断大按钮 */
.btn-hangup {
    background: linear-gradient(135deg, #f87171, #ef4444);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    border: none;
    border-radius: 14px;
    padding: 12px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-hangup:hover {
    filter: brightness(1.1);
}

.btn-hangup:active {
    transform: scale(0.98);
}

/* ==========================================
   全局 Toast 弹框提示
   ========================================== */
.toast-container {
    position: absolute;
    top: 60px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, top 0.3s;
}

.toast-container.show {
    opacity: 1;
    top: 70px;
}

/* 全局隐藏辅助类 */
.hidden {
    display: none !important;
}
