:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-hover: #222633;
    --border: #2a2f3e;
    --text: #e4e6ed;
    --text-muted: #8b92a5;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --purple: #a855f7;
    --radius: 10px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.app {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Header */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header h1 .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 6px 14px;
    background: var(--surface);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.connection-status .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.connection-status.connected .dot {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

.connection-status.disconnected .dot {
    background: var(--danger);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--primary);
}

.stat-card .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
}

.stat-card .value.primary { color: var(--primary); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.info { color: var(--info); }

/* Webhook info */
.webhook-info {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.webhook-info .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.webhook-info code {
    background: var(--bg);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--info);
    flex: 1;
    min-width: 200px;
    word-break: break-all;
}

.webhook-info .copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.webhook-info .copy-btn:hover {
    background: var(--primary-hover);
}

/* Filters */
.filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filters select,
.filters input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
}

.filters select:focus,
.filters input:focus {
    border-color: var(--primary);
}

.filters input {
    min-width: 200px;
}

.filters .btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filters .btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filters .btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Notification list */
.notification-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    animation: slideIn 0.3s ease;
}

.notification-item:hover {
    background: var(--surface-hover);
    border-color: var(--primary);
}

.notification-item.new {
    border-left: 3px solid var(--primary);
    animation: highlight 1s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes highlight {
    0% { background: rgba(59, 130, 246, 0.15); }
    100% { background: var(--surface); }
}

.notification-item .badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-product_configured { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.badge-product_deleted { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-stock_changed { background: rgba(6, 182, 212, 0.15); color: var(--info); }
.badge-supply_changed { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-hold_changed { background: rgba(168, 85, 247, 0.15); color: var(--purple); }
.badge-price_changed { background: rgba(59, 130, 246, 0.15); color: var(--primary); }
.badge-time_limit_enabled,
.badge-time_limit_disabled,
.badge-time_limit_changed { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-order { background: rgba(59, 130, 246, 0.15); color: var(--primary); }

.notification-item .content {
    min-width: 0;
}

.notification-item .title {
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.notification-item .title .product-id {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.85rem;
}

.notification-item .summary {
    font-size: 0.85rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-item .meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.notification-item .meta .time {
    display: block;
    margin-bottom: 4px;
}

.notification-item .meta .sign-badge {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
}

.sign-valid { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.sign-invalid { background: rgba(239, 68, 68, 0.15); color: var(--danger); }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 8px;
}

.empty-state .hint {
    font-size: 0.85rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination button {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 12px;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.modal-close:hover {
    color: var(--text);
    background: var(--bg);
}

.modal-body {
    padding: 24px;
}

.detail-grid {
    display: grid;
    gap: 12px;
}

.detail-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    font-size: 0.9rem;
}

.detail-row .key {
    color: var(--text-muted);
}

.detail-row .value {
    word-break: break-all;
}

.detail-row pre {
    background: var(--bg);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    animation: toastIn 0.3s ease;
    max-width: 360px;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .notification-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .notification-item .meta {
        text-align: left;
        display: flex;
        gap: 12px;
        align-items: center;
    }

    .detail-row {
        grid-template-columns: 1fr;
    }
}
