/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-green: #00ff88;
    --primary-green-dark: #00cc6a;
    --bg-dark: #000000;
    --glass-bg: rgba(0, 0, 0, 0.75);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --success: #00ff88;
    --error: #ff4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background Gradient */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: #000000;
    overflow: hidden;
}

/* CSS-only animated gradient layers - Low performance impact */
.background-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle 300px at 15% 20%, 
            rgba(0, 255, 136, 0.3) 0%, 
            rgba(0, 255, 136, 0.15) 20%,
            transparent 50%),
        radial-gradient(circle 250px at 85% 70%, 
            rgba(0, 255, 136, 0.25) 0%, 
            rgba(0, 255, 136, 0.12) 20%,
            transparent 50%),
        radial-gradient(circle 200px at 50% 80%, 
            rgba(0, 200, 100, 0.2) 0%, 
            rgba(0, 200, 100, 0.1) 20%,
            transparent 50%);
    animation: slowOrbitGlow 30s ease-in-out infinite;
    will-change: transform;
}

.background-gradient::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle 180px at 70% 30%, 
            rgba(0, 255, 136, 0.15) 0%,
            transparent 40%),
        radial-gradient(circle 150px at 25% 60%, 
            rgba(0, 255, 136, 0.12) 0%,
            transparent 40%);
    animation: gentleFloat 25s ease-in-out infinite;
    will-change: transform;
}

@keyframes gentleFloat {
    0%, 100% {
        transform: translate(0, 0);
    }
    33% {
        transform: translate(-30px, 20px);
    }
    66% {
        transform: translate(20px, -30px);
    }
}

/* Smooth, low-cost animations */
@keyframes slowOrbitGlow {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    33% {
        transform: translate(20px, -15px) scale(1.1);
        opacity: 0.9;
    }
    66% {
        transform: translate(-15px, 20px) scale(0.95);
        opacity: 0.85;
    }
}

/* Glass Card Effect */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5),
                inset 0 1px 0 0 rgba(255, 255, 255, 0.1);
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 20px;
    padding: 1px;
    background: linear-gradient(45deg, 
        transparent, 
        rgba(0, 255, 136, 0.1), 
        transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, 
                  linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.glass-card:hover::before {
    opacity: 1;
}

/* Navbar */
.navbar {
    padding: 1.5rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.logo img {
    height: 100px;
    width: auto;
    flex-shrink: 0;
}

.logo h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
}

.connect-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid rgba(0, 255, 136, 0.3);
    color: var(--success);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.connect-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(0, 255, 136, 0.1),
        transparent
    );
    transform: rotate(45deg);
    animation: shimmer 3s infinite;
    pointer-events: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.connect-btn:hover {
    background: rgba(0, 255, 136, 0.25);
    border-color: rgba(0, 255, 136, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

/* Main Container */
.container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Swap Container */
.swap-container {
    padding: 1.5rem;
    animation: fadeIn 0.5s ease, floatContainer 6s ease-in-out infinite;
}

@keyframes floatContainer {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

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

.swap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.swap-header h2 {
    font-size: 1.5rem;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.icon-btn:hover {
    transform: rotate(90deg);
}

/* Token Input Container */
.token-input-container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 1rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.balance {
    cursor: pointer;
    transition: color 0.3s ease;
}

.balance:hover {
    color: var(--text-primary);
}

.input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.token-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 2rem;
    font-weight: 500;
    outline: none;
    width: 100%;
}

.token-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

.token-selector {
    padding: 0.5rem 1rem;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.token-selector:hover {
    background: rgba(255, 255, 255, 0.1);
}

.token-selector-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
}

.token-selector-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.arrow {
    font-size: 0.8rem;
}

.max-btn {
    background: rgba(0, 255, 136, 0.15);
    border: 1px solid var(--primary-green);
    color: var(--primary-green);
    padding: 0.25rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 0.5rem;
}

.max-btn:hover {
    background: rgba(0, 255, 136, 0.25);
}

/* Swap Direction */
.swap-direction {
    display: flex;
    justify-content: center;
    margin: -0.5rem 0;
    position: relative;
    z-index: 2;
}

.swap-arrow {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-arrow:hover {
    transform: rotate(180deg);
    background: rgba(255, 255, 255, 0.1);
}

/* Swap Details */
.swap-details {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem;
    margin: 1rem 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Swap Button */
.swap-btn {
    width: 100%;
    padding: 1.2rem;
    border: 1px solid rgba(0, 255, 136, 0.3);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    background: rgba(0, 255, 136, 0.15);
    backdrop-filter: blur(10px);
    color: var(--success);
    position: relative;
    overflow: hidden;
}

.swap-btn:not(:disabled)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.swap-btn:not(:disabled):hover::before {
    width: 300px;
    height: 300px;
}

.swap-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: rgba(0, 255, 136, 0.25);
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 12px 40px rgba(0, 255, 136, 0.4);
}

.swap-btn:not(:disabled) {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.4);
    }
}

.swap-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    animation: none;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

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

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close-btn:hover {
    color: var(--text-primary);
}

/* Token List */
.token-list {
    padding: 1rem;
    overflow-y: auto;
    max-height: 400px;
}

.token-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.token-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.token-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid rgba(0, 255, 136, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary-green);
    overflow: hidden;
    flex-shrink: 0;
}

.token-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: white;
    border-radius: 50%;
}

.token-info {
    flex: 1;
}

.token-symbol {
    font-weight: 600;
    font-size: 1rem;
}

.token-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.token-balance {
    text-align: right;
    font-size: 0.9rem;
}

/* Settings */
.settings-content {
    padding: 1.5rem;
}

.settings-content label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
}

.slippage-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr) 1.5fr;
    gap: 0.5rem;
}

.slippage-btn {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.slippage-btn:hover,
.slippage-btn.active {
    background: rgba(0, 255, 136, 0.15);
    border-color: var(--primary-green);
    color: var(--primary-green);
}

#customSlippage {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
}

#customSlippage:focus {
    border-color: var(--primary-green);
}

/* Transaction Status */
.tx-status {
    padding: 2rem;
    text-align: center;
}

.spinner {
    margin: 0 auto 1rem;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.tx-link {
    display: inline-block;
    margin: 1rem 0;
    color: var(--primary-green);
    text-decoration: none;
}

.tx-link:hover {
    text-decoration: underline;
}

/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .navbar {
        padding: 1rem;
    }

    .nav-content {
        flex-direction: column;
        gap: 0.75rem;
        align-items: stretch;
    }

    .logo {
        justify-content: center;
    }

    .logo img {
        height: 50px;
    }

    .logo h1 {
        font-size: 1.5rem;
    }

    .nav-links {
        flex-direction: row;
        width: 100%;
        gap: 0.5rem;
        justify-content: center;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }

    .connect-btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .container {
        padding: 0 0.75rem;
        margin: 1rem auto;
    }

    .swap-container {
        padding: 1rem;
    }

    .swap-header h2 {
        font-size: 1.25rem;
    }

    .token-input {
        font-size: 1.5rem;
    }

    .token-selector {
        font-size: 0.9rem;
        padding: 0.4rem 0.75rem;
    }

    .max-btn {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    .slippage-options {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        max-width: none;
    }

    .footer {
        padding: 1.5rem 1rem;
        font-size: 0.8rem;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .logo img {
        height: 40px;
    }

    .logo h1 {
        font-size: 1.25rem;
    }

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nav-link {
        text-align: center;
        padding: 0.5rem;
    }

    .swap-container {
        padding: 0.75rem;
    }

    .token-input {
        font-size: 1.25rem;
    }

    .swap-btn {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.5);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.7);
}

