/* MultiDEX Dark Theme Styles */
.multidex-container {
    background: #0f172a;
    min-height: 100vh;
    padding: 20px;
    color: white;
}

.multidex-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
}

.multidex-header h1 {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06d6a0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    font-weight: 800;
}

.multidex-header p {
    font-size: 1.2rem;
    color: #cbd5e1;
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Main Layout */
.multidex-main {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

/* Routing Section (Left Side) */
.routing-section {
    flex: 1 1 520px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    padding: 32px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Trading Box (Right Side) - WIDENED */
.trading-box {
    flex: 0 0 520px; /* Increased from 420px to 520px */
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 20px;
    padding: 36px; /* Increased padding */
    margin: 0;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.trading-box:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 12px 48px rgba(59, 130, 246, 0.15);
    transform: translateY(-4px);
}

/* Token Box - Improved Spacing */
.token-box {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 16px;
    padding: 28px; /* Increased padding */
    margin-bottom: 16px; /* Increased margin */
    transition: all 0.3s ease;
    min-height: 120px; /* Added min-height to prevent overlap */
}

.token-box:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(15, 23, 42, 0.95);
    transform: translateY(-2px);
}

.token-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px; /* Increased margin */
    gap: 16px; /* Added gap */
}

.token-select-btn {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 12px;
    padding: 14px 18px; /* Increased padding */
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px; /* Increased gap */
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 180px; /* Added min-width */
}

.token-select-btn:hover {
    background: rgba(59, 130, 246, 0.25);
    border-color: rgba(59, 130, 246, 0.6);
    transform: scale(1.05);
}

.token-icon {
    width: 32px; /* Increased size */
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 14px;
}

.token-icon img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.amount-input {
    background: transparent;
    border: none;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-align: right;
    width: 220px; /* Increased width */
    outline: none;
}

.amount-input::placeholder {
    color: #64748b;
}

.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem; /* Slightly larger */
    color: #94a3b8;
    padding-top: 8px; /* Added padding */
}

.max-btn {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    border-radius: 6px;
    padding: 6px 10px; /* Increased padding */
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
}

.max-btn:hover {
    background: rgba(16, 185, 129, 0.3);
    transform: scale(1.1);
}

/* Swap Arrow - Better Positioning */
.swap-arrow-container {
    display: flex;
    justify-content: center;
    position: relative;
    margin: 8px 0; /* Increased margin */
}

.swap-arrow-btn {
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 50%;
    width: 56px; /* Increased size */
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #3b82f6;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.swap-arrow-btn:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.7);
    transform: rotate(180deg) scale(1.1);
}

/* Route Info Box */
.route-info {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(71, 85, 105, 0.2);
    border-radius: 12px;
    padding: 24px; /* Increased padding */
    margin: 24px 0; /* Increased margin */
    display: none;
}

.route-path {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px; /* Increased margin */
    flex-wrap: wrap;
}

.dex-tag {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 6px 12px; /* Increased padding */
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}

.route-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px; /* Increased gap */
    font-size: 0.95rem;
}

.route-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
}

.route-label {
    color: #94a3b8;
}

.route-value {
    color: white;
    font-weight: 600;
}

/* Swap Button - Improved */
.swap-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 16px;
    padding: 20px; /* Increased padding */
    font-size: 1.3rem; /* Increased font size */
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 24px; /* Increased margin */
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 60px; /* Added min-height */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.swap-btn:hover:not(:disabled) {
    filter: brightness(1.1);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

.swap-btn:disabled {
    background: rgba(75, 85, 99, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.swap-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.swap-btn:hover:not(:disabled)::before {
    left: 100%;
}

/* Routing Section Specific Styles */
.routing-header-box {
    margin-bottom: 24px;
}

.routing-header-box h2 {
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.toggle-label {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(71, 85, 105, 0.5);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #3b82f6;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.dex-comparison-table-container {
    position: relative;
    overflow-x: auto;
}

.dex-comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.dex-comparison-table th,
.dex-comparison-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}

.dex-comparison-table th {
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dex-comparison-table td {
    color: white;
    font-size: 0.9rem;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
    border-radius: 16px;
}

.loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.token-modal {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 32px;
    max-width: 520px; /* Increased width */
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.token-modal h2 {
    color: white;
    margin-bottom: 20px;
    text-align: center;
}

.token-search {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(71, 85, 105, 0.3);
    border-radius: 12px;
    padding: 16px;
    color: white;
    font-size: 1rem;
    margin-bottom: 20px;
}

.token-list {
    max-height: 300px;
    overflow-y: auto;
}

.token-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.token-option:hover {
    background: rgba(59, 130, 246, 0.1);
}

.close-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
    border-radius: 12px;
    padding: 12px 24px;
    margin-top: 20px;
    cursor: pointer;
    width: 100%;
    font-weight: 600;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

/* Price Impact Warning */
.price-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    color: #fca5a5;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

/* Additional Styling for New Features */
.best-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 0.6rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.reason-tag {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.selected-route {
    border: 2px solid #3b82f6 !important;
    background: rgba(59, 130, 246, 0.1) !important;
}

.route-best {
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Hide DEX Grid */
.dex-grid {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .multidex-container {
        padding: 12px;
    }
    
    .multidex-main {
        flex-direction: column;
        gap: 24px;
    }
    
    .routing-section,
    .trading-box {
        flex: none;
        padding: 20px;
    }
     
    .multidex-header h1 {
        font-size: 2.2rem;
    }
     
    .route-details {
        grid-template-columns: 1fr;
    }

    .amount-input {
        font-size: 1.5rem;
        width: 150px;
    }

    .token-row {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .token-select-btn {
        min-width: auto;
    }
}
