:root {
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(148, 163, 184, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #8b5cf6;
    --success-color: #10b981;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 2rem;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
header a:hover {
    text-decoration: none;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    display: none; /* Hidden on mobile, shown on desktop */
}

@media (min-width: 768px) {
    .subtitle {
        display: block;
    }
}

/* Main Content */
main {
    padding: 2rem 0;
}

section {
    scroll-margin-top: 140px;
}

/* Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--glass-shadow);
    border: 1px solid var(--card-border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0; /* Start hidden for animation */
    min-width: 0; /* Prevent grid overflow */
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.card h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h3 {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Status Section */
.status-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.status-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.status-content {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: auto;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.info-item {
    padding: 1rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    border: 1px solid var(--card-border);
    min-width: 0; /* Prevent grid overflow */
}

.info-item.no-border {
    background: transparent;
    border: none;
    padding: 0;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item strong {
    color: var(--text-secondary);
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    color: var(--text-primary);
}

.view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    background: var(--primary-gradient);
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

/* Mempool Transaction List */
.mempool-txs-container {
    margin-top: 1.5rem;
}

.mempool-header {
    padding: 0.75rem;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 8px;
    margin-bottom: 1rem;
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.tx-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Custom Scrollbar */
.tx-list::-webkit-scrollbar {
    width: 6px;
}

.tx-list::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.tx-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.tx-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    animation: staggerFade 0.4s ease forwards;
    cursor: pointer;
    min-width: 0; /* Prevent flex overflow */
}

.tx-item:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.tx-hash {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0; /* Prevent flex overflow */
}

.tx-view-btn {
    padding: 0.4rem 0.8rem;
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tx-view-btn:hover {
    background: var(--accent-color);
    color: white;
}

/* Transaction Modal */
.tx-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.tx-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.tx-modal-content {
    background: #1e293b;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    max-height: 85vh;
    border: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.tx-modal.active .tx-modal-content {
    transform: translateY(0);
}

.tx-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--card-border);
}

.tx-modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.tx-modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
    line-height: 1;
}

.tx-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.tx-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.tx-modal-body pre {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    word-break: break-all;
}

/* Transaction Details */
.tx-details {
    color: var(--text-primary);
}

.tx-section {
    margin-bottom: 2rem;
}

.tx-section h4 {
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tx-io-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tx-io-item {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    min-width: 0; /* Prevent overflow */
}

.tx-io-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.tx-io-index {
    color: var(--text-secondary);
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.tx-io-value {
    color: var(--success-color);
    font-weight: 600;
    font-size: 1rem;
    font-family: 'JetBrains Mono', monospace;
}

.tx-io-address {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    word-break: break-all;
}

.tx-io-hash {
    color: var(--text-secondary);
    font-size: 0.8rem;
    word-break: break-all;
    font-family: 'JetBrains Mono', monospace;
}

.tx-covenant {
    color: var(--accent-color);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--card-border);
    font-family: 'JetBrains Mono', monospace;
}

/* Tabs */
.search-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.tab-btn {
    flex: 1;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Search Box */
.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: 0.8rem 1.2rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15), 0 0 20px rgba(139, 92, 246, 0.2);
    background: rgba(15, 23, 42, 0.9);
}

.search-box input::placeholder {
    color: var(--text-secondary);
}

.search-box button {
    padding: 0.8rem 1.5rem;
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.search-box button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.search-box button:active {
    transform: translateY(0);
}

.secondary-btn {
    padding: 0.8rem 1.5rem;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-secondary);
}

/* Result Box */
.result-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    min-height: 100px;
    max-height: 600px;
    overflow-y: auto;
    margin-top: 1rem;
}

.result-box:empty {
    display: none;
}

.result-box pre {
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-all;
}

.result-box .error {
    color: #ef4444;
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.success-message {
    color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    word-break: break-all;
}

/* Scrollbar */
.result-box::-webkit-scrollbar {
    width: 8px;
}

.result-box::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 4px;
}

.result-box::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 4px;
}

.result-box::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Footer */
footer {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(12px);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    border-top: 1px solid var(--card-border);
}

footer p {
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.timestamp {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #a78bfa;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .card {
        padding: 1.5rem;
    }

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

    .search-box input,
    .search-box button {
        width: 100%;
    }

    .status-section {
        grid-template-columns: 1fr;
    }
    
    .tab-btn {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }
    
    .container {
        padding: 0 1rem;
    }

    .tx-io-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Loading Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.status-content:empty::after {
    content: 'Loading...';
    animation: pulse 1.5s ease-in-out infinite;
    color: var(--text-secondary);
    font-style: italic;
}

/* Loading Spinner */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    margin-bottom: 1rem;
}

.loading-text {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* New Animations */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes staggerFade {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Apply animations */
.card {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0; /* Start hidden for animation */
}

.search-section .card {
    animation-delay: 0.1s;
}

.status-section .card:nth-child(1) {
    animation-delay: 0.2s;
}

.status-section .card:nth-child(2) {
    animation-delay: 0.3s;
}

.additional-section .card {
    animation-delay: 0.4s;
}

.tx-item {
    animation: staggerFade 0.4s ease forwards;
}
