/* ============================================================
   MAC OUI 厂商查询 - 技术工业风暗色主题
   ============================================================ */

:root {
    /* 背景层 */
    --bg:           #0a0e1a;
    --bg-elevated:  #131829;
    --bg-hover:     #1a2138;
    --bg-input:     #0d1322;

    /* 边框 */
    --border:        #1f2942;
    --border-strong: #2d3a5c;

    /* 文本 */
    --text:        #e6e9f2;
    --text-muted:  #8892a8;
    --text-dim:    #5a6478;

    /* 强调色 */
    --accent:        #00d9a3;
    --accent-glow:   rgba(0, 217, 163, 0.35);
    --accent-dim:    rgba(0, 217, 163, 0.08);
    --amber:         #ffb347;
    --amber-glow:    rgba(255, 179, 71, 0.3);
    --danger:        #ff5c5c;
    --danger-dim:    rgba(255, 92, 92, 0.1);

    /* 排版 */
    --font-mono:   'Space Mono', 'JetBrains Mono', 'Courier New', monospace;
    --font-sans:   'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* 尺寸 */
    --radius:      8px;
    --radius-sm:   4px;
    --shadow:      0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px var(--accent-glow);
}

/* ---------------------- 重置 ---------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    color: var(--text);
    background-color: var(--bg);
    /* 细密网格背景，呼应电路板 */
    background-image:
        linear-gradient(rgba(0, 217, 163, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 217, 163, 0.025) 1px, transparent 1px),
        radial-gradient(ellipse at top, rgba(0, 217, 163, 0.06), transparent 60%);
    background-size: 48px 48px, 48px 48px, 100% 100%;
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: #4dffc7; text-shadow: 0 0 8px var(--accent-glow); }

/* ---------------------- 布局 ---------------------- */
.container {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
}

.site-header {
    padding: 32px 0 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 14px;
}

.site-logo {
    height: 36px;
    width: auto;
    max-width: 200px;
    display: block;
}

.site-title {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.site-title::before {
    content: '> ';
    color: var(--accent);
    opacity: .8;
}

.site-main { padding-bottom: 80px; }

.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    color: var(--text-dim);
    font-size: 0.85rem;
    text-align: center;
}

.site-footer .icp {
    margin-top: 6px;
    color: var(--text-muted);
}

.site-footer .icp a { color: var(--text-muted); }
.site-footer .icp a:hover { color: var(--accent); }

/* ---------------------- 查询区 ---------------------- */
.hero {
    text-align: center;
    margin-bottom: 36px;
}

.hero h1 {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    line-height: 1.2;
}

.hero h1 .accent { color: var(--accent); }

.hero p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

.search-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

/* 卡片顶部细线装饰 */
.search-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: .6;
}

.search-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.mac-input {
    flex: 1;
    min-width: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 1.05rem;
    letter-spacing: 0.05em;
    transition: border-color .15s, box-shadow .15s;
}

.mac-input::placeholder {
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.mac-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim), inset 0 0 12px rgba(0, 217, 163, 0.05);
}

.btn {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0 24px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #001a13;
    box-shadow: 0 0 16px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    background: #4dffc7;
    box-shadow: 0 0 28px var(--accent-glow);
    transform: translateY(-1px);
}

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

.btn-primary:disabled {
    opacity: .5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-amber {
    background: var(--amber);
    color: #2a1a00;
    box-shadow: 0 0 16px var(--amber-glow);
}

.btn-amber:hover:not(:disabled) {
    background: #ffc97a;
    box-shadow: 0 0 28px var(--amber-glow);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text);
    border-color: var(--accent);
    background: var(--accent-dim);
}

.search-hint {
    margin-top: 12px;
    color: var(--text-dim);
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.search-hint code {
    color: var(--accent);
    background: var(--accent-dim);
    padding: 1px 6px;
    border-radius: 3px;
    margin: 0 2px;
}

/* ---------------------- 结果区 ---------------------- */
.result-area {
    margin-top: 28px;
    min-height: 60px;
}

.result-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow);
    animation: slideIn .3s ease;
}

.result-card.not-found {
    border-left-color: var(--amber);
}

