@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --background: #000000;
    --primary: #ffffff;
    --secondary: #cccccc;
    --highlight: #ffffff;
    --font: 'VT323', monospace;
}

#main-ui {
    display: block; /* Changed from none to block */
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: #000000;
}

#canvas-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#startup-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem;
    text-align: center;
    z-index: 1001;
}

.startup-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

body {
    margin: 0;
    overflow: hidden;
    background-color: var(--background);
    color: var(--primary);
    font-family: var(--font);
    font-size: 20px;
}

* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input,
textarea {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

.ui-panel {
    position: absolute;
    padding: 10px;
    background-color: #000000;
    border: 3px solid var(--primary);
    box-shadow: none;
    z-index: 10;
}

h2,
h3,
h4 {
    color: var(--primary);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 22px;
}

#info {
    top: 10px;
    left: 10px;
}

#latest-data {
    color: var(--primary);
    min-height: 20px;
}

#daily-stats {
    margin-top: 10px;
    border-top: 2px solid var(--primary);
    padding-top: 10px;
}

#daily-stats div {
    margin-bottom: 5px;
}

#navigation-prev,
#navigation-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
}

#navigation-prev {
    left: 20px;
}

#navigation-next {
    right: 20px;
}

.arrow {
    font-size: 48px;
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.arrow:hover {
    opacity: 1;
}

#date-display {
    top: 20px;
    right: 20px;
}

#date-picker-panel {
    position: absolute;
    top: 60px; /* under the date display */
    right: 20px;
    z-index: 120; /* above other panels */
    width: 300px;
}

#date-picker-panel .search-input {
    font-size: 16px;
    padding: 6px 8px;
}

#date-picker-panel .search-btn {
    padding: 6px 10px;
    font-size: 16px;
}

#legend {
    bottom: 10px;
    left: 10px;
}

#legend h3 {
    border-bottom: 2px solid var(--primary);
    padding-bottom: 5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 5px;
}

.legend-color-box {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    background-color: transparent;
    border-width: 2px;
    border-style: solid;
    border-color: var(--primary);
}

#controls {
    bottom: 0; /* flush to corner */
    right: 0;
}

/* Hide legend title; the colors are self-explanatory */
#legend-title {
    display: none;
}

#controls button,
.search-btn,
.viz-btn {
    background-color: transparent;
    color: var(--primary);
    border: 3px solid var(--primary);
    padding: 8px 15px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 20px;
    text-transform: uppercase;
    transition: all 0.2s;
}

#controls button:hover,
.search-btn:hover,
.viz-btn:hover {
    background-color: var(--primary);
    color: var(--background);
}

#controls button.active,
.search-btn.active,
.viz-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--background);
}

/* Panels */
#block-info-panel {
    display: none;
    border: 4px solid var(--primary);
    background-color: transparent;
    top: 80px;
    right: 20px;
    width: 300px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

#content-preview-panel {
    display: none;
    border: 4px solid var(--primary);
    background-color: transparent;
    top: 80px;
    right: 340px;
    width: 280px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

#search-panel {
    display: none;
    border: 4px solid var(--primary);
    background-color: transparent;
    top: 150px;
    left: 10px;
    width: 320px;
    max-height: calc(100vh - 170px);
    overflow-y: auto;
}

#viz-modes-panel {
    display: none;
    border: 4px solid var(--primary);
    background-color: transparent;
}

.info-section,
.search-section,
.viz-section {
    margin-bottom: 15px;
    padding: 10px;
    border: 2px solid var(--primary);
    background: transparent;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 18px;
}

.info-label {
    color: var(--primary);
}

.info-value {
    color: var(--primary);
}

#block-height a {
    color: var(--primary);
    text-decoration: underline;
}

/* Loading Progress Bar Styles */
.progress-bar {
    width: 100%;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid var(--primary);
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

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

#loading-status {
    color: var(--primary);
    font-size: 12px;
    text-align: center;
    margin-top: 5px;
}

/* Transaction Browser */
#transaction-list {
    max-height: 250px;
    overflow-y: auto;
}

.transaction-item {
    padding: 8px;
    margin-bottom: 5px;
    border: 2px solid var(--primary);
    cursor: pointer;
}

.transaction-item:hover,
.transaction-item.expanded {
    border-color: var(--primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.tx-header {
    font-size: 18px;
    display: flex;
    justify-content: space-between;
}

.tx-type {
    font-weight: bold;
    margin: 0 10px;
    color: var(--primary);
}

.tx-id {
    color: var(--secondary);
}

.tx-size {
    color: var(--primary);
}

.tx-details {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 2px solid var(--primary);
    display: none;
    font-size: 16px;
}

.tx-details.show {
    display: block;
}

/* Content Preview */
.content-display {
    font-size: 16px;
    white-space: pre-wrap;
    word-break: break-all;
    background: #000000;
    padding: 10px;
    border: 2px solid var(--primary);
}

.content-image {
    max-width: 100%;
    height: auto;
    border: 2px solid var(--primary);
}

/* Inputs */
.search-input,
.size-input {
    width: calc(100% - 12px);
    padding: 8px;
    background: #00000099;
    border: 2px solid var(--primary);
    color: var(--highlight);
    font-family: var(--font);
    font-size: 18px;
    margin-bottom: 8px;
}

.search-input:focus,
.size-input:focus {
    outline: none;
    border-color: var(--highlight);
}

.close-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--highlight);
    color: var(--background);
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-family: var(--font);
    font-size: 20px;
    line-height: 1;
}

.close-btn:hover {
    background: var(--secondary);
}

#genesis-panel {
    position: absolute;
    top: 80px;
    right: 20px;
}

#genesis-panel button {
    font-size: 18px;
}

#toast {
    position: fixed;
    bottom: 30px;
    right: 20px;
    background: rgba(0,0,0,0.85);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 8px 12px;
    border-radius: 4px;
    z-index: 9999;
}
