/* 全局样式 - 工具站风格，无装饰动画 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #0d9488;
    --accent-hover: #0f766e;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-page: #f9fafb;
    --bg-card: #ffffff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo-img {
    display: block;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.icon {
    display: none;
}

/* 表单 */
.scan-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-tip {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: -0.25rem 0 0;
}

.form-tip strong {
    color: var(--text-primary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: var(--text-primary);
}

.label-text {
    font-size: 0.95rem;
}

.label-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

input, select {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f9fafb;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    background: white;
}

input::placeholder {
    color: #cbd5e1;
}

/* 快捷端口按钮 */
.quick-ports {
    margin-top: 0.5rem;
}

.quick-ports-label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.port-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.port-btn {
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    background: var(--bg-page);
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.port-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: white;
}

.port-btn:active {
    opacity: 0.9;
}

/* 主按钮 */
.btn-primary {
    padding: 0.625rem 1.25rem;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:active {
    opacity: 0.95;
}

.btn-primary.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-primary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .btn-loader {
    display: block;
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 结果显示 */
.result-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.status-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.status-icon .status-svg {
    color: inherit;
}

.status-svg--open { color: var(--success-color); }
.status-svg--closed { color: var(--danger-color); }
.status-svg--timeout { color: var(--warning-color); }
.status-svg--filtered { color: #64748b; }
.status-svg--unknown { color: var(--text-secondary); }

.result-info h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge .status-svg {
    flex-shrink: 0;
}

.status-badge.open {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.status-badge.closed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.status-badge.timeout {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.status-badge.filtered {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.error-message {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--danger-color);
    border-radius: 8px;
    color: var(--danger-color);
}

/* 历史记录 */
.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.clear-history-btn {
    padding: 0.5rem 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-family: inherit;
}

.clear-history-btn:hover {
    border-color: var(--danger-color);
    color: white;
    background: var(--danger-color);
}

.clear-history-btn:active {
    opacity: 0.9;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.history-item {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 3px solid transparent;
    border: 1px solid #e5e7eb;
}

.history-item:hover {
    background: white;
    border-color: var(--accent);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.history-host {
    font-weight: 600;
    color: var(--text-primary);
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.history-item-details {
    display: flex;
    gap: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

/* 页脚 */
.footer {
    margin-top: 2.5rem;
    padding: 2rem 0 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.footer-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 免责声明部分 */
.footer-disclaimer {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-left: 4px solid var(--danger-color);
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.footer-disclaimer h3 {
    color: #dc2626;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.footer-disclaimer p {
    color: #374151;
    line-height: 1.6;
    margin: 0.75rem 0;
}

.footer-disclaimer ul {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.footer-disclaimer li {
    color: #374151;
    padding: 0.5rem 0;
    padding-left: 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.disclaimer-list .li-icon {
    flex-shrink: 0;
    color: #059669;
    margin-top: 0.15rem;
}

.disclaimer-list .li-icon svg {
    display: block;
}

.warning-text {
    background: rgba(239, 68, 68, 0.1);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem !important;
    color: #dc2626 !important;
    font-size: 0.95rem;
}

/* 正规用途部分 */
.footer-legal-use {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-left: 4px solid var(--success-color);
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
}

.footer-legal-use h3 {
    color: #047857;
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
}

.legal-use-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.legal-use-item {
    padding: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.legal-use-item strong {
    color: #047857;
}

/* 版权信息部分 */
.footer-copyright {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
}

.footer-copyright p {
    margin: 0.5rem 0;
    letter-spacing: 0.3px;
}

.footer-note {
    font-size: 0.875rem;
    color: #9ca3af;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 1.5rem;
    }
    
    .footer-content {
        padding: 0 1rem;
    }
    
    .footer-disclaimer,
    .footer-legal-use {
        padding: 1.5rem;
    }
    
    .legal-use-list {
        grid-template-columns: 1fr;
    }
    
    .footer-disclaimer h3,
    .footer-legal-use h3 {
        font-size: 1.1rem;
    }
}

/* 动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .logo h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .card {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .port-buttons {
        gap: 0.375rem;
    }

    .port-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }

    .history-item-details {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* 可见说明区 */
.content-section {
    max-width: 960px;
    margin: 0 auto;
    padding: 0;
}
.content-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
}
.content-heading {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.content-card p {
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.875rem;
    margin: 0 0 0.5rem;
}
.content-card p:last-child { margin-bottom: 0; }
.port-list {
    margin: 0 0 0.5rem;
    padding-left: 1.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}
.port-list li { margin-bottom: 0.25rem; }

/* 底部相关工具推荐（静态，不依赖组件） */
.recommend-static {
    max-width: 960px;
    margin: 2rem auto 0;
    padding: 1rem 1rem 0;
}

.recommend-static-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.recommend-static-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.recommend-static-links a {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.recommend-static-links a:hover {
    text-decoration: underline;
}