/* ============================================================
   components.css - 组件样式
   ============================================================ */

/* ---------- 导航栏 ---------- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #2d2d3a;
    border-bottom: 1px solid #3d3d4a;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    min-height: 56px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}
.navbar-logo img {
    height: 32px;
}

.navbar-menu {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.navbar-menu a {
    color: #adb5bd;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
}
.navbar-menu a:hover {
    color: #ffffff;
    background: #3d3d4a;
}
.navbar-menu a.active {
    color: #ffffff;
    background: #e63946;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.navbar-badge {
    color: #adb5bd;
    font-size: 12px;
    padding: 2px 12px;
    background: #1a1a2e;
    border-radius: 20px;
}
.navbar-badge.member {
    color: #f1c40f;
    background: rgba(241, 196, 15, 0.15);
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: 24px;
    transition: background 0.2s;
}
.navbar-user:hover {
    background: #3d3d4a;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e63946;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-username {
    color: #ffffff;
    font-size: 14px;
}

.navbar .hamburger {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* 移动端菜单 */
.navbar-menu.mobile {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 12px 0;
    border-top: 1px solid #3d3d4a;
}
.navbar-menu.mobile.open {
    display: flex;
}

/* ---------- 主内容 ---------- */
.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

/* ---------- 登录/注册页面 ---------- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 20px;
}

.auth-card {
    background: #2d2d3a;
    border-radius: 24px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-card .header {
    text-align: center;
    margin-bottom: 32px;
}
.auth-card .header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}
.auth-card .header p {
    color: #adb5bd;
    font-size: 14px;
}

.auth-card .footer {
    text-align: center;
    margin-top: 20px;
    color: #adb5bd;
    font-size: 14px;
}
.auth-card .footer a {
    color: #e63946;
    font-weight: 600;
}

.auth-card .tips {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #3d3d4a;
}
.auth-card .tips p {
    color: #6c757d;
    font-size: 12px;
    margin: 4px 0;
}

/* ---------- Dashboard 查询界面 ---------- */
.dashboard-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.dashboard-page .status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #2d2d3a;
    border-radius: 12px;
    margin-bottom: 12px;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.dashboard-page .chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #1a1a2e;
    border-radius: 12px;
    border: 1px solid #2d2d3a;
    min-height: 300px;
}

.dashboard-page .input-area {
    flex-shrink: 0;
    padding-top: 12px;
}
.dashboard-page .input-area .input-row {
    display: flex;
    gap: 8px;
}
.dashboard-page .input-area .input-row .form-control {
    flex: 1;
}
.dashboard-page .input-area .input-row .btn {
    flex-shrink: 0;
}

/* 消息 */
.message {
    margin-bottom: 16px;
    max-width: 85%;
}
.message-user {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
.message-user .bubble {
    background: #e63946;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
    padding: 10px 16px;
}
.message-system {
    margin-right: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.message-system .bubble {
    background: #2d2d3a;
    color: #ffffff;
    border-radius: 16px 16px 16px 4px;
    padding: 10px 16px;
    max-width: 100%;
}
.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 4px;
    padding: 0 8px;
}

/* 聊天空状态 */
.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    text-align: center;
}
.chat-empty .icon {
    font-size: 64px;
    margin-bottom: 16px;
}
.chat-empty .title {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 8px;
}
.chat-empty .examples {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}
.chat-empty .examples .example-tag {
    background: #2d2d3a;
    color: #ffffff;
    border: 1px solid #3d3d4a;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.chat-empty .examples .example-tag:hover {
    background: #e63946;
    border-color: #e63946;
    transform: translateY(-2px);
}

/* 加载动画 */
.loading-dots {
    display: flex;
    gap: 6px;
    padding: 4px 0;
}
.loading-dots span {
    width: 10px;
    height: 10px;
    background: #adb5bd;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* 结果图片 */
.result-image {
    max-width: 100%;
    max-height: 500px;
    border-radius: 8px;
    display: block;
}
.result-text {
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.6;
}
.error-text {
    color: #e63946;
    font-size: 14px;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s;
}

.modal-box {
    background: #2d2d3a;
    border-radius: 16px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #3d3d4a;
}
.modal-header h3 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}
.modal-header .close {
    background: none;
    border: none;
    color: #adb5bd;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
}
.modal-header .close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #3d3d4a;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ---------- 提示 Toast ---------- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
}

