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

:root {
    --bg: #1a1d29;
    --bg-secondary: #0f1117;
    --bg-tertiary: #161922;
    --border: #2a2d3a;
    --text: #e4e7eb;
    --text-secondary: #b8bcc8;
    --text-muted: #6b7280;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

header h1 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 400;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

.metric-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.metric-card.highlight {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}

.metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.metric-value.large {
    font-size: 40px;
    color: var(--success);
}

.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

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

.panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.panel h2 {
    color: var(--text);
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.log-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    min-height: 400px;
    max-height: 400px;
}

.log-entry {
    color: var(--text-secondary);
    margin-bottom: 6px;
    padding: 6px 8px;
    background: var(--bg);
    border-radius: 4px;
    border-left: 2px solid var(--border);
    padding-left: 10px;
    word-break: break-word;
}

.log-entry.new {
    border-left-color: var(--success);
    background: rgba(16, 185, 129, 0.15);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.heatmap-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px;
    min-height: 400px;
    max-height: 400px;
}

.heatmap-placeholder {
    color: var(--text-muted);
    text-align: center;
    padding: 60px 20px;
    font-size: 14px;
}

.heatmap-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.15s ease;
}

.heatmap-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.heatmap-item.vulnerable {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

.heatmap-address {
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    color: var(--text);
    font-weight: 500;
    font-size: 12px;
}

.heatmap-time {
    color: var(--text-muted);
    font-size: 11px;
}

footer {
    text-align: center;
    padding: 20px;
    margin-top: 32px;
    border-top: 1px solid var(--border);
}

.warning {
    color: var(--warning);
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Notification styles */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.notification {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideInRight 0.3s ease;
    min-width: 320px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--success);
    font-size: 20px;
}

.notification-content {
    flex: 1;
}

.notification-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    margin-bottom: 4px;
}

.notification-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.notification-close:hover {
    background: var(--bg-tertiary);
    color: var(--text);
}

body {
    background: var(--bg-secondary);
}

/* Tabs Navigation */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.tab-button:hover {
    color: var(--text);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Settings Panel */
.settings-panel {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
}

.settings-panel h2 {
    color: var(--text);
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.settings-panel h3 {
    color: var(--text);
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: 600;
}

/* Form Styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    transition: all 0.15s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-help {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--primary);
}

/* Settings Display */
.settings-display {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.setting-item:last-child {
    border-bottom: none;
}

.setting-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.setting-value {
    color: var(--text);
    font-size: 13px;
    font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
    word-break: break-all;
    text-align: right;
    max-width: 60%;
}

/* Control Panel */
.control-panel {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: pulse 2s infinite;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-dot.stopped {
    background: var(--text-muted);
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.control-buttons {
    display: flex;
    gap: 12px;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

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

select.form-input {
    cursor: pointer;
}

/* Diagnostic Panel */
.diagnostic-panel {
    max-width: 1400px;
    margin: 0 auto;
}

.diagnostic-header {
    text-align: center;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.diagnostic-header h2 {
    color: var(--text);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.diagnostic-description {
    color: var(--text-muted);
    font-size: 14px;
}

.diagnostic-info {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}

.diagnostic-info h3 {
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.diagnostic-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.diagnostic-info li {
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.diagnostic-info li:last-child {
    border-bottom: none;
}

.log-entry.diagnostic {
    border-left-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

/* Analysis Tab Styles */
.analysis-panel {
    padding: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-item {
    background: var(--bg-tertiary);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary);
}

.scan-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
    width: 0%;
}

.table-container {
    overflow-x: auto;
    margin-top: 16px;
}

.analysis-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.analysis-table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border);
}

.analysis-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

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

.analysis-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.analysis-table .address-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--primary);
    word-break: break-all;
}

.table-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 32px !important;
    font-style: italic;
}
