/* ===================================================
   ICP网站备案查询工具 - 样式文件
   =================================================== */

/* ---------- 整体容器 ---------- */
.icp-container {
    width: 100%;
    box-sizing: border-box;
}

/* ---------- 搜索区域 ---------- */
.icp-search-section {
    margin-bottom: 14px;
}

.icp-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.icp-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    border: 2px solid #dde3ec;
    border-radius: 10px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
}

.icp-input-wrap:focus-within {
    border-color: #4f8ef7;
    box-shadow: 0 0 0 3px rgba(79, 142, 247, 0.12);
    transform: scale(1.01);
}

.icp-input-prefix {
    padding: 0 10px 0 12px;
    font-size: 16px;
    line-height: 1;
    color: #aab;
    flex-shrink: 0;
}

.icp-domain-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 0;
    font-size: 15px;
    color: #333;
    background: transparent;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.icp-domain-input::placeholder {
    font-family: inherit;
    color: #bcc;
    font-size: 14px;
}

.icp-input-clear {
    width: 28px;
    height: 28px;
    margin-right: 6px;
    border: none;
    background: none;
    font-size: 18px;
    color: #bbb;
    cursor: pointer;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
}

.icp-input-clear:hover {
    background: #f0f3f8;
    color: #888;
    transform: scale(1.02);
}

.icp-input-clear.visible {
    display: flex;
}

.icp-copy-domain-btn {
    padding: 10px 14px;
    background: #f0f4f8;
    color: #4f8ef7;
    border: 1px solid #d0dae8;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icp-copy-domain-btn:hover {
    background: #e3ecf7;
    border-color: #4f8ef7;
    transform: scale(1.05);
}

.icp-copy-domain-btn:active {
    transform: scale(0.95);
}

.icp-query-btn {
    padding: 10px 22px;
    background: linear-gradient(135deg, #4f8ef7, #3a72d8);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(79, 142, 247, 0.3);
}

.icp-query-btn:hover {
    opacity: 0.9;
    transform: scale(1.02) translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 142, 247, 0.35);
}

.icp-query-btn:active {
    transform: scale(0.97);
}

.icp-query-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.query-btn-icon {
    font-size: 15px;
}

/* ---------- 示例域名快捷按钮 ---------- */
.icp-search-tips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tip-label {
    font-size: 12px;
    color: #aaa;
    white-space: nowrap;
}

.quick-domain-btn {
    padding: 3px 10px;
    border: 1px solid #dde3ec;
    border-radius: 12px;
    background: #f7f9fb;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Consolas', 'Monaco', monospace;
    transition: all 0.15s;
}

.quick-domain-btn:hover {
    background: #eef3ff;
    border-color: #4f8ef7;
    color: #4f8ef7;
    transform: scale(1.02);
}

/* ---------- 查询结果区域 ---------- */
.icp-result-section {
    display: none;
    margin-bottom: 14px;
}

.icp-result-section.visible {
    display: block;
}

/* ---------- 加载动画 ---------- */
.icp-loading {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 18px 20px;
    background: #f7f9fb;
    border-radius: 10px;
    font-size: 14px;
    color: #666;
    border: 1px solid #eaeff5;
}