.toast {
    padding: 12px 20px;
    border-radius: 12px;
    color: #ffffff;
    font-size: 14px;
    animation: slideIn 0.3s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.toast-success {
    background: #2ecc71;
}
.toast-error {
    background: #e74c3c;
}
.toast-warning {
    background: #f39c12;
}
.toast-info {
    background: #3498db;
}

@keyframes slideIn {
    from { transform: translateX(40px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---------- 套餐卡片 ---------- */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

.plan-card {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    border: 1px solid #3d3d4a;
    transition: all 0.3s;
}
.plan-card:hover {
    border-color: #e63946;
    transform: translateY(-4px);
}
.plan-card .name {
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
}
.plan-card .price {
    color: #e63946;
    font-size: 26px;
    font-weight: 700;
    margin: 6px 0;
}
.plan-card .desc {
    color: #6c757d;
    font-size: 13px;
    margin-bottom: 12px;
}
.plan-card .btn {
    width: 100%;
}

/* ---------- 快捷入口 ---------- */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.quick-item {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    border: 1px solid #3d3d4a;
    transition: all 0.3s;
    color: #adb5bd;
}
.quick-item:hover {
    border-color: #e63946;
    color: #ffffff;
    transform: translateY(-4px);
}
.quick-item .icon {
    font-size: 24px;
}
.quick-item .label {
    display: block;
    margin-top: 6px;
    font-size: 13px;
}

/* ---------- 订单确认 ---------- */
.order-confirm {
    text-align: center;
}
.order-confirm .product {
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}
.order-confirm .price {
    font-size: 32px;
    font-weight: 700;
    color: #e63946;
    margin: 6px 0;
}
.order-confirm .qr-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 12px 0;
}
.order-confirm .qr-item {
    text-align: center;
}
.order-confirm .qr-item img {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    border: 1px solid #3d3d4a;
}
.order-confirm .qr-item .label {
    color: #adb5bd;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}
.order-confirm .qr-tip {
    color: #6c757d;
    font-size: 13px;
    margin: 8px 0;
}
.order-confirm .form-group {
    margin-top: 12px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    .navbar-menu.mobile {
        display: none;
    }
    .navbar-menu.mobile.open {
        display: flex;
    }
    .navbar .hamburger {
        display: block;
    }
    .navbar-username {
        display: none;
    }
    .plans-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    .quick-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    .order-confirm .qr-item img {
        width: 100px;
        height: 100px;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px 16px;
    }
    .auth-card .header h1 {
        font-size: 22px;
    }
    .dashboard-page .status-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .plans-grid {
        grid-template-columns: 1fr 1fr;
    }
    .message {
        max-width: 95%;
    }
    .order-confirm .qr-row {
        flex-direction: column;
        align-items: center;
    }
}

/* ---------- 导航栏增强 ---------- */
.navbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: #2d2d3a;
    border-bottom: 1px solid #3d3d4a;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    min-height: 56px;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    flex-shrink: 0;
}

.navbar-menu {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.navbar-menu a {
    color: #adb5bd;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
}
.navbar-menu a:hover {
    color: #ffffff;
    background: #3d3d4a;
}
.navbar-menu a.active {
    color: #ffffff;
    background: #e63946;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.navbar-badge {
    color: #adb5bd;
    font-size: 12px;
    padding: 2px 12px;
    background: #1a1a2e;
    border-radius: 20px;
}
.navbar-badge.member {
    color: #f1c40f;
    background: rgba(241, 196, 15, 0.15);
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    border-radius: 24px;
    transition: background 0.2s;
}
.navbar-user:hover {
    background: #3d3d4a;
}

.navbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e63946;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.navbar-username {
    color: #ffffff;
    font-size: 14px;
}

.navbar .hamburger {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.navbar-menu.mobile {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 12px 0;
    border-top: 1px solid #3d3d4a;
}
.navbar-menu.mobile.open {
    display: flex;
}

.main-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .navbar-menu {
        display: none;
    }
    .navbar .hamburger {
        display: block;
    }
    .navbar-username {
        display: none;
    }
    .navbar-badge {
        font-size: 11px;
        padding: 2px 8px;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 8px 12px;
    }
    .navbar-logo {
        font-size: 16px;
    }
    .navbar-logo span:last-child {
        display: none;
    }
    .navbar-right .btn {
        font-size: 11px;
        padding: 3px 8px;
    }
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px;
    background: #16213e;
    border-radius: 8px;
    margin-bottom: 16px;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #adb5bd;
}

.filter-group label {
    font-size: 14px;
    white-space: nowrap;
}

.filter-group select,
.filter-group input {
    padding: 6px 12px;
    background: #0f3460;
    border: 1px solid #0f3460;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #e94560;
}

.filter-group input::placeholder {
    color: #6c757d;
}

/* ===== 指令手册 ===== */
.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.help-card {
    background: #16213e;
    border-radius: 12px;
    border: 1px solid #0f3460;
    overflow: hidden;
}

.help-header {
    background: #0f3460;
    padding: 12px 16px;
    font-weight: bold;
    color: #f1c40f;
    font-size: 16px;
}

.help-body {
    padding: 16px;
}

.help-item {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #0f3460;
}

.help-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.help-format {
    color: #64b5f6;
    font-size: 13px;
    font-family: monospace;
    margin-bottom: 4px;
}

.help-example {
    display: inline-block;
    background: #0f3460;
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
    margin: 4px 0;
}

.help-example:hover {
    background: #1a4a7a;
}

.help-desc {
    color: #6c757d;
    font-size: 13px;
    margin-top: 4px;
}

/* ============================================================
   验证码样式 - 登录/注册
   ============================================================ */

/* 验证码容器 */
.captcha-group {
    margin-bottom: 12px;
}

/* 验证码行（输入框 + 图片 + 刷新按钮） */
.captcha-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 验证码输入框 - 占据剩余宽度 */
.captcha-input {
    flex: 1;
    min-width: 0;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s;
    text-transform: uppercase;
    letter-spacing: 4px;
}

.captcha-input:focus {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* 验证码图片 */
.captcha-image {
    height: 44px;
    width: 120px;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid #d9d9d9;
    background: #fafafa;
    flex-shrink: 0;
    transition: border-color 0.3s;
    object-fit: contain;
}

.captcha-image:hover {
    border-color: #1890ff;
}

/* 刷新按钮 */
.captcha-refresh {
    font-size: 20px;
    cursor: pointer;
    color: #1890ff;
    flex-shrink: 0;
    padding: 0 4px;
    user-select: none;
    transition: transform 0.3s ease, color 0.3s ease;
    line-height: 44px;
}

.captcha-refresh:hover {
    transform: rotate(60deg);
    color: #40a9ff;
}

.captcha-refresh:active {
    transform: rotate(120deg);
}

/* ============================================================
   响应式适配
   ============================================================ */

@media (max-width: 480px) {
    .captcha-image {
        height: 38px;
        width: 100px;
    }
    
    .captcha-refresh {
        font-size: 16px;
        line-height: 38px;
    }
    
    .captcha-input {
        height: 38px;
        font-size: 14px;
        letter-spacing: 3px;
    }
}

@media (max-width: 380px) {
    .captcha-row {
        gap: 6px;
    }
    
    .captcha-image {
        height: 34px;
        width: 80px;
    }
    
    .captcha-refresh {
        font-size: 14px;
        line-height: 34px;
    }
    
    .captcha-input {
        height: 34px;
        font-size: 13px;
        letter-spacing: 2px;
        padding: 0 8px;
    }
}