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

html { height: 100%; overflow: auto; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 { font-size: 28px; font-weight: 600; }

.header p { opacity: 0.9; margin-top: 5px; }

.container { max-width: 1400px; margin: 30px auto; padding: 0 20px; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.stat-card .value {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-card.success .value { color: #10b981; }
.stat-card.error .value { color: #ef4444; }
.stat-card.processing .value { color: #f59e0b; }
.stat-card.total .value { color: #667eea; }

.stat-card .subtitle { color: #999; font-size: 13px; }

.section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.section h2 {
    font-size: 20px;
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

table { width: 100%; border-collapse: collapse; }

th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

tr:hover { background: #f8f9fa; }

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge.success { background: #d1fae5; color: #065f46; }
.badge.accepted { background: #ccfbf1; color: #0d9488; }
.badge.error { background: #fee2e2; color: #991b1b; }
.badge.failed { background: #fef3c7; color: #92400e; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.processing { background: #e0e7ff; color: #3730a3; }
.badge.pending { background: #f3f4f6; color: #4b5563; }

.refresh-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
}

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

.back-btn {
    background: #94a3b8;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    margin-right: 10px;
}

.back-btn:hover { background: #64748b; }

.ai-btn {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    margin-right: 10px;
}

.ai-btn:hover { background: #059669; }

.loading { text-align: center; padding: 40px; color: #999; }

.error-message { text-align: center; padding: 40px; color: #ef4444; }

.error-item {
    padding: 15px;
    border-left: 4px solid #ef4444;
    margin-bottom: 15px;
    background: #fef2f2;
    border-radius: 0 8px 8px 0;
}

.error-item h4 { color: #991b1b; margin-bottom: 5px; }

.error-item .description { color: #666; font-size: 14px; margin-bottom: 8px; }

.error-item .resolution { color: #059669; font-size: 13px; font-weight: 600; }

.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.tab.active {
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

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

.tab-content { display: none; }

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

/* TX Link - Make it clearly clickable */
.tx-link {
    color: #667eea;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tx-link:hover {
    color: #5568d3;
    border-bottom: 2px solid #5568d3;
}

/* Transaction Detail Styles */
.detail-view { display: none; }

.detail-view.active { display: block; }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.detail-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.detail-field { background: #f8f9fa; padding: 15px; border-radius: 8px; }

.detail-field label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 5px;
}

.detail-field .value {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.log-timeline { position: relative; padding-left: 30px; }

.log-item {
    position: relative;
    padding: 15px;
    margin-bottom: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.log-item.error { border-left-color: #ef4444; background: #fef2f2; }

.log-item.success { border-left-color: #10b981; background: #f0fdf4; }

.log-item.accepted { border-left-color: #0d9488; background: #f0fdfa; }

.log-item .time { font-size: 12px; color: #666; margin-bottom: 5px; }

.log-item .step { font-weight: 600; color: #333; margin-bottom: 8px; }

.log-item .status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.json-data pre {
    white-space: pre-wrap;
    word-break: break-all;
}

.json-data {
    background: #1e293b;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

.json-toggle {
    color: #667eea;
    cursor: pointer;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 600;
}

.json-toggle:hover { text-decoration: underline; }

.json-content { display: none; margin-top: 10px; }

.json-content.show { display: block; }

.copy-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

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