/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121826;
    color: #e6e6e6;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
header {
    background: linear-gradient(90deg, #1f2937, #111827);
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 2000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    color: #4ade80;
    font-size: 1.8rem;
}

/* Hamburger toggle (hidden by default on desktop) */
.nav-toggle {
    display: none;
    background: rgba(31, 41, 55, 0.6);
    border: 1px solid #374151;
    color: #e6e6e6;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
.nav-toggle:hover {
    background: rgba(55, 65, 81, 0.8);
    border-color: #4b5563;
}
.nav-toggle i {
    pointer-events: none;
}
.nav-toggle:focus {
    outline: 2px solid #4ade80;
    outline-offset: 2px;
}

nav ul {
    display: flex;
    list-style: none;
}

nav ul li {
    margin-left: 1.5rem;
}

/* Do not auto-push last nav item; spacing handled by header layout */
nav ul li:last-child {
    margin-left: 1.5rem;
}

nav ul li a {
    color: #9ca3af;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

nav ul li a:hover,
nav ul li a.active {
    color: #4ade80;
    background-color: rgba(74, 222, 128, 0.1);
}

/* Tip/announcement banner */
.tip-banner {
    background: linear-gradient(90deg, #0f172a, #111827);
    border-top: 1px solid #374151;
    border-bottom: 1px solid #1f2937;
    padding: 0.35rem 0;
}

.tip-banner-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tip-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
}

.tip-text {
    flex: 1;
    color: #d1d5db;
    font-size: 0.9rem;
    min-height: 1.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tip-close {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}

.tip-close:hover {
    color: #e5e7eb;
}

/* Scrolling ticker styles */
.tip-ticker {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 1.2rem;
}

.tip-track {
    display: flex;
    align-items: center;
    gap: 2rem;
    white-space: nowrap;
    will-change: transform;
    animation: tip-scroll var(--tip-speed, 30s) linear infinite;
}

.tip-item {
    color: #d1d5db;
    font-size: 0.9rem;
}

.tip-ticker:hover .tip-track {
    animation-play-state: paused;
}

@keyframes tip-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tip-track {
        animation: none;
    }
}

/* Responsive tweaks for tip banner */
@media (max-width: 480px) {
    .tip-badge {
        display: none;
    }

    .tip-text,
    .tip-item {
        font-size: 0.85rem;
    }
}

#xwt-balance-header {
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background-color: rgba(31, 41, 55, 0.5);
    transition: all 0.3s ease;
}

#xwt-balance-header:hover {
    color: #4ade80;
    background-color: rgba(74, 222, 128, 0.1);
}

/* Main content */
main {
    padding: 2rem 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
    color: #4ade80;
}

.filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    background-color: #1f2937;
    color: #d1d5db;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background-color: #4ade80;
    color: #1f2937;
}

/* Stats section */
.all-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(145deg, #1f2937, #111827);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-card p {
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.5rem;
    color: #4ade80;
}

