/* ═══════════════════════════════════════════════════════════════════
   IP Lookup — 2026 现代极简风格样式
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS 变量 & 主题 ────────────────────────────────────────── */
:root {
    --color-bg: #0a0a0f;
    --color-surface: rgba(255, 255, 255, 0.04);
    --color-surface-hover: rgba(255, 255, 255, 0.07);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-border-active: rgba(255, 255, 255, 0.15);
    --color-text: #e8e8ed;
    --color-text-secondary: #8b8b9e;
    --color-text-muted: #5c5c6e;
    --color-accent: #6c5ce7;
    --color-accent-2: #00cec9;
    --color-accent-3: #fd79a8;
    --color-success: #00b894;
    --color-warning: #fdcb6e;
    --color-danger: #e17055;
    --color-glass-bg: rgba(255, 255, 255, 0.03);
    --color-glass-border: rgba(255, 255, 255, 0.06);
    --color-glass-shadow: rgba(0, 0, 0, 0.4);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --font-sans: 'Inter', 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 基础重置 ───────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

a {
    color: var(--color-accent-2);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--color-accent); }

/* ── 背景装饰 ───────────────────────────────────────────────── */
.bg-decoration {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.12;
    animation: blobFloat 20s ease-in-out infinite;
}

.bg-blob--1 {
    width: 600px; height: 600px;
    background: var(--color-accent);
    top: -200px; left: -150px;
    animation-delay: 0s;
}

.bg-blob--2 {
    width: 500px; height: 500px;
    background: var(--color-accent-2);
    bottom: -150px; right: -120px;
    animation-delay: -7s;
}

.bg-blob--3 {
    width: 400px; height: 400px;
    background: var(--color-accent-3);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(60px, -40px) scale(1.05); }
    50% { transform: translate(-30px, 50px) scale(0.95); }
    75% { transform: translate(-50px, -30px) scale(1.03); }
}

/* 网格背景 */
.bg-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 70%);
}

/* ── 应用容器 ───────────────────────────────────────────────── */
.app-container {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── 头部 ──────────────────────────────────────────────────── */
.header {
    text-align: center;
    padding: 40px 0 32px;
    position: relative;
}

.header__brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 8px 32px rgba(108, 92, 231, 0.3);
}

.header__title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--color-text);
}

