/* --- Xaman Specific Global Styles for DEX Page --- */

/* Keep FROM/TO balance text from running under token icons (no ellipsis dots) */
#fromBalance,
#toBalance {
    display: inline-block;
    max-width: 12ch;
    overflow: hidden;
    white-space: nowrap;
    vertical-align: bottom;
}

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

body {
    background-color: #000000;
    color: #e0e0e0;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
}

/* --- Visibility Helpers --- */
.mobile-only {
    display: none;
}

/* --- Tactical Header Styles --- */
header {
    background-color: #050a14;
    border-bottom: 1px solid rgba(0, 170, 255, 0.4);
    padding: 15px 3%;
    position: sticky;
    top: 0;
    z-index: 1000;
    font-family: 'Share Tech Mono', monospace;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative; /* Required for absolute positioning of child elements */
    min-height: 50px; /* Ensure nav has height for absolute positioning */
}

.logo a {
    font-size: 24px;
    color: #00aaff;
    font-weight: bold;
    text-decoration: none;
    letter-spacing: 2px;
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.7);
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 28px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%); /* Perfect centering */
    z-index: 1;
}

.nav-links li a {
    color: #c0c0c0;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 16px;
    letter-spacing: 1px;
    padding: 5px 0;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.nav-links li a:hover,
.dropdown:hover > a {
    color: #00aaff;
    text-shadow: 0 0 8px rgba(0, 170, 255, 0.8);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

/* Xaman buttons container - position at far right using absolute */
.nav-actions:has(#xamanConnectBtn) {
    position: absolute !important;
    right: 0 !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 10;
}

/* Base wallet button container - position 50px left of Xaman container using absolute */
/* When Xaman is connected, move Base button left to maintain 50px gap */
.nav-actions:has(#connectWalletButton):not(:has(#xamanConnectBtn)) {
    position: absolute !important;
    right: 200px !important; /* Default position - 50px gap from Xaman Connect button */
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 9;
    transition: right 0.3s ease !important; /* Smooth transition when Xaman connects */
}

/* When Xaman wallet address is visible, adjust Base button position */
nav:has(#xamanWalletAddress.connected) .nav-actions:has(#connectWalletButton) {
    right: 280px !important; /* Move left to account for Xaman wallet address width + 50px gap */
}

/* Base wallet button itself - no additional margin needed - ALL STATES */
#baseWalletBtn,
#connectWalletButton,
#connectWalletButtonMobile,
#connectWalletButton.connected,
#connectWalletButton:not(.connected),
button.connect-wallet-btn,
button.connect-wallet,
button.connect-wallet-btn.connect-wallet,
.connect-wallet-btn,
.connect-wallet-btn.connect-wallet,
.connect-wallet-btn.connected,
.connect-wallet-btn:not(.connected) {
    margin: 0 !important;
    border: 1px solid rgba(0, 255, 255, 0.4) !important; /* Matches swap status card border */
    border-radius: 6px !important; /* Matches swap status card */
    clip-path: none !important; /* Remove any clip-path that might override border-radius */
}

.connect-wallet-btn,
.connect-wallet-btn.connect-wallet,
.connect-wallet-btn.connected,
.connect-wallet-btn:not(.connected),
button.connect-wallet-btn,
button.connect-wallet,
button.connect-wallet-btn.connect-wallet,
#connectWalletButton,
#connectWalletButton.connected,
#connectWalletButton:not(.connected),
#connectWalletButtonMobile {
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.4) !important; /* Matches swap status card border */
    color: #00aaff;
    padding: 10px 20px;
    text-transform: uppercase;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s, color 0.3s;
    border-radius: 6px !important; /* Matches swap status card - replaced clip-path */
    clip-path: none !important; /* Remove any clip-path that might override border-radius */
}

.connect-wallet-btn:hover {
    background-color: rgba(0, 170, 255, 0.1);
}

