@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --accent-color: #4d8aff;
    --accent-hover: #3d7aef;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --border-radius: 12px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.2);
    --transition: all 0.3s ease;
}

/* 暗黑模式变量 */
:root {
    --background-color: #0a0a0f;
    --background-secondary: #141419;
    --panel-background: rgba(28, 32, 46, 0.85);
    --panel-border: rgba(128, 138, 168, 0.2);
    --text-primary: #f0f2f5;
    --text-secondary: #808aa8;
    --text-muted: #64748b;
    --glow-color: rgba(77, 138, 255, 0.15);
    --input-background: rgba(28, 32, 46, 0.6);
    --input-border: rgba(128, 138, 168, 0.3);
    --map-tiles: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png';
}

/* 明亮模式变量 */
@media (prefers-color-scheme: light) {
    :root {
        --background-color: #f8fafc;
        --background-secondary: #ffffff;
        --panel-background: rgba(255, 255, 255, 0.85);
        --panel-border: rgba(203, 213, 225, 0.8);
        --text-primary: #1e293b;
        --text-secondary: #475569;
        --text-muted: #64748b;
        --glow-color: rgba(77, 138, 255, 0.1);
        --input-background: rgba(255, 255, 255, 0.9);
        --input-border: rgba(203, 213, 225, 0.8);
        --map-tiles: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
    }
}

/* 手动主题切换类 */
[data-theme="light"] {
    --background-color: #f8fafc;
    --background-secondary: #ffffff;
    --panel-background: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(203, 213, 225, 0.8);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --glow-color: rgba(77, 138, 255, 0.1);
    --input-background: rgba(255, 255, 255, 0.9);
    --input-border: rgba(203, 213, 225, 0.8);
    --map-tiles: 'https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png';
}

[data-theme="dark"] {
    --background-color: #0a0a0f;
    --background-secondary: #141419;
    --panel-background: rgba(28, 32, 46, 0.85);
    --panel-border: rgba(128, 138, 168, 0.2);
    --text-primary: #f0f2f5;
    --text-secondary: #808aa8;
    --text-muted: #64748b;
    --glow-color: rgba(77, 138, 255, 0.15);
    --input-background: rgba(28, 32, 46, 0.6);
    --input-border: rgba(128, 138, 168, 0.3);
    --map-tiles: 'https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png';
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family-sans);
    background-color: var(--background-color);
    color: var(--text-primary);
    transition: var(--transition);
}

/* 顶部工具栏 */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: var(--panel-background);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--panel-border);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.top-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* IP输入框 */
.ip-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-background);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    min-width: 240px;
    transition: var(--transition);
}

.ip-input-container:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--glow-color);
}

#ip-input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

#ip-input::placeholder {
    color: var(--text-muted);
}

.search-btn {
    background: var(--accent-color);
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* 主题切换按钮 */
.theme-toggle {
    background: var(--input-background);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius);
    padding: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
}

.theme-toggle:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* 地图容器 */
#map {
    position: absolute;
    top: 64px;
    left: 0;
    width: 100%;
    height: calc(100% - 64px);
    z-index: 1;
}

/* 地图控件 */
.map-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.map-control-btn {
    width: 44px;
    height: 44px;
    background: var(--panel-background);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-sm);
}

.map-control-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.leaflet-control-container {
    display: none;
}

.glowing-marker {
    background-color: rgba(77, 138, 255, 0.5);
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 20px var(--accent-color);
}

/* 当前位置标记样式 */
.current-location-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.marker-pulse {
    width: 16px;
    height: 16px;
    background-color: var(--success-color);
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.1);
    }
    100% {
        box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.3);
    }
}

/* 信息面板 */
#info-panel {
    position: fixed;
    top: 88px;
    left: 24px;
    width: 400px;
    max-height: calc(100vh - 112px);
    background: var(--panel-background);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#info-panel.visible {
    opacity: 1;
    transform: translateX(0);
}

.info-section {
    border-bottom: 1px solid var(--panel-border);
    padding-bottom: 20px;
}

.info-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.info-header svg {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
}

.info-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 12px;
    align-items: start;
}

.info-grid dt {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.info-grid dd {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

/* 当前位置信息面板 */
#current-location-panel {
    position: fixed;
    top: 88px;
    right: 24px;
    width: 320px;
    max-height: calc(100vh - 112px);
    background: var(--panel-background);
    border: 1px solid var(--panel-border);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    visibility: hidden;
}

#current-location-panel.visible {
    opacity: 1;
    transform: translateX(0);
    visibility: visible;
}

/* 复制功能样式 */
.copyable {
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    user-select: text;
}

.copyable:hover {
    color: var(--accent-color);
    background: rgba(77, 138, 255, 0.05);
    border-radius: 4px;
    padding: 2px 4px;
    margin: -2px -4px;
}

.copyable:active {
    transform: scale(0.98);
}

/* 复制成功提示框 */
.copy-toast {
    position: fixed;
    top: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--success-color);
    color: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.copy-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.copy-toast-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    font-weight: 500;
}

.copy-toast svg {
    flex-shrink: 0;
}

/* 状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.safe {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge.warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.status-badge.danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.status-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* 加载器 */
#loader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    color: var(--text-secondary);
    font-size: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: var(--panel-background);
    padding: 32px;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--panel-border);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 浏览器指纹信息 */
.fingerprint-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.fingerprint-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(128, 138, 168, 0.1);
}

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

.fingerprint-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.fingerprint-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
    word-break: break-all;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .top-bar {
        padding: 0 16px;
    }
    
    .ip-input-container {
        min-width: 180px;
    }
    
    #info-panel {
        left: 16px;
        right: 16px;
        width: auto;
        max-height: 60vh;
        bottom: 16px;
        top: auto;
    }
    
    #current-location-panel {
        right: 16px;
        left: 16px;
        width: auto;
        max-height: 40vh;
        bottom: 16px;
        top: auto;
        transform: translateY(20px);
    }
    
    #current-location-panel.visible {
        transform: translateY(0);
    }
    
    .map-controls {
        bottom: 16px;
        right: 16px;
    }
    
    .logo {
        font-size: 1rem;
    }
    
    .top-controls {
        gap: 12px;
    }
}