/**
 * 文豆高拍仪多浏览器SDK - 样式表
 * 主色调：蓝灰科技风格
 * 布局：左侧视频 | 中间预览+身份证 | 右侧功能区
 */

/* ==================== 基础重置与全局样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    font-size: 13px;
    background: #f0f2f5;
    color: #1d2129;
    line-height: 1.5;
}

/* ==================== 主容器布局 ==================== */
.main-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
    padding: 8px;
    gap: 8px;
}

/* ==================== 左侧视频面板 ==================== */
.left-panel {
    width: 50%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e6eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* 面板标题 */
.panel-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    text-align: center;
}

.panel-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
}

/* 视频预览区域 */
.video-section {
    flex: 1;
    position: relative;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    min-height: 180px;
}

.video-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    min-height: 0;
}

#CameraCtl {
    width: 100%;
    height: 100%;
    display: block;
}

#CameraCtl canvas {
    width: 100% !important;
    height: 100% !important;
    object-fit: fill;
    border-radius: 4px;
    display: block;
}

/* 视频画面上的实时预览标签 */
.video-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
}

.video-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
}

.video-label::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* 左侧日志区域 */
.left-panel .log-section {
    flex-shrink: 0;
    height: 130px;
    border-top: 1px solid #e5e6eb;
    background: #fafbfc;
    padding: 8px 12px;
}

.left-panel .log-section .section-title {
    margin-bottom: 4px;
}

.left-panel .log-section #TextInfo {
    width: 100%;
    height: 90px;
    font-size: 12px;
    color: #86909c;
    background: #ffffff;
    border: 1px solid #e5e6eb;
    border-radius: 4px;
    padding: 6px 8px;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.5;
    resize: none;
}

