/* 基础变量和重置 */
:root {
    --primary-blue: #1a73e8;
    --primary-dark: #1557b0;
    --bg-gray: #f8f9fa;
    --text-main: #202124;
    --text-sub: #5f6368;
    --text-tip: #9aa0a6;
    --border-color: #e8eaed;
    --shadow: 0 1px 2px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.1);
    --card-bg: #ffffff;
    --success-green: #1e8e3e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-gray);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* 容器和布局 */
.container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.02);
    position: relative;
}

.main-content {
    padding: 20px 7px 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 搜索模式相关样式 */
.container.search-mode {
    background: #fff;
    padding-top: 0;
}

.search-mode .notice-bar {
    margin-top: 0;
    position: relative;
    z-index: 10;
}

.search-mode .main-content {
    padding-top: 0;
    position: relative;
    z-index: 9;
}

.search-mode .header {
    margin-top: 0;
    padding-top: 10px;
    transition: all 0.3s ease;
}

.search-mode .visit-counter {
    margin-top: 0;
    transition: all 0.3s ease;
}

.search-mode .search-section {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 0;
    margin-bottom: 10px;
}

.search-mode .action-buttons {
    margin-top: 0;
    position: relative;
    z-index: 8;
}

/* 通知栏 */
.notice-bar {
    background: #fffbe6;
    padding: 10px 15px;
    font-size: 12px;
    color: #d48806;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #fff2cc;
    margin-top: 5px;
}

.notice-text {
    display: inline-block;
    animation: scrollNotice 150s linear infinite;
    padding-left: 100%;
}

@keyframes scrollNotice {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* 头部区域 */
.header {
    text-align: center;
    margin-bottom: 25px;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    letter-spacing: 1px;
    margin-top: 40px;
    gap: 8px;
}

.logo-text {
    font-size: 36px;
    font-weight: 800;
    color: var(--primary-blue);
}

.logo-icon {
    height: 50px;
    width: auto;
}

.slogan {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 2px;
    text-align: center;
    font-weight: 400;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* 访问量统计 */
.visit-counter {
    font-size: 14px;
    color: var(--text-tip);
    margin-bottom: 30px;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.visit-number {
    font-weight: bold;
    color: var(--primary-blue);
    font-size: 24px;
    font-family: 'DIN Alternate', sans-serif;
}

/* 搜索区域 */
.search-section {
    width: 100%;
    margin-bottom: 20px;
}

.search-wrapper {
    display: flex;
    gap: 6px;
    width: 100%;
    position: relative;
    align-items: center;
}

.search-input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 16px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    transition: all 0.2s;
    background: #f8f9fa;
    color: var(--text-main);
}

.search-input:focus {
    background: white;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
    outline: none;
}

.search-btn {
    width: 74px;
    height: 44px;
    background: var(--primary-blue);
    color: white;
    border: none;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(26, 115, 232, 0.2);
}

.search-btn:active {
    transform: scale(0.97);
    background: #096dd9;
}

/* 扫码按钮 */
.scan-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    font-size: 19px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-sub);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.scan-btn:active {
    background: #f1f3f4;
}

/* 清空按钮 */
.clear-btn {
    position: absolute;
    right: 144px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: #ccc;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 18px;
    font-size: 16px;
    cursor: pointer;
    z-index: 10;
    display: none;
}

.clear-btn:hover {
    background: #999;
}

/* 快捷操作按钮 */
.action-buttons {
    width: 100%;
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.action-btn {
    flex: 1;
    height: 40px;
    border-radius: 20px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.action-btn-primary {
    background: var(--primary-blue);
    color: white;
    font-weight: 500;
}

.action-btn-secondary {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.action-btn-qrcode {
    background: var(--primary-blue);
    color: white;
    border: 1px solid var(--primary-blue);
    font-weight: 500;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

@media (max-width: 380px) {
    .action-buttons {
        gap: 8px;
    }
    .action-btn {
        font-size: 14px;
        padding: 0 5px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
    }
    .action-btn span,
    .action-btn::before {
        display: inline-block;
        vertical-align: middle;
    }
}

/* 页脚区域 */
.footer {
    padding: 16px 15px 24px;
    text-align: center;
    font-size: 11px;
    color: #999;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
}

.footer-links {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.footer-links a:active {
    color: var(--primary-dark);
}

.legal-notice {
    margin-bottom: 4px;
}

.legal-notice a {
    color: #d90505;
    text-decoration: none;
    margin-right: 4px;
}

.beian-info {
    font-size: 12px;
    color: #666;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.beian-info a {
    color: #999;
    text-decoration: none;
}

.beian-icon {
    width: 12px;
    height: 12px;
    margin-right: 3px;
    vertical-align: middle;
}

.footer-copy {
    margin-top: 6px;
    font-size: 10px;
    color: #ccc;
}

/* 搜索结果清空按钮样式 */
.search-results-clear {
    color: #1890ff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid #1890ff;
    border-radius: 4px;
    transition: all 0.2s;
}

.search-results-clear:hover {
    background: #e6f7ff;
    border-color: #096dd9;
    color: #096dd9;
}

/* ========== 二维码弹窗样式 ========== */
.layui-layer {
    min-width: 200px !important;
    min-width: auto !important;
}

.qr-popup-international {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 320px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    box-sizing: border-box;
    z-index: 999999;
    text-align: center;
}

@keyframes qrPopupAppear {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.qr-popup-close {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: #f8f9fa;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.qr-popup-close:hover {
    background: #e8f4ff;
    color: #1890ff;
    transform: rotate(90deg);
}

.qr-popup-title {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 15px 0;
    text-align: center !important;
}

.qr-popup-subtitle {
    font-size: 13px;
    color: #d90505;
    margin-bottom: 15px;
    line-height: 1.4;
}

.qr-image-container {
    margin: 0 auto 20px;
    padding: 10px;
    background: #eef1f5;
    border-radius: 12px;
    display: block;
    width: 200px;
    height: 200px;
    box-sizing: border-box;
}

.qr-image-container img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #eef1f5;
    border: none;
}

.qr-popup-tip {
    font-size: 12px;
    color: #888;
    margin-bottom: 24px;
}

.qr-popup-actions {
    display: flex;
    gap: 12px;
}

.qr-btn {
    flex: 1;
    padding: 13px 0;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.qr-btn-primary {
    background: linear-gradient(135deg, #1890ff, #096dd9);
    color: white;
    box-shadow: 0 4px 12px rgba(24, 144, 255, 0.3);
}

.qr-btn-primary:active {
    transform: translateY(1px);
    box-shadow: 0 2px 6px rgba(24, 144, 255, 0.4);
}

.qr-btn-secondary {
    background-color: #ffffff;
    color: #1890ff;
    border: 1.5px solid #1890ff;
}

.qr-btn-secondary:active {
    background-color: #f0f8ff;
    transform: translateY(1px);
}

/* ========== 专业级扫码弹窗样式（layui版本） ========== */
.layui-layer.layui-layer-dialog {
    left: 50% !important;
    top: 50% !important;
    width: auto !important;
    min-width: 320px;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    background: white !important;
    animation: none !important;
}

@keyframes popupScaleIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.layui-layer.layui-layer-dialog[style*="460px"] {
    height: auto !important;
    min-height: auto !important;
    max-height: 90vh !important;
}

.layui-layer.layui-layer-dialog .layui-layer-title {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #1e293b !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    text-align: center !important;
    padding: 20px 40px 15px 20px !important;
    height: auto !important;
    line-height: 1.4 !important;
    border-radius: 24px 24px 0 0 !important;
}

#qr-reader {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
    padding: 0 20px 20px 20px !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: #000 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    min-height: 320px !important;
    max-height: 50vh !important;
}

#qr-reader > div:first-child {
    position: relative !important;
    width: 100% !important;
    height: 320px !important;
    min-height: 320px !important;
    max-height: 50vh !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
}

#qr-reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 16px !important;
}

#qr-reader::before {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 250px !important;
    height: 250px !important;
    border: 2px solid rgba(24, 144, 255, 0.8) !important;
    border-radius: 20px !important;
    box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.7) !important;
    pointer-events: none !important;
    z-index: 2 !important;
}

#qr-reader::after {
    content: '' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 250px !important;
    height: 3px !important;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(24, 144, 255, 0.9) 50%, 
        transparent 100%) !important;
    animation: scanLineMove 2s ease-in-out infinite !important;
    border-radius: 1.5px !important;
    box-shadow: 0 0 8px rgba(24, 144, 255, 0.5) !important;
    z-index: 3 !important;
}

@keyframes scanLineMove {
    0% { 
        top: 50% !important;
        opacity: 0.8 !important;
    }
    50% { 
        top: calc(50% + 247px) !important;
        opacity: 1 !important;
    }
    100% { 
        top: 50% !important;
        opacity: 0.8 !important;
    }
}

.scan-tip {
    text-align: center !important;
    padding: 15px 20px 20px 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background: white !important;
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
}

.scan-tip-text {
    font-size: 15px !important;
    color: #334155 !important;
    font-weight: 500 !important;
    margin-bottom: 6px !important;
    line-height: 1.4 !important;
}

.scan-tip-sub {
    font-size: 12px !important;
    color: #64748b !important;
    line-height: 1.3 !important;
}

/* 互助按钮样式 */
.action-btn-help {
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    font-weight: 500;
}

/* layui弹窗移动端适配 */
@media (max-width: 480px) {
    .layui-layer.layui-layer-dialog {
        min-width: 300px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }
    .layui-layer .layui-layer-content {
        padding: 16px !important;
        font-size: 14px !important;
    }
    .layui-layer .layui-layer-btn a {
        height: 40px !important;
        line-height: 40px !important;
        font-size: 15px !important;
        margin: 5px !important;
        padding: 0 20px !important;
        border-radius: 20px !important;
    }
}

/* ========== 语音切换按钮样式 ========== */
.voice-toggle-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-sub);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}
.voice-toggle-btn:active {
    background: #f1f3f4;
}
.keyboard-btn {
    background: #f0f8ff;
    border-color: #1890ff;
    color: #1890ff;
}