.result-card.error {
    border-left-color: var(--danger);
}

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

.result-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border-strong);
}

.result-vendor {
    font-family: var(--font-sans);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.result-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 3px;
    padding: 2px 8px;
    letter-spacing: 0.05em;
}

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

.result-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
}

.result-value {
    font-family: var(--font-mono);
    color: var(--text);
    font-size: 0.95rem;
    word-break: break-word;
    white-space: pre-wrap;
}

.result-value.mono-accent {
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

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

/* ---------------------- 历史查询 ---------------------- */
.history {
    margin-top: 36px;
}

.history-title {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

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

.history-item {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all .15s;
}

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

.history-item .vendor {
    color: var(--text-dim);
    margin-left: 8px;
    font-size: 0.78rem;
}

.history-empty {
    color: var(--text-dim);
    font-size: 0.85rem;
    font-style: italic;
}

/* ---------------------- 管理员页面 ---------------------- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-family: var(--font-mono);
    font-size: 1.4rem;
}

.admin-header h1::before {
    content: '> ';
    color: var(--amber);
}

.admin-actions { display: flex; gap: 10px; }

.warning-banner {
    background: var(--danger-dim);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 14px 18px;
    color: var(--text);
    margin-bottom: 24px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.warning-banner::before {
    content: '!';
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    background: var(--danger);
    color: #1a0000;
    border-radius: 50%;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.panel {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.panel-title {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    margin-bottom: 6px;
    color: var(--text);
}

.panel-title::before { content: '## '; color: var(--accent); opacity: .6; }

.panel-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* 表单 */
.form-group { margin-bottom: 18px; }

.form-group label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color .15s, box-shadow .15s;
}

.form-control.mono { font-family: var(--font-mono); }

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
    font-family: var(--font-sans);
}

.form-help {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 5px;
}

/* 开关 */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    vertical-align: middle;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: 24px;
    transition: .2s;
}

.slider::before {
    content: '';
    position: absolute;
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: .2s;
}

.switch input:checked + .slider {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.switch input:checked + .slider::before {
    transform: translateX(22px);
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch-row label { margin: 0; cursor: pointer; }

/* 统计信息 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.stat-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    color: var(--accent);
    font-weight: 700;
}

.stat-value.dim { color: var(--text-muted); }

/* ---------------------- 登录页 ---------------------- */
.login-wrap {
    max-width: 380px;
    margin: 80px auto 0;
}

.login-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 32px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--amber));
}

.login-title {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 6px;
}

.login-sub {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-error {
    color: var(--danger);
    background: var(--danger-dim);
    border: 1px solid var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

.login-error.show { display: block; }

.login-card .btn-primary { width: 100%; }

/* ---------------------- Toast 提示 ---------------------- */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    color: var(--text);
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    z-index: 1000;
    max-width: 360px;
    animation: toastIn .25s ease;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--accent); }

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

/* ---------------------- 进度条 ---------------------- */
.progress-bar {
    height: 4px;
    background: var(--bg-input);
    border-radius: 2px;
    overflow: hidden;
    margin: 12px 0;
    display: none;
}

.progress-bar.show { display: block; }

.progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--amber));
    width: 30%;
    animation: indeterminate 1.2s ease-in-out infinite;
}

@keyframes indeterminate {
    0%   { transform: translateX(-100%); width: 40%; }
    50%  { width: 70%; }
    100% { transform: translateX(250%); width: 40%; }
}

/* ---------------------- 响应式 ---------------------- */
@media (max-width: 640px) {
    .container { padding: 0 16px; }
    .site-header { padding: 20px 0 12px; margin-bottom: 32px; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.9rem; }
    .search-card { padding: 20px 16px; }
    .search-row { flex-direction: column; }
    .btn-primary { width: 100%; padding: 14px; }
    .mac-input { font-size: 1rem; }
    .result-grid { grid-template-columns: 1fr; }
    .login-wrap { margin: 40px 16px 0; }
    .panel { padding: 18px 16px; }
}

/* 隐藏元素 */
.hidden { display: none !important; }

/* 文本工具类 */
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-accent { color: var(--accent); }
.text-amber { color: var(--amber); }
