/* ═══════════════════════════════════════════════
   CFX 服务器查询工具 - 商业暗黑风格
   ═══════════════════════════════════════════════ */
:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1e2a3d;
    --border: #2a3a52;
    --border-glow: rgba(0, 212, 255, 0.3);
    --accent: #00d4ff;
    --accent2: #7c3aed;
    --accent-gradient: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-mute: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --radius: 16px;
    --radius-sm: 10px;
}

[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --border: #e2e8f0;
    --border-glow: rgba(0, 212, 255, 0.3);
    --accent: #0284c7;
    --accent2: #7c3aed;
    --text: #0f172a;
    --text-dim: #475569;
    --text-mute: #94a3b8;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
    position: relative;
    overflow-x: hidden;
}

/* 背景网格纹理 */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 212, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* 顶部渐变条 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    z-index: 1000;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* ── Header ── */
.header {
    padding: 40px 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 56px;
    height: 56px;
    background: var(--accent-gradient);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(0, 212, 255, 0.3);
}

.header-title h1 {
    font-size: 24px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.header-title p {
    font-size: 13px;
    color: var(--text-mute);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    color: var(--text-dim);
}

.icon-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.2);
}

.icon-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 212, 255, 0.1);
}

/* ── Search ── */
.search-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 32px;
    transition: all 0.3s;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.search-form {
    display: flex;
    gap: 12px;
}

.search-input-wrap {
    flex: 1;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-mute);
    font-size: 16px;
}

.search-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.search-input:focus {
    border-color: var(--accent);
    background: var(--bg-primary);
}

.search-input::placeholder {
    color: var(--text-mute);
}

.search-btn {
    padding: 14px 28px;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
}

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

.search-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.search-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-mute);
}

/* ── Toast ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
    max-width: 320px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }

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

/* ── Results Grid ── */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 900px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Card ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: all 0.3s;
}

.card:hover {
    border-color: rgba(0, 212, 255, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--accent);
}

/* ── Server Info ── */
.server-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.online-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border-radius: 20px;
    font-weight: 500;
}

.offline-badge {
    font-size: 12px;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border-radius: 20px;
    font-weight: 500;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.info-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .info-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .info-grid-3 {
        grid-template-columns: 1fr;
    }
}

.info-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    transition: all 0.2s;
}

.info-item:hover {
    border-color: var(--accent);
    background: var(--bg-primary);
}

.info-label {
    font-size: 11px;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    word-break: break-all;
}

.info-value.accent {
    color: var(--accent);
}

.info-value.success {
    color: var(--success);
}

.info-value.error {
    color: var(--error);
}

.info-value.warning {
    color: var(--warning);
}

.copy-btn {
    margin-left: 8px;
    padding: 2px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-mute);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Server Tags ── */
.server-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.server-tag {
    padding: 4px 12px;
    background: var(--accent-gradient);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

/* ── Project Info ── */
.project-info {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.project-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.project-name i {
    font-size: 14px;
}

.project-desc {
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
    word-break: break-word;
}

/* ── Location Card ── */
.location-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Player List ── */
.players-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.players-count {
    font-size: 14px;
    color: var(--text-dim);
}

.players-count strong {
    color: var(--accent);
}

.players-controls {
    display: flex;
    gap: 8px;
}

.control-input,
.control-select {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s;
}

.control-input:focus,
.control-select:focus {
    border-color: var(--accent);
}

.control-input {
    width: 160px;
}

.control-select {
    cursor: pointer;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.player-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.player-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.player-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-id {
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 2px;
}

.player-ping {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.player-ping.good { color: var(--success); }
.player-ping.medium { color: var(--warning); }
.player-ping.bad { color: var(--error); }

.players-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-mute);
}

.players-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.3;
}

/* ── Loading ── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 23, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

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

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

/* ── Quick Actions ── */
.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.action-btn {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.action-btn i {
    font-size: 14px;
}

/* ── Links ── */
.links-section {
    margin-top: 24px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
}

.link-item:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.link-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.link-text {
    flex: 1;
}

.link-title {
    font-size: 14px;
    font-weight: 500;
}

.link-desc {
    font-size: 11px;
    color: var(--text-mute);
    margin-top: 2px;
}

/* ── Footer ── */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-mute);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Responsive ── */
@media (max-width: 640px) {
    .container { padding: 0 16px 40px; }
    .header { padding: 24px 0 20px; flex-direction: column; align-items: flex-start; }
    .search-form { flex-direction: column; }
    .search-btn { width: 100%; justify-content: center; }
    .info-grid { grid-template-columns: 1fr; }
    .players-controls { width: 100%; flex-wrap: wrap; }
    .control-input { width: 100%; }
}

/* ── Server Banner ── */
.server-banner {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.server-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Recent Searches ── */
.recent-searches {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: none;
}

.recent-searches.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.recent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-dim);
}

.recent-header span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.recent-clear {
    background: none;
    border: none;
    color: var(--text-mute);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.recent-clear:hover {
    color: var(--error);
}

.recent-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.recent-item {
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.recent-item:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.recent-item i {
    font-size: 11px;
    opacity: 0.7;
}

/* ── Join Link ── */
#serverJoinLink {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Fade Animation ── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
