/* ============================================================
   AI Navigator — Header 搜索栏 overlay 样式
   ============================================================ */

/* ---- Header 内搜索图标按钮 ---- */
.ai-nav-search-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    margin-left: 8px;
    vertical-align: middle;
    transition: background 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.ai-nav-search-icon:hover,
.ai-nav-search-icon:active {
    background: rgba(255, 255, 255, 0.3);
}

.ai-nav-search-icon ion-icon {
    font-size: 18px;
}

/* ---- 搜索 overlay（背景色与 appHeader 一致） ---- */
.ai-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1001;
    background: var(--color-primary, #3F51B5);
    transform: translateY(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    /* 安全区域适配（与 appHeader 一致） */
    padding-top: env(safe-area-inset-top, 0);
}

body.ai-nav-active .ai-nav-overlay {
    transform: translateY(0);
}

/* ---- 搜索栏行 ---- */
.ai-nav-bar {
    display: flex;
    align-items: center;
    height: 56px;
    padding: 0 12px 0 4px;
    gap: 8px;
}

.ai-nav-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.ai-nav-back:active {
    background: rgba(255, 255, 255, 0.15);
}

.ai-nav-back ion-icon {
    font-size: 22px;
}

/* ---- 输入框容器（包裹 input + 按钮） ---- */
.ai-nav-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 0 4px 0 16px;
    gap: 0;
}

.ai-nav-input-wrap:focus-within {
    background: rgba(255, 255, 255, 0.2);
}

.ai-nav-input {
    flex: 1;
    height: 100%;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #fff;
    outline: none;
    -webkit-appearance: none;
    min-width: 0;
}

.ai-nav-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* ---- 输入框内按钮（语音、相机） ---- */
.ai-nav-voice,
.ai-nav-camera {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    border-radius: 50%;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s, background 0.2s;
}

.ai-nav-voice:active,
.ai-nav-camera:active {
    background: rgba(255, 255, 255, 0.15);
}

.ai-nav-voice ion-icon,
.ai-nav-camera ion-icon {
    font-size: 18px;
}

.ai-nav-voice.ai-voice-active {
    color: #ff5252;
    animation: ai-nav-voice-pulse 1.2s ease-in-out infinite;
}

@keyframes ai-nav-voice-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ---- 状态区域 ---- */
.ai-nav-status {
    padding: 0 16px 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    min-height: 0;
}

.ai-nav-status:empty {
    padding: 0;
}

.ai-nav-status .ai-tool-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-nav-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes ai-nav-spin {
    to { transform: rotate(360deg); }
}

/* ---- navigator 打开时隐藏 header ---- */
body.ai-nav-active .appHeader {
    visibility: hidden;
}
