/* public/assets/css/social/imessage-maker.css */

.ims-wrapper { padding: 32px 16px; position: relative; }
.ims-header { text-align: center; margin-bottom: 32px; }
.ims-title { font-size: 2.2rem; font-weight: 800; color: var(--text-main); margin-bottom: 12px; }
.ims-subtitle { font-size: 1.05rem; color: var(--text-muted); max-width: 700px; margin: 0 auto; line-height: 1.6; }

.ims-workspace { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 32px; align-items: center; }

/* ==========================================
   第一排：iOS 屏幕预览区
   ========================================== */
.ims-preview-wrapper { width: 100%; box-sizing: border-box; display: flex; justify-content: center; background: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="%23cbd5e1"/></svg>') repeat; background-color: #f1f5f9; border-radius: 16px; padding: 40px 20px; border: 1px solid var(--border-color); overflow-x: hidden; }
[data-theme="dark"] .ims-preview-wrapper { background-color: #0f172a; background-image: url('data:image/svg+xml;utf8,<svg width="20" height="20" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" fill="%23334155"/></svg>'); }

/* 手机壳容器 */
.ims-capture-area { 
    width: 400px; min-width: 400px; /* 固定宽度保证不换行 */
    background: #ffffff; 
    border-radius: 36px; /* iPhone 圆角 */
    border: 8px solid #1a1a1a; 
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: top center;
}

/* 主题色彩定义 */
.theme-light { background-color: #ffffff; color: #000000; }
.theme-light .ios-nav-bar, .theme-light .ios-input-bar { background: rgba(250, 250, 250, 0.85); border-color: rgba(0,0,0,0.1); }
.theme-light .sb-time, .theme-light .sb-icons { color: #000; }

.theme-dark { background-color: #000000; color: #ffffff; }
.theme-dark .ios-nav-bar, .theme-dark .ios-input-bar { background: rgba(30, 30, 30, 0.85); border-color: rgba(255,255,255,0.15); }
.theme-dark .sb-time, .theme-dark .sb-icons { color: #fff; }

/* 状态栏 */
.ios-status-bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px 6px 24px; font-size: 15px; font-weight: 600; z-index: 10; position: relative; }
.sb-icons { display: flex; align-items: center; gap: 6px; }
.sb-battery { display: flex; align-items: center; gap: 2px; }
.batt-body { width: 22px; height: 11px; border: 1px solid currentColor; border-radius: 4px; padding: 1px; box-sizing: border-box; opacity: 0.5; }
.batt-fill { height: 100%; background: currentColor; border-radius: 1px; }
.batt-tip { width: 1.5px; height: 4px; background: currentColor; border-radius: 0 2px 2px 0; opacity: 0.5; }

/* 顶部导航毛玻璃 */
.ios-nav-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 16px 12px 16px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: 0.5px solid; z-index: 10; position: relative; }
.nav-back { display: flex; align-items: center; color: #007aff; font-size: 17px; cursor: pointer; }
.nav-back span { margin-left: -4px; }
.nav-contact { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nav-avatar { width: 44px; height: 44px; border-radius: 50%; overflow: hidden; background: #e5e5ea; }
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav-name { font-size: 11px; font-weight: 500; opacity: 0.8; }
.nav-facetime { color: #007aff; }

/* 底部输入框 */
.ios-input-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px 24px 16px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: 0.5px solid; z-index: 10; position: relative; }
.input-pill { flex: 1; border: 1px solid rgba(142, 142, 147, 0.5); border-radius: 20px; padding: 6px 10px 6px 16px; display: flex; justify-content: space-between; align-items: center; }
.input-pill span { color: #8e8e93; font-size: 16px; }

/* 💬 气泡大区 */
.ios-chat-body { flex: 1; min-height: 300px; padding: 16px; display: flex; flex-direction: column; gap: 4px; overflow-y: hidden; }

/* 气泡组件核心设计 */
.msg-row { display: flex; width: 100%; position: relative; }
.msg-bubble { max-width: 70%; padding: 8px 14px; font-size: 17px; line-height: 1.3; word-wrap: break-word; white-space: pre-wrap; position: relative; z-index: 1; }

/* 收到的消息 (灰色, 左边) */
.msg-row.recv { justify-content: flex-start; }
.msg-row.recv .msg-bubble { background: #e9e9eb; color: #000; border-radius: 18px; border-bottom-left-radius: 4px; margin-bottom: 2px; }
.theme-dark .msg-row.recv .msg-bubble { background: #262628; color: #fff; }

/* 发送的消息 (蓝/绿色, 右边) */
.msg-row.sent { justify-content: flex-end; }
.msg-row.sent .msg-bubble { border-radius: 18px; border-bottom-right-radius: 4px; margin-bottom: 2px; color: #fff; }
.msg-row.sent .msg-bubble.blue { background: #007aff; }
.msg-row.sent .msg-bubble.green { background: #34c759; }

/* 已送达状态 */
.msg-delivered { width: 100%; text-align: right; font-size: 11px; font-weight: 600; color: #8e8e93; margin-top: -2px; margin-bottom: 8px; padding-right: 4px; }

/* 时间戳 */
.msg-timestamp { width: 100%; text-align: center; font-size: 11px; font-weight: 600; color: #8e8e93; margin: 16px 0 8px 0; }

/* ==========================================
   第二排：极客控制面板 (网格排列)
   ========================================== */
.ims-controls { width: 100%; box-sizing: border-box; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 16px; padding: 24px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px 24px; }

.control-section { display: flex; flex-direction: column; }
.control-section h4 { margin: 0 0 16px 0; font-size: 1rem; color: var(--text-main); border-bottom: 2px solid rgba(0, 122, 255, 0.2); padding-bottom: 8px; display: inline-block; width: fit-content; }

.input-group { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }
.input-group input, .input-group select, .input-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--bg-body); color: var(--text-main); font-size: 0.95rem; outline: none; transition: 0.2s; box-sizing: border-box; }
.input-group input:focus, .input-group select:focus, .input-group textarea:focus { border-color: #007aff; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* 对话生成器 */
.msg-builder { background: var(--bg-body); padding: 16px; border-radius: 12px; border: 1px dashed var(--border-color); display: flex; flex-direction: column; gap: 10px; }
.msg-select, .msg-builder textarea { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-surface); color: var(--text-main); font-size: 0.95rem; box-sizing: border-box; outline: none; }
.msg-builder textarea { resize: vertical; }

.ims-btn-primary { background: #007aff; color: #fff; border: none; padding: 14px 20px; font-size: 1.05rem; font-weight: 800; border-radius: 12px; cursor: pointer; transition: 0.2s; box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3); width: 100%; }
.ims-btn-primary:hover { background: #0066d6; transform: translateY(-2px); }
.ims-btn-secondary { background: var(--bg-surface); color: #007aff; border: 1px solid #007aff; padding: 10px; font-weight: 700; border-radius: 8px; cursor: pointer; transition: 0.2s; }
.ims-btn-secondary:hover { background: rgba(0, 122, 255, 0.1); }

/* 消息列表管理 */
.msg-list { flex: 1; max-height: 250px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 6px; }
.msg-list::-webkit-scrollbar { width: 6px; }
.msg-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.list-item { display: flex; align-items: center; justify-content: space-between; background: var(--bg-body); padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border-color); font-size: 0.9rem; }
.list-item span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-main); }
.list-item small { font-weight: 700; opacity: 0.7; margin-right: 8px; }
.list-item-del { color: #ef4444; cursor: pointer; font-size: 1.1rem; padding-left: 8px; user-select: none; }

.ims-info-card { background: var(--bg-surface); padding: 24px; border-radius: 16px; border: 1px solid var(--border-color); box-sizing: border-box; max-width: 900px; margin: 0 auto; }

/* 📱 响应式适配 */
@media (max-width: 800px) {
    .ims-controls { grid-template-columns: 1fr; gap: 24px; }
    .ims-preview-wrapper { padding: 20px 10px; }
    .ims-capture-area { transform-origin: top center; }
}