/* Safe Transaction Decoder - Minimal Styles */

:root {
    --primary: #004225;
    --primary-dark: #003018;
    --primary-light: #e6ede9;
    --danger: #dc3545;
    --warning: #f0ad4e;
    --warning-bg: #fff8e6;
    --success: #28a745;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 4px;
    --radius-lg: 6px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    
    --bg-body: var(--gray-50);
    --bg-card: white;
    --bg-code: var(--gray-100);
    --text-primary: var(--gray-800);
    --text-secondary: var(--gray-500);
    --text-heading: var(--gray-900);
    --border-color: var(--gray-200);
    --border-light: var(--gray-100);
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #2e8b57;
        --primary-dark: #004225;
        --primary-light: #1a2e24;
        --warning-bg: #3d3520;
        --gray-50: #0a0a0a;
        --gray-100: #141414;
        --gray-200: #1f1f1f;
        --gray-300: #2d2d2d;
        --gray-400: #525252;
        --gray-500: #737373;
        --gray-600: #a3a3a3;
        --gray-700: #d4d4d4;
        --gray-800: #e5e5e5;
        --gray-900: #fafafa;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
        
        --bg-body: #0a0a0a;
        --bg-card: #141414;
        --bg-code: #1f1f1f;
        --text-primary: #e5e5e5;
        --text-secondary: #a3a3a3;
        --text-heading: #fafafa;
        --border-color: #2d2d2d;
        --border-light: #1f1f1f;
    }
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.4;
    font-size: 0.875rem;
    min-height: 100vh;
}

.container {
    max-width: 860px;
    margin: 0 auto;
    padding: 1rem 0.75rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 1rem;
}

header h1 {
    font-size: 1.25rem;
    color: var(--text-heading);
    margin-bottom: 0.125rem;
}

header h1 a {
    text-decoration: none;
    color: inherit;
}

header .subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Form */
.decode-form {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 0.75rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
    font-size: 0.8rem;
}

.form-group .help-text {
    display: block;
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.125rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.4;
    resize: vertical;
    background: var(--bg-body);
    color: var(--text-primary);
    transition: border-color 0.15s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
}

.paste-btn {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    padding: 0.25rem 0.5rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.15s;
}

.paste-btn:hover {
    background: var(--gray-200);
}

input[type="text"],
select {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8rem;
    background: var(--bg-body);
    color: var(--text-primary);
    transition: border-color 0.15s;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
}

.submit-btn {
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.submit-btn:hover {
    background: var(--primary-dark);
}

/* Result Page */
.summary-section {
    margin-bottom: 0.75rem;
}

.summary-section h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.section-help {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.625rem 0.75rem;
}

.summary-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-row {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.detail-row .label {
    color: var(--text-secondary);
    flex-shrink: 0;
    min-width: 100px;
}

.detail-row .value {
    color: var(--text-primary);
}

.detail-row .value.address code {
    font-size: 0.75rem;
}

/* Warnings */
.warnings-section {
    margin-bottom: 0.75rem;
}

.warning-card {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
}

.warning-card h3 {
    color: var(--warning);
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.warning-card ul {
    margin: 0;
    padding-left: 1.25rem;
    font-size: 0.8rem;
}

.warning-card li {
    margin-bottom: 0.125rem;
}

/* Error */
.error-section {
    margin-bottom: 0.75rem;
}

.error-card {
    background: var(--bg-card);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 0.75rem;
    text-align: center;
}

.error-card h2 {
    color: var(--danger);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.error-card p {
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.btn-back {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
}

.btn-back:hover {
    text-decoration: underline;
}

/* Badges */
.unverified-badge,
.unknown-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    font-size: 0.7rem;
    font-weight: 500;
}

.unverified-badge {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.unknown-badge {
    background: var(--gray-100);
    color: var(--gray-500);
}

.value-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.75rem;
}

.delegatecall-badge {
    background: rgba(240, 173, 78, 0.15);
    color: var(--warning);
    padding: 0.125rem 0.375rem;
    border-radius: var(--radius);
    font-size: 0.7rem;
    font-weight: 500;
}

/* MultiSend */
.multisend-section {
    margin-bottom: 0.75rem;
}

.multisend-section h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.inner-tx-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.inner-tx-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.625rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.inner-tx-number {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.75rem;
}

.inner-tx-function {
    font-weight: 600;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.75rem;
}

.inner-tx-details {
    padding: 0.5rem 0.625rem;
}

.inner-tx-details .detail-row {
    font-size: 0.75rem;
}

.inner-tx-details .params-section {
    margin-top: 0.375rem;
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-light);
}

.inner-tx-details .params-section h4 {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Parameters Table */
.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.params-table th,
.params-table td {
    text-align: left;
    padding: 0.25rem 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.params-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.params-table td.param-name {
    font-weight: 600;
    white-space: nowrap;
}

.params-table td.param-type {
    color: var(--text-secondary);
    white-space: nowrap;
}

.params-table td.param-value code {
    font-size: 0.7rem;
    word-break: break-all;
}

/* Hashes Section */
.hashes-section {
    margin-bottom: 0.75rem;
}

.hashes-section h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.hash-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.5rem 0.625rem;
}

.hash-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.8rem;
}

.hash-row:last-child {
    border-bottom: none;
}

.hash-row .label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    flex-shrink: 0;
    min-width: 130px;
}

.hash-value-wrapper {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex: 1;
    min-width: 0;
}

.hash-value {
    background: var(--bg-code);
    padding: 0.25rem 0.375rem;
    border-radius: var(--radius);
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.7rem;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    padding: 0.2rem 0.4rem;
    cursor: pointer;
    font-size: 0.7rem;
    transition: background 0.15s;
    flex-shrink: 0;
}

.copy-btn:hover {
    background: var(--gray-200);
}

/* Raw JSON */
.raw-section {
    margin-bottom: 0.75rem;
}

.raw-section h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.json-block {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin: 0;
    padding: 0.5rem 0.625rem;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.7rem;
    line-height: 1.4;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Actions */
.actions-section {
    margin-top: 1rem;
    text-align: center;
}

.btn-primary {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* Parameters Section in Summary */
.summary-card .params-section {
    margin-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.5rem;
}

.summary-card .params-section h4 {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
    font-size: 0.75rem;
}

.params-list {
    margin-top: 0.25rem;
}

.param-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-light);
    align-items: baseline;
    font-size: 0.8rem;
}

.param-row:last-child {
    border-bottom: none;
}

.param-row .param-name {
    font-weight: 600;
    color: var(--text-primary);
}

.param-row .param-type {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.param-row .param-type code {
    background: none;
    padding: 0;
    color: var(--text-secondary);
}

.param-row .param-value {
    flex: 1;
    min-width: 150px;
    word-break: break-all;
}

.param-row .param-value code {
    background: var(--bg-code);
    padding: 0.125rem 0.25rem;
    display: inline-block;
    font-size: 0.7rem;
}

/* Footer */
footer {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

footer a {
    color: var(--text-secondary);
}

footer a:hover {
    color: var(--text-primary);
}

/* Code elements */
code {
    background: var(--bg-code);
    padding: 0.0625rem 0.25rem;
    border-radius: 3px;
    font-family: "SF Mono", Monaco, Consolas, monospace;
    font-size: 0.85em;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--gray-800);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    opacity: 0;
    transition: transform 0.2s, opacity 0.2s;
    z-index: 1000;
    font-size: 0.8rem;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}
