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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 30px;
}

header {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-content > div:first-child {
    text-align: left;
}

header h1 {
    font-size: 2.5em;
    color: #667eea;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
}

.auth-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s;
}

.auth-btn:hover {
    background: #5568d3;
}

.logout-btn {
    background: #f87171;
}

.logout-btn:hover {
    background: #ef4444;
}

#usernameDisplay {
    margin-right: 10px;
    font-weight: bold;
    color: #667eea;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-input {
    flex: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: border-color 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-btn {
    padding: 15px 30px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.search-btn:hover {
    background: #5568d3;
}

.search-hint {
    color: #888;
    font-size: 0.9em;
    margin-left: 5px;
}

.search-hint code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Statistics */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-label {
    font-size: 0.9em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
}

.stat-value.small {
    font-size: 1em;
    font-weight: normal;
}

.stat-value.valid {
    color: #4ade80;
}

.stat-value.broken {
    color: #f87171;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    color: #333;
    font-size: 1.5em;
}

.refresh-btn, .clear-btn, .close-btn {
    padding: 8px 16px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.refresh-btn:hover, .clear-btn:hover, .close-btn:hover {
    background: #5568d3;
}

/* Table */
.table-container {
    overflow-x: auto;
    position: relative;
    min-height: 200px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

thead {
    background: #667eea;
    color: white;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

tbody tr {
    transition: background 0.2s;
    cursor: pointer;
}

tbody tr:hover {
    background: #f5f5f5;
}

tbody tr:last-child td {
    border-bottom: none;
}

.hash-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.external-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
    word-break: break-all;
}

.external-link:hover {
    color: #5568d3;
    text-decoration: underline;
}

.balance.positive {
    color: #10b981;
    font-weight: 600;
}

.balance.zero {
    color: #6b7280;
}
    white-space: nowrap;
}

/* Chain View */
.chain-container {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.chain-entry {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
}

.chain-entry.valid {
    border-color: #4ade80;
}

.chain-entry.broken {
    border-color: #f87171;
}

.chain-entry.genesis {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
}

.chain-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
}

.chain-entry-title {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
}

.chain-entry-index {
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9em;
}

.chain-entry-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
    font-weight: 600;
}

.detail-value {
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    word-break: break-all;
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
}

.detail-value.full {
    font-size: 0.75em;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1em;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: opacity 0.3s ease-in;
    border-radius: 8px;
}

.table-container {
    position: relative;
}

/* Smooth transitions for table */
table {
    transition: opacity 0.3s ease-in;
}

/* Error */
.error {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #c33;
}

/* Success */
.success {
    background: #efe;
    color: #3c3;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #3c3;
}

/* Verification Badge */
.verification-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    margin-left: 10px;
}

.verification-badge.valid {
    background: #4ade80;
    color: white;
}

.verification-badge.broken {
    background: #f87171;
    color: white;
}

/* Link indicator */
.chain-link {
    text-align: center;
    margin: 10px 0;
    color: #667eea;
    font-size: 1.5em;
}

.chain-link::before {
    content: "↓";
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #333;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    border: 2px solid #ddd;
    border-radius: 6px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 0.85em;
}

.sign-form {
    background: #f9f9f9;
    padding: 25px;
    border-radius: 8px;
}

.error-message {
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 6px;
    border-left: 4px solid #c33;
}

.success-message {
    margin-top: 15px;
    padding: 12px;
    background: #efe;
    color: #3c3;
    border-radius: 6px;
    border-left: 4px solid #3c3;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header h1 {
        font-size: 1.8em;
    }

    .search-container {
        flex-direction: column;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: 0.9em;
    }

    th, td {
        padding: 8px;
    }
}


/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #3b82f6;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-switch input:disabled + .toggle-slider {
    opacity: 0.6;
    cursor: not-allowed;
}
