/* 公共头部样式：Logo / 搜索框 / 导航 / 登录按钮 */

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

body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #1F2937;
    background-color: #F8F9FA;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background-color: #FFFFFF;
    border-bottom: 1px solid #E5E7EB;
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 600;
    color: #1E3A8A;
    text-decoration: none;
}

.logo-icon {
    font-size: 24px;
}

.header-search {
    position: relative;
    flex: 1;
    max-width: 400px;
    margin: 0 24px;
}

.search-input {
    width: 100%;
    padding: 8px 40px 8px 16px;
    border: 1.5px solid #E5E7EB;
    border-radius: 999px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    border-color: #1E3A8A;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.search-input::placeholder {
    color: #9CA3AF;
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
    opacity: 0.5;
}

/* 搜索结果下拉列表（首页 + 各工具共用） */
.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    text-decoration: none;
    color: #1F2937;
    border-bottom: 1px solid #F3F4F6;
    transition: background-color 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background-color: #F9FAFB;
}

.search-result-name {
    font-size: 14px;
    font-weight: 500;
}

.search-result-name mark {
    background-color: #FEF3C7;
    color: #92400E;
    padding: 2px 4px;
    border-radius: 4px;
}

.search-result-status {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.search-result-status.status-online {
    background-color: #DBEAFE;
    color: #1D4ED8;
}

.search-result-status.status-beta {
    background-color: #E5E7EB;
    color: #374151;
}

.search-no-result {
    padding: 16px;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.header-nav,
.nav {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-size: 14px;
    color: #6B7280;
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    color: #1E3A8A;
}

.nav-login-btn {
    padding: 6px 18px;
    border-radius: 999px;
    border: 1.5px solid #F97373;
    background-color: transparent;
    color: #F97373;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
    white-space: nowrap;
}

.nav-login-btn:hover {
    background-color: #F97373;
    color: #FFFFFF;
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.35);
}

.nav-login-btn:active {
    transform: translateY(1px);
}

/* 登录按钮高亮动画（供 AuthGuard 使用） */
.nav-login-btn-highlight {
    animation: navLoginPulse 0.6s ease-in-out 0s 2;
}

@keyframes navLoginPulse {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(248, 113, 113, 0.0);
    }
    50% {
        transform: translateY(-1px) scale(1.04);
        box-shadow: 0 0 12px rgba(248, 113, 113, 0.45);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 0 0 rgba(248, 113, 113, 0.0);
    }
}

/* ===================================
   设备/账号弹窗样式（通用）
   =================================== */

/* 我的设备弹窗 */
.device-modal-dialog {
    max-width: 520px;
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 32px;
}

.account-modal-dialog {
    max-width: 420px;
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 28px 24px 24px;
}

.device-summary {
    margin-bottom: 16px;
    font-size: 13px;
    color: #4B5563;
}

.device-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.device-item {
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    padding: 10px 12px;
    background-color: #F9FAFB;
}

.device-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.device-item-name {
    font-weight: 500;
    color: #111827;
}

.device-badge {
    padding: 2px 8px;
    border-radius: 999px;
    background-color: #EFF6FF;
    color: #1D4ED8;
    font-size: 11px;
}

.device-item-meta {
    font-size: 12px;
    color: #6B7280;
    margin-bottom: 2px;
}

.device-item-id {
    font-size: 11px;
    color: #9CA3AF;
}

.account-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.account-message {
    min-height: 18px;
    font-size: 13px;
    color: #DC2626;
}

/* 激活/试用状态条 */
.activation-status-bar {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px dashed #E5E7EB;
    background-color: #F9FAFB;
    font-size: 13px;
    color: #4B5563;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* 用户下拉菜单 */
.user-dropdown {
    position: relative;
    display: none;
    align-items: center;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #F97373;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s;
    user-select: none;
}

.user-avatar:hover {
    background-color: #F87171;
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.35);
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

.user-menu-item {
    padding: 12px 16px;
    color: #1F2937;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.user-menu-item:first-child {
    border-radius: 12px 12px 0 0;
}

.user-menu-item:last-child {
    border-radius: 0 0 12px 12px;
}

.user-menu-item:hover {
    background-color: #F9FAFB;
}

.user-menu-divider {
    height: 1px;
    background-color: #E5E7EB;
    margin: 4px 0;
}

.user-menu-email {
    padding: 12px 16px;
    font-size: 13px;
    color: #6B7280;
    border-bottom: 1px solid #E5E7EB;
    word-break: break-all;
}

/* ========== 帮助弹窗样式 ========== */
.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 16px;
}

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

.help-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.help-modal-dialog {
    position: relative;
    z-index: 2;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    max-width: 360px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

.help-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
}

.help-modal .modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.help-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9CA3AF;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

.help-modal .modal-close:hover {
    background-color: #F3F4F6;
    color: #1F2937;
}

.help-modal-body {
    text-align: center;
    padding: 20px 24px 24px;
}

.help-text {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 16px;
}

.help-qrcode {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.help-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    justify-content: flex-end;
}

/* 帮助弹窗响应式 */
@media (max-width: 480px) {
    .help-modal-dialog {
        max-width: 100%;
        margin: 0 16px;
    }
    
    .help-qrcode {
        border-radius: 8px;
    }
}