.icp-loading.visible {
    display: flex;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid #dde3ec;
    border-top-color: #4f8ef7;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- 结果卡片 ---------- */
.icp-result-card {
    display: none;
    border-radius: 12px;
    border: 1px solid #e0e8f5;
    background: #fff;
    box-shadow: 0 2px 12px rgba(79, 142, 247, 0.08);
    overflow: hidden;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.icp-result-card.visible {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f0f6ff, #e8f3ff);
    border-bottom: 1px solid #d8e8ff;
    flex-wrap: wrap;
    gap: 10px;
}

.result-domain-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-domain-name {
    font-size: 17px;
    font-weight: 700;
    color: #2a5dbf;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.3px;
}

/* ---------- 状态徽章 ---------- */
.result-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.result-status-badge.registered {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.result-status-badge.unregistered {
    background: #fff8e1;
    color: #f57f17;
    border: 1px solid #ffe082;
}

/* ---------- 结果操作按钮 ---------- */
.result-actions {
    display: flex;
    gap: 8px;
}

.result-copy-btn,
.result-ai-btn {
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    border: 1.5px solid;
    transition: all 0.15s;
    white-space: nowrap;
}

.result-copy-btn {
    border-color: #4f8ef7;
    color: #4f8ef7;
    background: #fff;
}

.result-copy-btn:hover {
    background: #eef3ff;
    transform: scale(1.02);
}

.result-ai-btn {
    border-color: #9c27b0;
    color: #9c27b0;
    background: #fff;
}

.result-ai-btn:hover {
    background: #f8f0ff;
    transform: scale(1.02);
}

/* ---------- 结果信息网格 ---------- */
.result-card-body {
    padding: 16px 18px;
}

.result-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
}

.result-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 14px;
    background: #f7f9fb;
    border-radius: 8px;
    border: 1px solid #eaeff5;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.result-info-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.result-info-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    word-break: break-all;
}

.result-info-value.icp-no {
    font-family: 'Consolas', 'Monaco', monospace;
    color: #2a5dbf;
    font-weight: 700;
    font-size: 15px;
}

/* ---------- 未备案提示 ---------- */
.result-unregistered {
    display: none;
    text-align: center;
    padding: 20px 16px;
}

.result-unregistered.visible {
    display: block;
}

.unregistered-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.unregistered-title {
    font-size: 16px;
    font-weight: 700;
    color: #f57f17;
    margin-bottom: 6px;
}

.unregistered-desc {
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.unregistered-hint {
    font-size: 13px;
    color: #e53935;
    background: #fff3f3;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 8px 14px;
    line-height: 1.5;
    text-align: left;
    max-width: 480px;
    margin: 0 auto;
}

/* ---------- 错误卡片 ---------- */
.icp-error-card {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: #fff3f3;
    border-radius: 10px;
    border: 1px solid #ffcdd2;
    font-size: 14px;
    color: #c62828;
    animation: fadeInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-wrap: wrap;
}

.icp-error-card.visible {
    display: flex;
}

.error-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.error-msg {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-all;
}

/* ---------- 查询历史 ---------- */
.icp-history-section {
    display: none;
    margin-bottom: 14px;
    border: 1px solid #eaeff5;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.icp-history-section.visible {
    display: block;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f7f9fb;
    border-bottom: 1px solid #eaeff5;
}

.history-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.clear-history-btn {
    padding: 3px 10px;
    border: 1px solid #dde3ec;
    border-radius: 6px;
    background: #fff;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.clear-history-btn:hover {
    border-color: #e53935;
    color: #e53935;
    transform: scale(1.02);
}

.history-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    padding: 8px 12px;
}

.history-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    margin: 3px;
    border: 1px solid #dde3ec;
    border-radius: 16px;
    font-size: 13px;
    background: #f7f9fb;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Consolas', 'Monaco', monospace;
}

.history-item:hover {
    background: #eef3ff;
    border-color: #4f8ef7;
    color: #4f8ef7;
    transform: scale(1.02);
}

.history-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.history-status-dot.registered {
    background: #4caf50;
}

.history-status-dot.unregistered {
    background: #ff9800;
}

.history-status-dot.queried {
    background: #2196f3;
}

.history-status-dot.error {
    background: #bbb;
}

.history-del-btn {
    width: 16px;
    height: 16px;
    border: none;
    background: none;
    font-size: 14px;
    color: #ccc;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.1s, color 0.1s;
    line-height: 1;
    margin-left: 2px;
}

.history-del-btn:hover {
    background: #f0f3f8;
    color: #e53935;
    transform: scale(1.02);
}

/* ---------- AI 分析区域 ---------- */
.icp-ai-section {
    border: 1px solid #e8d5f5;
    border-radius: 12px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #fdf8ff, #f5edff);
    margin-bottom: 4px;
}

.ai-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #7b1fa2;
    margin-bottom: 4px;
}

.ai-section-desc {
    font-size: 12px;
    color: #aaa;
    margin-bottom: 12px;
    line-height: 1.5;
}

