/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 背景动画 */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    animation: float 20s infinite;
    filter: blur(40px);
}

.circle-1 {
    width: 400px;
    height: 400px;
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 350px;
    height: 350px;
    top: 50%;
    right: -100px;
    animation-delay: 5s;
}

.circle-3 {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: 50%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    33% {
        transform: translate(50px, -50px) scale(1.2);
        opacity: 0.4;
    }
    66% {
        transform: translate(-30px, 30px) scale(0.9);
        opacity: 0.8;
    }
}

/* 容器 */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

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

.logo svg {
    animation: logoFloat 3s ease-in-out infinite, logoRotate 8s linear infinite;
    filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes logoRotate {
    0%, 100% {
        transform: rotate(0deg) translateY(0px);
    }
    25% {
        transform: rotate(5deg) translateY(-5px);
    }
    50% {
        transform: rotate(0deg) translateY(-10px);
    }
    75% {
        transform: rotate(-5deg) translateY(-5px);
    }
}

.logo h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* 卡片 */
.card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    animation: fadeInUp 0.8s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: rgba(102, 126, 234, 0.3);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
}

.icon {
    font-size: 1.8rem;
    display: inline-block;
    animation: iconBounce 2s ease-in-out infinite;
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    25% {
        transform: translateY(-4px) rotate(-5deg);
    }
    50% {
        transform: translateY(0) rotate(0deg);
    }
    75% {
        transform: translateY(-4px) rotate(5deg);
    }
}

.scan-card .icon {
    animation: iconScan 3s ease-in-out infinite;
}

@keyframes iconScan {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1) rotate(10deg);
    }
}

.result-card .icon {
    animation: iconPulse 2s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.8;
    }
}

.history-card .icon {
    animation: iconWave 2.5s ease-in-out infinite;
}

@keyframes iconWave {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-3px);
    }
    75% {
        transform: translateY(3px);
    }
}

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

.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.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: #f9fafb;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

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.5rem 1rem;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 8px;
    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::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.port-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: white;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.port-btn:hover::before {
    width: 200%;
    height: 200%;
}

.port-btn:active {
    transform: translateY(0) scale(0.98);
}

/* 主按钮 */
.btn-primary {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    margin-top: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.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: 1.5rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.15);
}

.status-icon {
    font-size: 3rem;
}

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

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

.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);
}

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

.detail-item {
    padding: 1rem;
    background: #f9fafb;
    border-radius: 10px;
    border-left: 3px solid var(--primary-color);
    transition: all 0.3s ease;
}

.detail-item:hover {
    background: #f3f4f6;
    transform: translateX(4px);
}

.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);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
    transform: translateY(-1px);
}

.clear-history-btn:active {
    transform: translateY(0);
}

.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: var(--primary-color);
    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-left-color: var(--primary-color);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateX(5px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.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: 3rem;
    padding: 3rem 0 2rem;
    border-top: 1px solid #e5e7eb;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 250, 251, 0.95) 100%);
    backdrop-filter: blur(10px);
}

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

/* 免责声明部分 */
.footer-disclaimer {
    background: linear-gradient(135deg, #fff5f5 0%, #fef2f2 100%);
    border-left: 4px solid #ef4444;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
}

.footer-disclaimer h3 {
    color: #dc2626;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1rem 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: 1.5rem;
    position: relative;
}

.footer-disclaimer li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

.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: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #10b981;
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.footer-legal-use h3 {
    color: #059669;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 1.5rem 0;
}

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

.legal-use-item {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.legal-use-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
}

.legal-use-item .icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.legal-use-item strong {
    color: #059669;
    display: block;
    margin-bottom: 0.25rem;
}

/* 版权信息部分 */
.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;
    }

    .circle-1, .circle-2, .circle-3 {
        display: none;
    }
}

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

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