/* ============================================
   XAMAN WALLET BUTTONS (Custom IDs - No Conflicts)
   ============================================ */

/* Xaman Wallet Address Display - with tactical border when connected */
#xamanWalletAddress {
    color: #00aaff;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    margin-right: 15px;
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.7);
    display: none; /* Hidden by default, shown when connected */
    padding: 10px 20px;
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.4); /* Matches swap status card border */
    border-radius: 6px; /* Matches swap status card - replaced clip-path */
    transition: background-color 0.3s, text-shadow 0.3s;
    white-space: nowrap;
}

#xamanWalletAddress.connected {
    display: inline-block; /* Changed to inline-block to maintain border styling */
}

/* Xaman Connect Button - matches tactical style */
#xamanConnectBtn {
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.4); /* Matches swap status card border */
    color: #00aaff;
    padding: 10px 20px;
    text-transform: uppercase;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s, color 0.3s, text-shadow 0.3s;
    border-radius: 6px; /* Matches swap status card - replaced clip-path */
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

#xamanConnectBtn:hover {
    background-color: rgba(0, 170, 255, 0.1);
    text-shadow: 0 0 8px rgba(0, 170, 255, 0.8);
}

#xamanConnectBtn span {
    font-size: 16px;
}

/* Xaman Logout Button - matches tactical style, hidden by default */
#xamanLogoutBtn {
    background: transparent;
    border: 1px solid rgba(0, 255, 255, 0.4); /* Matches swap status card border */
    color: #00aaff;
    padding: 10px 20px;
    text-transform: uppercase;
    font-family: 'Share Tech Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.3s, color 0.3s, text-shadow 0.3s;
    border-radius: 6px; /* Matches swap status card - replaced clip-path */
    display: none !important; /* Force hidden by default - only show when logged in */
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    visibility: hidden; /* Double protection - hidden by default */
    opacity: 0;
}

#xamanLogoutBtn.visible {
    display: inline-flex !important; /* Show when user is logged in */
    visibility: visible;
    opacity: 1;
}

#xamanLogoutBtn:hover {
    background-color: rgba(0, 170, 255, 0.1);
    text-shadow: 0 0 8px rgba(0, 170, 255, 0.8);
}

#xamanLogoutBtn span {
    font-size: 16px;
}

/* Base Wallet Button Container - position to the right */
.nav-actions:has(#connectWalletButton) {
    margin-left: auto !important;
    margin-right: 0 !important;
    order: 3; /* Ensure it comes after Xaman buttons */
}

/* Base Wallet Button - position 50px left of Xaman Connect button - ALL STATES */
#baseWalletBtn,
#connectWalletButton,
#connectWalletButton.connected,
#connectWalletButton:not(.connected),
#connectWalletButtonMobile,
button.connect-wallet-btn,
button.connect-wallet,
button.connect-wallet-btn.connect-wallet,
.connect-wallet-btn,
.connect-wallet-btn.connect-wallet,
.connect-wallet-btn.connected,
.connect-wallet-btn:not(.connected) {
    margin-left: 0 !important;
    margin-right: 50px !important; /* 50px gap from Xaman Connect button */
    border: 1px solid rgba(0, 255, 255, 0.4) !important; /* Matches swap status card border */
    border-radius: 6px !important; /* Matches swap status card */
    clip-path: none !important; /* Remove any clip-path that might override border-radius */
}

/* Xaman nav-actions container - position to far right */
.nav-actions:has(#xamanConnectBtn) {
    margin-left: auto !important;
    margin-right: 0 !important;
    order: 2; /* Comes before Base button */
}

/* Ensure nav-actions containers don't interfere with centering */
.nav-actions {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    position: relative !important;
}

/* --- Dropdown Styles --- */
.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #050a14;
    border: 1px solid rgba(0, 170, 255, 0.5);
    min-width: 160px;
    z-index: 1;
    top: 120%;
    left: 50%;
    transform: translateX(-50%);
}