.ai-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-input-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ai-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
}

.ai-domain-field {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1.5px solid #d8c5e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Consolas', 'Monaco', monospace;
    background: #fff;
    color: #333;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.ai-domain-field:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
    transform: scale(1.01);
}

.ai-context-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1.5px solid #d8c5e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #333;
    outline: none;
    resize: vertical;
    min-height: 72px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    line-height: 1.5;
}

.ai-context-textarea:focus {
    border-color: #9c27b0;
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
    transform: scale(1.01);
}

.ai-context-counter {
    text-align: right;
    font-size: 11px;
    color: #bbb;
    margin-top: -2px;
}

.ai-context-counter.warn {
    color: #f57f17;
}

.ai-context-counter.danger {
    color: #e53935;
    font-weight: 700;
}

.ai-btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-analysis-btn {
    padding: 9px 22px;
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.25);
}

.ai-analysis-btn:hover {
    opacity: 0.9;
    transform: scale(1.02) translateY(-1px);
}

.ai-analysis-btn:active {
    transform: scale(0.97);
}

.ai-analysis-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ai-result-area {
    margin-top: 12px;
    display: none;
}

.ai-result-area.visible {
    display: block;
}

.ai-result-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #9c27b0;
    font-size: 14px;
    padding: 12px 0;
}

.ai-result-loading .loading-spinner {
    border-color: #e1bee7;
    border-top-color: #9c27b0;
}

.ai-result-content {
    padding: 14px 16px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #e1bee7;
    font-size: 14px;
    color: #333;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-word;
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-result-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.ai-copy-btn {
    padding: 5px 14px;
    border: 1.5px solid #9c27b0;
    border-radius: 6px;
    background: #fff;
    color: #9c27b0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.ai-copy-btn:hover {
    background: #f8f0ff;
    transform: scale(1.02);
}

/* ---------- Toast 通知 ---------- */
.icp-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.icp-toast {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    max-width: 320px;
    word-break: break-word;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    opacity: 1;
    transition: opacity 0.3s;
    pointer-events: auto;
    cursor: pointer;
    animation: slideInRight 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.icp-toast.success { background: #2e7d32; }
.icp-toast.error { background: #c62828; }
.icp-toast.warning { background: #e65100; }

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .icp-search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .icp-query-btn {
        justify-content: center;
    }

    .result-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .result-actions {
        width: 100%;
    }

    .result-copy-btn,
    .result-ai-btn {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    .icp-search-tips {
        gap: 6px;
    }

    .icp-ai-section {
        padding: 12px 14px;
    }

    .icp-shortcut-hint {
        display: none;
    }
}

/* ---------- 小工具辅助类 ---------- */

/* 错误重试按钮 */
.icp-retry-btn {
    padding: 4px 14px;
    border: 1.5px solid #c62828;
    border-radius: 6px;
    background: transparent;
    color: #c62828;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
    margin-left: auto;
}

.icp-retry-btn:hover {
    background: #ffe8e8;
    transform: scale(1.02);
}

.icp-retry-btn:active {
    transform: scale(0.97);
}

/* fallbackCopy 隐藏文本域用于复制 */
.icp-copy-hidden-ta {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

/* 快捷键提示文字 */
.icp-shortcut-hint {
    font-size: 0.8em;
    color: #aaa;
    opacity: 0.7;
    white-space: nowrap;
    transition: opacity 0.15s, transform 0.15s;
    cursor: default;
}

.icp-shortcut-hint:hover {
    opacity: 1;
    transform: scale(1.02);
}

/* 备案信息项点击交互 */
.result-info-item:hover {
    background: #eef3ff;
    border-color: #c5d8ff;
    box-shadow: 0 2px 6px rgba(79, 142, 247, 0.1);
    transform: scale(1.01);
}

.result-info-item:hover .result-info-label::after {
    content: ' · 点击复制';
    color: #4f8ef7;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

/* 历史记录时间 */
.history-time {
    font-size: 11px;
    color: #c0c7d4;
    font-family: inherit;
    margin-left: 1px;
    flex-shrink: 0;
}