/* ========== 语音按住大按钮样式 ========== */
.voice-hold-btn {
    flex: 1;
    height: 44px;
    background: linear-gradient(135deg, #f8f9fa 0%, #fff 100%);
    border: 2px dashed #ff4d4f;
    border-radius: 22px;
    font-size: 15px;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    margin: 0 6px;
}
.voice-hold-btn:active,
.voice-hold-btn.listening {
    border-color: #ff4d4f;
    background: linear-gradient(135deg, #fff1f0 0%, #fff5f5 100%);
    border-style: solid;
    color: #ff4d4f;
    box-shadow: 0 4px 16px rgba(255,77,79,0.2);
    animation: holdPulse 1.2s infinite;
}
.voice-hold-icon {
    font-size: 22px;
    transition: transform 0.2s;
}
.voice-hold-btn.listening .voice-hold-icon {
    transform: scale(1.15);
}
.voice-hold-text {
    transition: color 0.2s;
}
.voice-hold-btn.listening .voice-hold-text {
    color: #ff4d4f;
}
@keyframes holdPulse {
    0% { box-shadow: 0 0 0 0 rgba(255,77,79,0.25); }
    70% { box-shadow: 0 0 0 12px rgba(255,77,79,0); }
    100% { box-shadow: 0 0 0 0 rgba(255,77,79,0); }
}

/* 语音识别反馈条（固定在屏幕顶部边缘下方） */
#voice-feedback-bar {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    background: #1890ff;
    color: #fff;
    text-align: center;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 600;
    z-index: 9999;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(24,144,255,0.4);
    animation: slideDownFixed 0.3s ease;
}
@keyframes slideDownFixed {
    from { top: -60px; opacity: 0; }
    to { top: 10px; opacity: 1; }
}

/* 自定义权限弹窗按钮优化 */
#confirmPermissionBtn:active {
    background: #096dd9;
}