/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&family=Montserrat:wght@700&display=swap');

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

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Open Sans', sans-serif;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 50px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

nav {
    display: flex;
    align-items: center;
    gap: 30px;
}

nav a {
    color: #667eea;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s;
}

nav a:hover::after {
    width: 100%;
}

nav a:hover {
    color: #764ba2;
}

#connect-metamask, #disconnect-metamask {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#connect-metamask:hover, #disconnect-metamask:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 50px 20px;
}

.logo-section {
    margin-bottom: 30px;
}

.logo-section .main-logo {
    max-width: 100%;
    height: auto;
    max-height: 150px;
    display: block;
    margin: 0 auto;
    animation: float 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
}

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

/* Swap Container */
.swap-container, .pool-container {
    background: rgba(255, 255, 255, 0.98);
    padding: 40px;
    border-radius: 24px;
    max-width: 540px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.swap-container h1, .pool-container h1 {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
}

.swap-container p, .pool-container p {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.swap-box, .pool-box {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 16px;
    border: 2px solid #e9ecef;
}

.token-input-group {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.token-input-group label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.amount-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    font-weight: 600;
    outline: none;
    color: #333;
}

.amount-input::placeholder {
    color: #ccc;
}

.token-select {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.token-select:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

.max-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.3s;
}

.max-btn:hover {
    background: #764ba2;
}

.swap-arrow {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.swap-arrow button {
    background: white;
    border: 2px solid #e9ecef;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
    color: #667eea;
}

.swap-arrow button:hover {
    background: #667eea;
    color: white;
    transform: rotate(180deg);
}

.plus-icon {
    text-align: center;
    font-size: 1.5rem;
    color: #667eea;
    font-weight: 700;
    margin: 12px 0;
}

.swap-details, .pool-details {
    background: white;
    padding: 16px;
    border-radius: 12px;
    margin-top: 16px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #666;
}

.detail-row span:last-child {
    font-weight: 600;
    color: #333;
}

.action-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

.status-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    display: none;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
    display: block;
}

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

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

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 24px;
    max-width: 420px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-family: 'Montserrat', sans-serif;
    color: #667eea;
    font-size: 1.5rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: #667eea;
}

.token-search {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.3s;
}

.token-search:focus {
    border-color: #667eea;
}

.common-tokens {
    margin-bottom: 20px;
}

.common-token-label {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    font-weight: 600;
}

#common-tokens-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.common-token-item {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.common-token-item:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.token-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.token-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
}

.token-item-info {
    flex: 1;
}

.token-item-symbol {
    font-weight: 700;
    font-size: 1rem;
    color: #333;
}

.token-item-name {
    font-size: 0.85rem;
    color: #666;
}

.token-item-balance {
    font-weight: 600;
    color: #667eea;
}

/* Pool Tabs */
.pool-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 16px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tab-btn:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
}

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

/* Pool Specific Styles */
.token-pair-select {
    margin-bottom: 20px;
}

.pair-dropdown {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.pair-dropdown:focus {
    border-color: #667eea;
}

.amount-slider {
    margin: 24px 0;
}

.amount-slider label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e9ecef;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
}

.preset-btn {
    flex: 1;
    padding: 8px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    color: #667eea;
    transition: all 0.3s;
}

.preset-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

/* Positions Grid */
.positions-grid {
    display: grid;
    gap: 16px;
    max-width: 600px;
    margin: 0 auto;
}

.position-card {
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.position-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.position-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.position-header h3 {
    font-weight: 700;
    font-size: 1.2rem;
    color: #333;
    margin: 0;
}

.position-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.position-pair {
    font-weight: 700;
    font-size: 1.2rem;
    color: #333;
}

.position-lp {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #667eea;
    font-weight: 600;
}

.position-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
}

.no-positions {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.no-positions p {
    font-size: 1.1rem;
}

.info-section {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 20px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

.social-links {
    margin-bottom: 20px;
}

.social-links a {
    margin: 0 10px;
}

.social-links img {
    width: 30px;
    transition: transform 0.3s;
    filter: grayscale(100%);
}

.social-links img:hover {
    transform: scale(1.2);
    filter: none;
}

.shardeum-logo {
    width: 100px;
    opacity: 0.8;
}

.wallet-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#connection-status {
    font-size: 0.9rem;
    color: #667eea;
    font-weight: 600;
    background: #e8f0fe;
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    nav {
        flex-wrap: wrap;
        justify-content: center;
    }

    .swap-container, .pool-container {
        padding: 24px;
    }

    .input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .token-select {
        width: 100%;
    }

    .pool-tabs {
        flex-direction: column;
    }

    .slider-labels {
        flex-wrap: wrap;
    }
}

/* Loading Animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}