.text-gradient {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__subtitle {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

/* ── 玻璃卡片 ───────────────────────────────────────────────── */
.glass-card {
    background: var(--color-glass-bg);
    border: 1px solid var(--color-glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
    border-color: var(--color-border-active);
}

/* ── 搜索卡片 ───────────────────────────────────────────────── */
.search-card {
    position: relative;
    overflow: hidden;
}

.search-card__body {
    padding: 28px;
}

.input-group {
    display: flex;
    gap: 12px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    font-size: 18px;
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-field {
    width: 100%;
    height: 52px;
    padding: 0 44px 0 44px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    outline: none;
    transition: all var(--transition-base);
}

.input-field::placeholder {
    color: var(--color-text-muted);
    font-family: var(--font-sans);
}

.input-field:focus {
    border-color: var(--color-accent);
    background: rgba(108, 92, 231, 0.06);
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.input-field:focus ~ .input-icon,
.input-field:focus + .input-icon { /* fallback */ }

.input-field:focus + .input-clear,
.input-wrapper:focus-within .input-icon {
    color: var(--color-accent);
}

.input-clear {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 18px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-fast), color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
}
.input-clear.visible { opacity: 1; }
.input-clear:hover { color: var(--color-text); }

/* 主按钮 */
.btn-primary {
    height: 52px;
    padding: 0 28px;
    background: linear-gradient(135deg, var(--color-accent), #a29bfe);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px rgba(108, 92, 231, 0.25);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(108, 92, 231, 0.35);
}
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 快捷操作 */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}

.chip:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--color-border-active);
    color: var(--color-text);
}
.chip:active { transform: scale(0.97); }

/* ── 加载覆盖层 ─────────────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 15, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    border-radius: var(--radius-lg);
    z-index: 10;
    transition: opacity var(--transition-base);
}

.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 22px; height: 22px;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── 结果区域 ───────────────────────────────────────────────── */
.result-section {
    margin-top: 24px;
    animation: fadeInUp 0.5s ease-out;
}

.result-section.hidden,
.error-section.hidden { display: none; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 概览卡片 */
.overview-card {
    padding: 28px;
    text-align: center;
    margin-bottom: 20px;
}

.overview-card__ip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.ip-address {
    font-family: var(--font-mono);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.ip-type-badge {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(108, 92, 231, 0.15);
    color: var(--color-accent);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-mono);
    text-transform: uppercase;
}

.overview-card__summary {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
}

/* 详情网格 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 768px) {
    .detail-grid { grid-template-columns: 1fr; }
}

.detail-card {
    padding: 22px;
    transition: transform var(--transition-base), border-color var(--transition-base);
}

.detail-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-border-active);
}

.detail-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.detail-card__header i {
    font-size: 20px;
    color: var(--color-accent);
}

.detail-card__header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.info-row:last-child { border-bottom: none; }

.info-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    flex-shrink: 0;
    margin-right: 12px;
}

.info-value {
    font-size: 0.85rem;
    color: var(--color-text);
    text-align: right;
    font-family: var(--font-mono);
    word-break: break-all;
}

/* ── 错误提示 ───────────────────────────────────────────────── */
.error-section {
    margin-top: 24px;
    animation: fadeInUp 0.4s ease-out;
}

.error-card {
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-color: rgba(225, 112, 85, 0.3);
    background: rgba(225, 112, 85, 0.06);
}

.error-card i {
    font-size: 22px;
    color: var(--color-danger);
    flex-shrink: 0;
}

.error-card span {
    color: var(--color-danger);
    font-size: 0.9rem;
}

/* ── 页脚 ───────────────────────────────────────────────────── */
.footer {
    margin-top: auto;
    padding: 32px 0 0;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.82rem;
}

.footer__copyright {
    margin-top: 6px;
    font-size: 0.78rem;
    opacity: 0.7;
}

/* ── 主题切换按钮 ─────────────────────────────────────────── */
.theme-toggle {
    position: absolute;
    top: 40px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--color-text-secondary);
    transition: all var(--transition-base);
    z-index: 10;
}

.theme-toggle:hover {
    border-color: var(--color-border-active);
    color: var(--color-text);
    transform: scale(1.05);
}

/* 亮色模式显示太阳，暗色模式显示月亮 */
[data-theme="light"] .theme-icon-dark,
[data-theme="dark"]  .theme-icon-light { display: none; }

/* ── 响应式 ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container { padding: 20px 16px 40px; }
    .header { padding: 24px 0 20px; }
    .header__title { font-size: 1.5rem; }
    .logo-icon { width: 40px; height: 40px; font-size: 20px; }
    .search-card__body { padding: 20px; }
    .input-group { flex-direction: column; }
    .btn-primary { justify-content: center; }
    .ip-address { font-size: 1.3rem; }
    .overview-card { padding: 20px; }
    .detail-card { padding: 16px; }
}

@media (max-width: 480px) {
    .quick-actions { justify-content: center; }
    .header__brand { flex-direction: column; gap: 8px; }
}

/* ════════════════════════════════════════════════════════════
   亮色主题 — 7:00~18:59
   ════════════════════════════════════════════════════════════ */
[data-theme="light"] {
    --color-bg: #f5f5f7;
    --color-surface: rgba(0, 0, 0, 0.03);
    --color-surface-hover: rgba(0, 0, 0, 0.06);
    --color-border: rgba(0, 0, 0, 0.08);
    --color-border-active: rgba(0, 0, 0, 0.15);
    --color-text: #1a1a2e;
    --color-text-secondary: #5a5a72;
    --color-text-muted: #9999aa;
    --color-glass-bg: rgba(255, 255, 255, 0.7);
    --color-glass-border: rgba(0, 0, 0, 0.06);
    --color-glass-shadow: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] body {
    background: var(--color-bg);
}

[data-theme="light"] .bg-blob {
    opacity: 0.06;
}

[data-theme="light"] .bg-grid {
    background-image:
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

[data-theme="light"] .glass-card {
    background: var(--color-glass-bg);
    box-shadow: 0 2px 16px var(--color-glass-shadow);
}

[data-theme="light"] .input-field {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .input-field:focus {
    background: rgba(108, 92, 231, 0.04);
}

[data-theme="light"] .chip {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .chip:hover {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .loading-overlay {
    background: rgba(245, 245, 247, 0.8);
}

[data-theme="light"] .info-row {
    border-bottom-color: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .btn-primary {
    box-shadow: 0 4px 16px rgba(108, 92, 231, 0.2);
}

[data-theme="light"] .overview-card__summary {
    color: var(--color-text-secondary);
}