/* ==================== 中间预览面板 ==================== */
.center-panel {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 信息卡片 */
.info-card {
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e6eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.card-header {
    padding: 6px 10px;
    background: #fafbfc;
    border-bottom: 1px solid #e5e6eb;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1677ff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-body {
    padding: 10px;
}

/* 拍照预览卡片 */
.photo-card {
    flex-shrink: 0;
}

.photo-preview {
    width: 100%;
    height: 160px;
    background: #f7f8fa;
    border-radius: 6px;
    border: 1px dashed #c9cdd4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.photo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* 身份证信息卡片 */
.idcard-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.idcard-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.idcard-photo-wrapper {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.idcard-photo {
    width: 58px;
    height: 76px;
    background: #f7f8fa;
    border-radius: 4px;
    border: 1px dashed #c9cdd4;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.idcard-photo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.idcard-basic {
    flex: 1;
}

.idcard-field {
    margin-bottom: 6px;
}

.idcard-field:last-child {
    margin-bottom: 0;
}

.field-label {
    font-size: 11px;
    color: #86909c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.field-value {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    color: #1d2129;
    background: #f7f8fa;
    border: 1px solid #e5e6eb;
    border-radius: 3px;
}

.field-value.address {
    height: 40px;
    resize: none;
}

/* ==================== 右侧功能面板 ==================== */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border-radius: 8px;
    border: 1px solid #e5e6eb;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    min-width: 240px;
}

/* 控制面板区域 */
.control-panel {
    flex: 1;
    padding: 10px 12px;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
}

/* 控制区块 */
.control-section {
    background: #fafbfc;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
    border: 1px solid #e5e6eb;
}

.control-section:last-child {
    margin-bottom: 0;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: #1677ff;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid #e5e6eb;
}

/* ==================== 表单控件样式 ==================== */
.control-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-label {
    font-size: 13px;
    color: #4e5969;
    white-space: nowrap;
}

/* 下拉选择框 */
select {
    padding: 5px 24px 5px 8px;
    font-size: 12px;
    color: #1d2129;
    background: #ffffff;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2386909c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    transition: all 0.2s ease;
}

select:hover {
    border-color: #1677ff;
}

select:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

/* 单选按钮组 */
.radio-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.radio-item {
    display: flex;
    align-items: center;
    gap: 3px;
    cursor: pointer;
}

.radio-item input[type="radio"] {
    width: 13px;
    height: 13px;
    accent-color: #1677ff;
    cursor: pointer;
}

.radio-item label {
    font-size: 12px;
    color: #4e5969;
    cursor: pointer;
    user-select: none;
}

/* 复选框 */
.checkbox-item {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 13px;
    height: 13px;
    accent-color: #1677ff;
    cursor: pointer;
}

.checkbox-item label {
    font-size: 12px;
    color: #4e5969;
    cursor: pointer;
    user-select: none;
}

/* 输入框 */
input[type="text"] {
    padding: 5px 8px;
    font-size: 12px;
    color: #1d2129;
    background: #ffffff;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:hover,
input[type="text"]:focus {
    border-color: #1677ff;
}

input[type="text"]:focus {
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

/* 文本域 */
textarea {
    padding: 6px 8px;
    font-size: 12px;
    color: #1d2129;
    background: #ffffff;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
    outline: none;
    resize: none;
    font-family: inherit;
}

textarea:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.2);
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #4e5969;
    background: #ffffff;
    border: 1px solid #c9cdd4;
    border-radius: 4px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn:hover {
    color: #1677ff;
    border-color: #1677ff;
    background: #f0f5ff;
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #1677ff;
    border-color: #1677ff;
    color: #ffffff;
}

.btn-primary:hover {
    background: #4096ff;
    border-color: #4096ff;
    color: #ffffff;
}

.btn-capture {
    background: #f53f3f;
    border-color: #f53f3f;
    color: #ffffff;
    font-weight: 600;
    padding: 6px 16px;
}

.btn-capture:hover {
    background: #fb6262;
    border-color: #fb6262;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(245, 63, 63, 0.3);
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

/* ==================== 日志输出区域 ==================== */
.log-section {
    background: rgba(15, 23, 42, 0.8);
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    padding: 8px 12px;
    flex-shrink: 0;
}

.log-section .section-title {
    margin-bottom: 4px;
}

#TextInfo {
    width: 100%;
    height: 100px;
    font-size: 12px;
    color: #6ee7b7;
    background: transparent;
    border: none;
    font-family: 'Consolas', 'Monaco', monospace;
    line-height: 1.5;
}

/* ==================== 水印设置区域 ==================== */
.watermark-section {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-end;
}

.watermark-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.watermark-field label {
    font-size: 11px;
    color: #86909c;
}

.watermark-field input,
.watermark-field select {
    width: auto;
    min-width: 70px;
}

/* ==================== 响应式适配 ==================== */
@media screen and (max-width: 1100px) {
    .main-container {
        flex-wrap: wrap;
    }
    
    .left-panel {
        width: 100%;
        min-height: 40vh;
    }
    
    .center-panel {
        width: 50%;
        flex-direction: row;
    }
    
    .center-panel .info-card {
        flex: 1;
    }
    
    .right-panel {
        width: 50%;
    }
}

@media screen and (max-width: 700px) {
    .left-panel {
        min-height: 35vh;
        width: 100%;
    }
    
    .center-panel {
        width: 100%;
    }
    
    .right-panel {
        width: 100%;
        min-width: auto;
    }
}

/* ==================== 滚动条样式 ==================== */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: #f0f2f5;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c9cdd4;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a9adb5;
}

/* ==================== 动画效果 ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.info-card, .control-section {
    animation: fadeIn 0.3s ease forwards;
}

/* ==================== 视频预览提示文字 ==================== */
.video-preview-tip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 600;
    color: #86909c;
    text-align: center;
    z-index: 5;
    pointer-events: none;
    letter-spacing: 4px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 视频预览提示隐藏状态 */
.video-preview-tip.hidden {
    display: none;
}

/* ==================== 帮助按钮样式 ==================== */
.panel-header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.help-btn {
    position: absolute;
    right: 12px;
    width: 22px;
    height: 22px;
    padding: 0;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.help-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ==================== 帮助弹窗样式 ==================== */
.help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

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

.help-content {
    background: #ffffff;
    border-radius: 12px;
    max-width: 800px;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: helpSlideIn 0.3s ease;
}

@keyframes helpSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.help-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1677ff 0%, #0958d9 100%);
    border-bottom: 1px solid #e5e6eb;
}

.help-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.help-close-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.help-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.25);
}

.help-body {
    padding: 20px;
    max-height: calc(90vh - 60px);
    overflow-y: auto;
}

.help-section {
    margin-bottom: 20px;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section-title {
    font-size: 15px;
    font-weight: 600;
    color: #1677ff;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e8f3ff;
}

.help-section-content {
    font-size: 13px;
    color: #4e5969;
    line-height: 1.8;
}

.help-section-content ul {
    margin: 0;
    padding-left: 20px;
}

.help-section-content li {
    margin-bottom: 6px;
}

.help-tip {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #1677ff;
    background: #e8f3ff;
    border-radius: 3px;
    margin-left: 4px;
}

.help-warning {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    color: #f53f3f;
    background: #ffece8;
    border-radius: 3px;
    margin-left: 4px;
}

.help-note {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 6px;
    padding: 10px 12px;
    margin-top: 8px;
    font-size: 12px;
    color: #ad8b00;
}

.help-note-title {
    font-weight: 600;
    margin-bottom: 4px;
}