.stat-card small {
    color: #6b7280;
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

/* Utility classes */
.hidden {
    display: none;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.btn-primary {
    background-color: #4ade80;
    color: #1f2937;
}

.btn-primary:hover {
    background-color: #22c55e;
}

.btn-secondary {
    background-color: #374151;
    color: #e6e6e6;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    /* Header stays single row with title + hamburger */
    header .container {
        position: relative; /* anchor dropdown */
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    /* Show hamburger on mobile (centered in header) */
.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 3001;
}

    header h1 {
        font-size: 1.2rem;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    /* Nav occupies remaining space */
    nav {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    /* Hide menu by default on mobile */
    nav ul {
        display: none;
        list-style: none;
        margin: 0;
        padding: 0;
    }

    /* Dropdown panel when open */
    nav.open ul {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        position: absolute;
        top: calc(100% + 8px); /* below header */
        right: 0;
        left: 0;
        background: #0f172a;
        border: 1px solid #374151;
        border-radius: 0.5rem;
        padding: 0.5rem;
        z-index: 3000;
        box-shadow: 0 8px 20px rgba(0,0,0,0.35);
    }

    /* Item spacing inside dropdown */
    nav ul li {
        margin-left: 0;
        flex: 0 0 auto;
    }
    nav ul li:last-child {
        margin-left: 0;
    }

    /* Compact, tap-friendly items */
    nav ul li a {
        display: block;
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
        white-space: nowrap;
        border-radius: 0.4rem;
    }

    #wallet-button {
        width: auto;
        padding: 0.55rem 0.75rem;
        font-size: 0.95rem;
        white-space: nowrap;
        margin-left: auto;
    }

    #xwt-balance-header {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
        white-space: nowrap;
        display: inline-block;
        width: 100%;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .filters {
        align-self: stretch;
        justify-content: space-between;
    }

    .filter-btn {
        flex: 1;
        text-align: center;
    }

    .all-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .all-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 1.25rem;
    }
}

/* No Connection State Styles */
.no-connection-state {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(145deg, #1f2937, #111827);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.no-connection-icon {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

.connection-slash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 4px;
    height: 5rem;
    background-color: #ef4444;
    border-radius: 2px;
}

.no-connection-state h3 {
    font-size: 2rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.no-connection-state p {
    font-size: 1.1rem;
    color: #9ca3af;
    margin-bottom: 2rem;
}

.connection-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.connection-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connection-tips {
    background: rgba(31, 41, 55, 0.5);
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: left;
    max-width: 500px;
    margin: 0 auto;
}

.connection-tips h4 {
    color: #4ade80;
    margin-bottom: 1rem;
    text-align: center;
}

.connection-tips ul {
    list-style: none;
    padding: 0;
}

.connection-tips li {
    color: #d1d5db;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.connection-tips li:before {
    content: "•";
    color: #4ade80;
    position: absolute;
    left: 0;
    font-weight: bold;
}

.testing-connection-state {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(145deg, #1f2937, #111827);
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.testing-connection-state h3 {
    color: #4ade80;
    margin-bottom: 1rem;
}

.testing-connection-state p {
    color: #9ca3af;
}

/* Loading spinner */
.loading-spinner {
    border: 3px solid #374151;
    border-top: 3px solid #4ade80;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Farm summary no connection state */
.summary-content.no-connection {
    opacity: 0.6;
}

.summary-content.no-connection .summary-header h3 {
    color: #ef4444;
}

/* Responsive styles for no connection state */
@media (max-width: 768px) {
    .no-connection-state {
        padding: 3rem 1.5rem;
    }

    .connection-actions {
        flex-direction: column;
        align-items: center;
    }

    .connection-actions .btn {
        width: 100%;
        max-width: 200px;
        justify-content: center;
    }

    .connection-tips {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .no-connection-state h3 {
        font-size: 1.5rem;
    }

    .no-connection-state p {
        font-size: 1rem;
    }

    .no-connection-icon {
        margin-bottom: 1.5rem;
    }

    .no-connection-icon i {
        font-size: 3rem !important;
    }

    .connection-slash {
        height: 4rem;
    }
}

/*
 Footer styles */
.footer {
    background: linear-gradient(90deg, #111827, #0f172a);
    margin-top: 4rem;
    padding: 3rem 0 1rem;
    border-top: 1px solid #374151;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: #4ade80;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section h4 {
    color: #e6e6e6;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.footer-section p {
    color: #9ca3af;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section ul li a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section ul li a:hover {
    color: #4ade80;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: 1rem;
    text-align: center;
}

.footer-bottom p {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Footer responsive design */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .footer {
        padding: 2rem 0 1rem;
    }
}

@media (max-width: 480px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-section h3 {
        font-size: 1.3rem;
    }

    .footer-section h4 {
        font-size: 1rem;
    }
}
/* Wallet button styles (shared across pages) */
#wallet-button {
    background-color: #374151;
    color: #e6e6e6;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#wallet-button:hover {
    background-color: #4b5563;
}

#wallet-button.connected {
    background-color: #10b981;
    color: #fff;
}