:root {
    --bg-primary: #0a0e27;
    --bg-secondary: #141832;
    --bg-card: #1a1f3a;
    --bg-input: #0f1330;
    --accent: #00d4ff;
    --accent-secondary: #7c5ce7;
    --accent-glow: rgba(0, 212, 255, 0.15);
    --text-primary: #e8e8f0;
    --text-secondary: #8892b0;
    --text-muted: #5a6380;
    --border: #1e2a4a;
    --danger: #ff4757;
    --success: #2ed573;
    --warning: #ffa502;
    --radius: 12px;
    --radius-sm: 8px;
    --font-mono: 'Courier New', 'Source Code Pro', monospace;
}

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

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(circle, rgba(0, 212, 255, 0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, var(--bg-primary) 60%, rgba(10, 14, 39, 0.95));
    backdrop-filter: blur(10px);
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    text-align: center;
}

.header-title span {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Search */
.search-bar {
    padding: 12px 20px;
    position: relative;
    z-index: 1;
}

.search-input {
    width: 100%;
    height: 44px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 0 44px 0 20px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
}

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

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.search-btn {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--accent);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
}

/* Card List */
.card-list {
    padding: 0 16px 100px;
    position: relative;
    z-index: 1;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent-secondary));
    opacity: 0;
    transition: opacity 0.3s;
}

.card:active {
    transform: scale(0.98);
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.card:active::before {
    opacity: 1;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-meta .dot {
    width: 4px;
    height: 4px;
    background: var(--accent);
    border-radius: 50%;
}

/* Archive search results */
.archive-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.archive-field {
    display: flex;
    padding: 6px 0;
    font-size: 0.9rem;
}

.archive-field .label {
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}

.archive-field .value {
    color: var(--text-primary);
    word-break: break-all;
}

.archive-number {
    font-family: var(--font-mono);
    color: var(--accent) !important;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.7rem;
    transition: color 0.3s;
    min-width: 64px;
    min-height: 44px;
    justify-content: center;
}

.nav-item.active {
    color: var(--accent);
}

.nav-item .nav-icon {
    font-size: 1.3rem;
    line-height: 1;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* Loading */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

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

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px 0;
    flex-wrap: wrap;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0 10px;
}

.page-btn:active,
.page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg-primary);
    font-weight: 600;
}

.page-btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--accent);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: 22px;
    font-size: 0.9rem;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Result count */
.result-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 0 4px 8px;
}

/* ============ Admin Styles ============ */
.admin-body {
    background: var(--bg-primary);
    min-height: 100vh;
    padding-bottom: 40px;
}

.admin-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.admin-header .user-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
}

.admin-tabs {
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-tabs a {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    min-width: 80px;
}

.admin-tabs a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.admin-content {
    padding: 16px;
    max-width: 900px;
    margin: 0 auto;
}

/* Admin search bar */
.admin-search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.admin-search-bar input,
.admin-search-bar select {
    height: 40px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

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

.admin-search-bar input {
    flex: 1;
    min-width: 140px;
}

.admin-search-bar select {
    min-width: 100px;
}

.admin-search-bar .date-input {
    width: 140px;
}

.btn {
    height: 40px;
    padding: 0 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}

.btn-primary:active {
    opacity: 0.8;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-sm {
    height: 32px;
    padding: 0 12px;
    font-size: 0.8rem;
}

/* Admin Table */
.admin-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 600px;
}

.admin-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.admin-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.admin-table tr:active {
    background: rgba(0, 212, 255, 0.03);
}

.admin-table .actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal .form-group {
    margin-bottom: 16px;
}

.modal label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.modal input,
.modal select,
.modal textarea {
    width: 100%;
    height: 42px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.modal textarea {
    height: 100px;
    padding: 12px;
    resize: vertical;
}

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

.modal .btn-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Login page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 0 40px var(--accent-glow);
}

.login-card h2 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 24px;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card input {
    width: 100%;
    height: 46px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 14px;
    outline: none;
}

.login-card input:focus {
    border-color: var(--accent);
}

.login-card .btn {
    width: 100%;
    height: 46px;
    font-size: 1rem;
    justify-content: center;
    margin-top: 8px;
}

.login-error {
    color: var(--danger);
    font-size: 0.8rem;
    text-align: center;
    margin-top: 12px;
    display: none;
}

/* Confirm dialog */
.confirm-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Page size selector */
.page-size-select {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.page-size-select select {
    height: 32px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
}

/* Utility */
.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.mb-16 { margin-bottom: 16px; }

/* Responsive - slightly larger screens */
@media (min-width: 768px) {
    .card-list {
        padding: 0 24px 100px;
    }
    .card {
        padding: 20px;
    }
    .admin-content {
        padding: 24px;
    }
}