.dropdown-content a {
    color: #c0c0c0;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: rgba(0, 170, 255, 0.1) !important;
    color: #00aaff !important;
}

.dropdown:hover .dropdown-content {
    display: block;
}

/* --- Hamburger & Mobile Menu --- */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: #00aaff;
    transition: all 0.3s ease-in-out;
}

/* --- Page Content Styles --- */
main {
    padding: 0 5%;
}

.section {
    padding: 80px 0;
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
    border-bottom: 1px solid #222;
}

.section h1, .section h2 {
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    color: #00aaff;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

.section p {
    margin-bottom: 15px;
    font-size: 18px;
    color: #ccc;
}

.section a {
    color: #00aaff;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    background: #000;
    margin-top: 30px;
    border-radius: 30px;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.volcano-run-image {
    max-width: 100%;
    height: auto;
    margin-top: -10px;
}

img {
    max-width: 100%;
    height: auto;
    margin-top: 20px;
}

/* Footer - minimal top margin to keep it visible */
footer {
    margin-top: -5px !important; /* Minimal spacing from DEX container */
    text-align: center;
    padding: 20px 0 !important; /* Reduced padding to keep footer visible */
    font-family: 'Share Tech Mono', monospace;
    color: #555;
    font-size: 14px;
}

/* ============================================
   WALLET BALANCES BOX (Tactical Aesthetic)
   ============================================ */
#wallet-balances.wallet-balances-box {
    background-color: rgba(5, 10, 20, 0.95);
    border: 1px solid rgba(0, 255, 255, 0.4) !important; /* Matches swap status card border */
    border-radius: 6px !important; /* Matches swap status card - replaced clip-path */
    padding: 20px;
    margin: 20px auto;
    max-width: 600px;
    font-family: 'Share Tech Mono', monospace;
    box-shadow: 0 0 15px rgba(0, 170, 255, 0.2);
}

#wallet-balances.wallet-balances-box .balance-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 170, 255, 0.2);
    color: #c0c0c0;
    font-size: 14px;
}

#wallet-balances.wallet-balances-box .balance-item:last-child {
    border-bottom: none;
}

#wallet-balances.wallet-balances-box .balance-label {
    color: #00aaff;
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.5);
}

#wallet-balances.wallet-balances-box .token-acronym {
    font-weight: bold;
    color: #00aaff;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#wallet-balances.wallet-balances-box .token-detail {
    color: #888;
    font-size: 12px;
    margin-left: 5px;
}

#wallet-balances.wallet-balances-box .balance-value {
    color: #e0e0e0;
    font-weight: bold;
    text-shadow: 0 0 3px rgba(0, 170, 255, 0.3);
}

#wallet-balances.wallet-balances-box .balance-empty {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* --- Responsive Styles --- */
@media screen and (max-width: 992px) {
    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 70px; /* Header height */
        left: 0;
        width: 100%;
        background-color: #050a14;
        border-top: 1px solid rgba(0, 170, 255, 0.4);
        padding: 10px 0;
    }

    .nav-links.active {
        display: flex;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        padding: 10px 0;
    }
    
    .nav-links li a {
        font-size: 18px;
    }

    .dropdown-content {
        position: static;
        transform: none;
        border: none;
        background-color: transparent;
        min-width: unset;
        width: 100%;
    }

    .dropdown-content a {
        text-align: center;
        color: #999;
        font-size: 16px;
        padding: 8px 0;
    }
    
    .dropdown:hover .dropdown-content {
        display: none; /* Hide on hover for touch devices */
    }
    
    .dropdown.active .dropdown-content {
        display: block; /* Show when toggled via JS */
    }

    .hamburger {
        display: flex;
    }
    
    .hamburger.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .hamburger.active span:nth-child(2) {
        opacity: 0;
    }

    .hamburger.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }
    
    .desktop-only { display: none; }
    .mobile-only { display: block; }
}

