:root {
	--bg: #0b0f14;
	--panel: #121821;
	--panel-2: #0f141b;
	--text: #e6edf3;
	--muted: #a3b1c2;
	--accent: #3b82f6;
	--success: #22c55e;
	--danger: #ef4444;
	--border: #1e2937;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
	margin: 0;
	font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
	background: radial-gradient(1200px 600px at 20% -20%, #132030, transparent), var(--bg);
	color: var(--text);
}
header {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--border);
	background: linear-gradient(180deg, var(--panel), var(--panel-2));
	position: sticky; top: 0; z-index: 10;
}
h1 { font-size: 18px; margin: 0; letter-spacing: 0.3px; }

#network, #wallet { display: flex; gap: 8px; align-items: center; }
select, input, button {
	background: #0c1117;
	border: 1px solid var(--border);
	color: var(--text);
	padding: 8px 10px;
	border-radius: 8px;
	outline: none;
}
button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.ghost { background: transparent; }
button.disabled, button:disabled {
    background: #2a2f3a !important;
    border-color: #2a2f3a !important;
    color: #6b7280 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

main { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; padding: 16px; }
section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }

.form {
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 16px;
	margin-bottom: 12px;
	background: #0e141c;
	min-height: 600px;
}
.form h3 { margin: 0 0 8px 0; font-size: 14px; color: var(--muted); }
.row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; align-items: center; margin: 6px 0; }
.row label { color: var(--muted); font-size: 12px; }
.row input, .row select { width: 100%; }

.actions { display: flex; gap: 8px; margin-top: 10px; }
.small { font-size: 12px; color: var(--muted); }

#logs { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; }
.log-line { padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.log-line.ok { color: var(--success); }
.log-line.err { color: var(--danger); }

/* Fee estimation styles */
.fee-section {
    min-height: 300px;
    margin: 16px 0;
    padding: 12px;
    background: var(--panel-2);
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
}

.fee-section-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    visibility: hidden;
}

.fee-section-overlay.visible {
    visibility: visible;
}

.fee-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: var(--muted);
}

.fee-breakdown, .estimated-output, .effective-bps {
    margin-bottom: 12px;
}

.fee-item, .output-item, .bps-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
}

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

.fee-item.total {
	font-weight: bold;
	color: var(--accent);
	border-top: 2px solid var(--border);
	padding-top: 8px;
}

.fee-item.error {
	color: var(--danger);
	font-weight: bold;
}

.tooltip {
    cursor: help;
    color: var(--muted);
    font-size: 10px;
    background: var(--border);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.tooltip:hover {
    background: var(--accent);
    color: white;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}